public RegistrazioneSpeseAccorpateUI(SpesaDTO spesa, CondominioDTO condominio, EsercizioDTO esercizio, Gipasoft.Windows.Forms.Templates.UpdatableStandardForm formGestione, List<SpesaDTO> spese)
        {
            InitializeComponent();

            _spese = spese;
            _formGestione = formGestione;
            _condominio = condominio;
            _esercizio = esercizio;
            _spesa = spesa;
        }
Example #2
0
        public RegistrazioneSpeseUI(SpesaDTO spesa, CondominioDTO condominio, EsercizioDTO esercizio, UpdatableStandardForm formGestione)
        {
            try
            {
                Dirty = false;
                InitializeComponent();
                _isInserimento = false;

                inizializza();

                _formGestione = formGestione;
                _condominio = condominio;
                _esercizio = esercizio;
                _spesa = _fatturaService.GetSingleInstance(spesa);

                if (_spesa != null)
                {
                    var prop = new CustomControlProperties { AlwaysEnable = true };
                    btnDocumento.Tag = prop;

                    // Imposto layout pagamento
                    _pagamentoImmediato = false;
                    btnPagamento.Text = @"Pagamento";

                    if (_spesa.StatoSpesa != StatoSpesaEnum.Inserita)
                    {
                        btnPagamento.Visible = false;
                        if (_spesa.StatoSpesa == StatoSpesaEnum.Pagata || _spesa.StatoSpesa == StatoSpesaEnum.ParzialmentePagata)
                            btnAnnullaPagamento.Visible = true;
                    }

                    if (_spesa.IdSpesaRiferimento != null && _spesa.IdSpesaRiferimento > 0)
                    {
                        _speseAccorpate = true;
                        _spesaRiferimento = _fatturaService.GetById(_spesa.IdSpesaRiferimento.Value);
                    }

                    if (_spesa.Dettagli.Count > 1)
                    {
                        altreSpeseDettaglio.Visible = false;
                        altreSpeseEsenti.Visible = false;
                        speseEsentiRitenuta.Visible = false;
                        lblAltreSpeseDettaglio.Visible = false;
                        lblAltreSpese.Visible = false;
                        lblAltreSpeseEsenti.Visible = false;
                        getMovimentoContabileService().IsMultiSpesa = true;
                    }
                }

            }
            catch (Exception ex)
            {
                var idCondominio = "<NULL>";
                if (condominio != null)
                    idCondominio = condominio.ID.ToString();

                var idEsercizio = "<NULL>";
                if (esercizio != null)
                    idEsercizio = esercizio.ID.ToString();

                
                _log.Error("Errore nel costruttore - " + Utility.GetMethodDescription() + " - spesa:" + getIdSpesa().GetValueOrDefault() + " - condominio:" + idCondominio + " - esercizio:" + idEsercizio + " - azienda:" + Security.Login.Instance.CurrentLogin().Azienda, ex);

                throw;
            }

        }
        public MovimentoContabileEconomicoUC(TestataMovimentoContabileDTO testata, EsercizioDTO esercizio, UpdatableStandardForm formGestione)
        {
            try
            {
                InitializeComponent();

                _esercizio = esercizio;
                _testata = testata;
                _formGestione = formGestione;

                inizializza();

                if (_esercizio == null && testata.IdEsercizio != null && testata.IdEsercizio > 0)
                    _esercizio = getEsercizioService().GetById(testata.IdEsercizio.Value);

                _movimentiDare = getMovimentoContabileService().GetMovimentiLista(_testata);

                if (testata.Tipo == TipoTestataMovimentoContabileEnum.Automatica)
                {
                    groupDettaglioMovimento.Visible = false;
                    groupDettaglioMovimento.Enabled = false;
                    if (!_confirmByParent)
                        btnConferma.Visible = true;
                    btnRicevuta.Visible = true;
                }
                else
                {
                    groupDettaglioMovimento.Visible = true;
                    groupDettaglioMovimento.Enabled = true;
                }

                _movimentoAvere = getMovimentoContabileService().GetMovimentoSingolo(_testata);
                if (_movimentoAvere != null)
                {
                    _causale = _movimentoAvere.Causale;

                    int? idEsercizio = null;
                    if (_esercizio != null)
                        idEsercizio = _esercizio.ID;
                    _conto = getPianoContiService().GetById(_movimentoAvere.IdConto.GetValueOrDefault(), idEsercizio);

                    // Se il sottoconto รจ presente ed ha valore negativo trattasi di conto corrente bancario bugid#3754
                    if (_movimentoAvere.IdSottoConto != null)
                    {
                        if (_movimentoAvere.IdSottoConto.GetValueOrDefault() < 0)
                            _idContoBancario = _movimentoAvere.IdSottoConto.GetValueOrDefault()*-1;
                    }
                    
                    _importo = _movimentoAvere.Importo.GetValueOrDefault();
                    descrizioneDettaglio.Value = _movimentoAvere.Descrizione;
                    noteDettaglio.Value = _testata.Note;
                }

                numeroProtocollo.Value = testata.NumeroProtocollo;
                archiviazioneOttica.Checked = testata.IsAbilitataArchiviazioneOttica;
                dataRegistrazione.DateTime = testata.DataRegistrazione.GetValueOrDefault();

                dataInizioCompetenza.Value = null;
                dataFineCompetenza.Value = null;
                if (testata.DataInizioCompetenza != null)
                    dataInizioCompetenza.DateTime = testata.DataInizioCompetenza.GetValueOrDefault();
                if (testata.DataFineCompetenza != null)
                    dataFineCompetenza.DateTime = testata.DataFineCompetenza.GetValueOrDefault();

                sceltaEsercizioGroupBox.Enabled = false;
                sceltaCondominioCombo1.Enabled = false;
                esercizi.Enabled = false;

                btnRiparto.Enabled = false;
                btnConferma.Enabled = false;
                backgroundWorkerLoadDati.RunWorkerAsync(_movimentiDare);
            }
            catch (Exception ex)
            {
                var idStr = "<NULL>";
                if (testata != null)
                    idStr = testata.ID.ToString();

                var idEsercizioStr = "<NULL>";
                if (esercizio != null)
                    idEsercizioStr = esercizio.ID.ToString();

                var nomeForm = "<NULL>";
                if (formGestione != null)
                    nomeForm = formGestione.Name;

                _log.ErrorFormat("Errore insaspettato nel costruttore - {0} - testata:{1} - esercizio:{2} - formGestione:{3}", ex, Utility.GetMethodDescription(), idStr, idEsercizioStr, nomeForm);
                throw;
            }
        }