public static UtilityValidation.ValidationState ValidateFornitore(FornitoreDto fornitore, AnagraficaFornitoreDto anagraficaFornitore, CommessaDto commessa) { try { var validation = new UtilityValidation.ValidationState(); if (fornitore!=null && commessa != null && anagraficaFornitore != null) { var fornitori = commessa.Fornitores; if (fornitori != null) { var exist = ((from q in fornitori where q.Id != fornitore.Id && q.AnagraficaFornitoreId == anagraficaFornitore.Id select q).Count() >= 1); validation.State = !exist; if (exist) validation.Message = "Il fornitore selezionato " + BusinessLogic.Fornitore.GetCodifica(anagraficaFornitore) + " è già presente nella commessa " + BusinessLogic.Commessa.GetCodifica(commessa); } } return validation; } catch (Exception ex) { UtilityError.Write(ex); } return null; }
private void BindViewAnagraficaFornitore(AnagraficaFornitoreDto anagraficaFornitore) { try { editCodice.Model = anagraficaFornitore; if (anagraficaFornitore != null) { editCodice.Value = anagraficaFornitore.Codice; editCAP.Value = anagraficaFornitore.CAP; editComune.Value = new Countries.City(anagraficaFornitore.Comune, anagraficaFornitore.CodiceCatastale, anagraficaFornitore.Provincia); editEmail.Value = anagraficaFornitore.Email; editFAX.Value = anagraficaFornitore.Fax; editIndirizzo.Value = anagraficaFornitore.Indirizzo; editMobile.Value = anagraficaFornitore.Mobile; editPartitaIVA.Value = anagraficaFornitore.PartitaIva; editRagioneSociale.Value = anagraficaFornitore.RagioneSociale; editTelefono.Value = anagraficaFornitore.Telefono; editLocalita.Value = anagraficaFornitore.Localita; } } catch (Exception ex) { UtilityError.Write(ex); } }
public FatturaAcquistoView(AnagraficaFornitoreDto anagraficaFornitore, Tipi.StatoFattura statoFattura) { InitializeComponent(); try { var viewModel = (FatturaAcquisto.FatturaAcquistoViewModel)ViewModel; if (viewModel != null) { viewModel.AnagraficaFornitore = anagraficaFornitore; viewModel.StatoFattura = statoFattura; } } catch (Exception ex) { UtilityError.Write(ex); } }
public static UtilityValidation.ValidationState ValidateAnagraficaFornitore(AnagraficaFornitoreDto anagraficaFornitore, IEnumerable<AnagraficaFornitoreDto> anagraficheFornitori) { try { if (anagraficaFornitore != null && anagraficheFornitori != null) { var validated = new UtilityValidation.ValidationState(); var exist = ((from q in anagraficheFornitori where q.Id != anagraficaFornitore.Id && q.Codice == anagraficaFornitore.Codice select q).Count() >= 1); validated.State = !exist; if (exist) validated.Message = "Il fornitore con ragione sociale " + anagraficaFornitore.RagioneSociale + " è già presente in archivio con il codice " + anagraficaFornitore.Codice; return validated; } } catch (Exception ex) { UtilityError.Write(ex); } return null; }
private void BindViewAnagraficaFornitore(AnagraficaFornitoreDto anagraficaFornitore) { try { editAnagraficaFornitore.Model = anagraficaFornitore; editAnagraficaFornitore.Value = BusinessLogic.Fornitore.GetCodifica(anagraficaFornitore); } catch (Exception ex) { UtilityError.Write(ex); } }
public static string GetCodifica(AnagraficaFornitoreDto anagraficaFornitore) { try { if (anagraficaFornitore != null) { var codifica = anagraficaFornitore.Codice + " - " + anagraficaFornitore.RagioneSociale; return codifica; } } catch (Exception ex) { UtilityError.Write(ex); } return null; }
/// <summary> /// Deletes anagraficafornitore from the database by the given dto object. /// </summary> /// <param name="anagraficafornitore">The dto object.</param> public void DeleteAnagraficaFornitore(AnagraficaFornitoreDto anagraficafornitore) { this.AnagraficaFornitoreService.Delete(anagraficafornitore); this.UnitOfWork.SaveChanges(); }
private void BindViewAnagraficaFornitore(AnagraficaFornitoreDto anagraficaFornitore) { try { editFornitore.Model = anagraficaFornitore; if (anagraficaFornitore != null) { editFornitore.Value = BusinessLogic.Fornitore.GetCodifica(anagraficaFornitore); var viewModel = new Fornitore.FornitoreViewModel(); var fornitori = viewModel.ReadFornitori(anagraficaFornitore); fornitoriAnagraficaId = (from q in fornitori select q.Id).ToList(); } } catch (Exception ex) { UtilityError.Write(ex); } }
public static UtilityReport.Report GetReportFornitore(AziendaDto azienda, AnagraficaFornitoreDto anagraficaFornitore, IList<FornitoreDto> fornitori, DateTime data) { try { if (azienda!=null && fornitori != null && anagraficaFornitore!=null) { var report = new UtilityReport.Report(); AddReportAzienda(azienda, report, data); AddReportProspettoFornitore(anagraficaFornitore, report); AddReportTotaliFornitore(fornitori, report, data); var tableCommesse = new UtilityReport.Table("Commessa", "TotaleImponibile", "TotaleIVA", "TotaleFatture", "TotalePagamentiDato", "TotalePagamentiDare"); var tableFatture = new UtilityReport.Table("Numero", "Data", "Scadenza", "Descrizione", "Imponibile", "IVA", "Totale", "TotalePagamentiDato", "TotalePagamentiDare"); var tablePagamenti = new UtilityReport.Table("Numero", "Data", "TipoPagamento", "Descrizione", "Note", "TransazionePagamento", "Importo"); foreach (var fornitore in fornitori) { //totali per commessa var commessa = fornitore.Commessa; AddReportCommessaFornitore(tableCommesse, fornitore, commessa, data); //fatture per commessa var codificaCommessa = "COMMESSA " + BusinessLogic.Commessa.GetCodifica(commessa); tableFatture.AddRowMerge(Color.LightGray, codificaCommessa, "", "", "", "", "", "", "", ""); var fattureAcquisto = fornitore.FatturaAcquistos; if (fattureAcquisto != null) { foreach (var fatturaAcquisto in fattureAcquisto) { AddReportFatturaAcquistoFornitore(tableFatture, fatturaAcquisto, data); //pagamenti per fattura var totaleFattura = UtilityValidation.GetEuro(fatturaAcquisto.Totale); var _statoFattura = BusinessLogic.Fattura.GetStato(fatturaAcquisto); var statoFattura = UtilityEnum.GetDescription<Tipi.StatoFattura>(_statoFattura); var codificaFattura = "FATTURA " + BusinessLogic.Fattura.GetCodifica(fatturaAcquisto) + " - TOTALE IVATO " + totaleFattura + " - " + statoFattura.ToUpper(); tablePagamenti.AddRowMerge(Color.LightGray, codificaFattura, "", "", "", "", "", ""); var pagamenti = (from q in fatturaAcquisto.Pagamentos orderby q.Data ascending select q).ToList(); if (pagamenti != null) { foreach (var pagamento in pagamenti) AddReportPagamentoFornitore(tablePagamenti, pagamento); } //sconto var _sconto = UtilityValidation.GetDecimal(fatturaAcquisto.Sconto); if (_sconto > 0) { var sconto = UtilityValidation.GetEuro(_sconto); tablePagamenti.AddRow("", "", "", "", "", "SCONTO", sconto); } //nota di credito/resi var _totaleResi = BusinessLogic.Fattura.GetTotaleResi(fatturaAcquisto); if (_totaleResi > 0) { var totaleResi = UtilityValidation.GetEuro(_totaleResi); tablePagamenti.AddRow("", "", "", "", "", "NOTA DI CREDITO", totaleResi); } } } } report.Tables.Add(tableCommesse); report.Tables.Add(tableFatture); report.Tables.Add(tablePagamenti); return report; } } catch (Exception ex) { UtilityError.Write(ex); } return null; }
/// <summary> /// Adds a new anagraficafornitore from the given dto object into the database. /// </summary> /// <param name="anagraficafornitore">The dto object.</param> /// <returns>The dto key of the newly created anagraficafornitore.</returns> public string CreateAnagraficaFornitore(AnagraficaFornitoreDto anagraficafornitore) { string key = this.AnagraficaFornitoreService.Add(anagraficafornitore); this.UnitOfWork.SaveChanges(); return key; }
private static void AddReportFornitore(UtilityReport.Table tableFornitori, AnagraficaFornitoreDto anagraficaFornitore, IList<FornitoreDto> fornitoriAnagrafica, DateTime data) { try { if (anagraficaFornitore != null && fornitoriAnagrafica != null) { var _totaleFatture = BusinessLogic.Commessa.GetTotaleFattureAcquisto(fornitoriAnagrafica, data); var _totalePagamentiDato = BusinessLogic.Commessa.GetTotalePagamentiDato(fornitoriAnagrafica, data); var _totalePagamentiDare = BusinessLogic.Commessa.GetTotalePagamentiDare(fornitoriAnagrafica, data); var totaleFatture = UtilityValidation.GetEuro(_totaleFatture); var totalePagamentiDato = UtilityValidation.GetEuro(_totalePagamentiDato); var totalePagamentiDare = UtilityValidation.GetEuro(_totalePagamentiDare); var codificaFornitore = BusinessLogic.Fornitore.GetCodifica(anagraficaFornitore); tableFornitori.AddRow(codificaFornitore, totaleFatture, totalePagamentiDato, totalePagamentiDare); } } catch (Exception ex) { UtilityError.Write(ex); } }
private static void AddReportProspettoFornitore(AnagraficaFornitoreDto anagraficaFornitore, UtilityReport.Report report) { try { if (anagraficaFornitore != null) { report.AddData("RagioneSociale", anagraficaFornitore.RagioneSociale); report.AddData("PartitaIva", anagraficaFornitore.PartitaIva); report.AddData("Indirizzo", anagraficaFornitore.Indirizzo); report.AddData("CAP", anagraficaFornitore.CAP); report.AddData("Localita", anagraficaFornitore.Localita); report.AddData("Comune", anagraficaFornitore.Comune); report.AddData("Provincia", anagraficaFornitore.Provincia); } } catch (Exception ex) { UtilityError.Write(ex); } }
public FornitoreDto(int _id, int _commessaId, decimal? _totaleFattureAcquisto, string _stato, decimal? _totalePagamenti, string _note, decimal? _totaleNoteCredito, int _anagraficaFornitoreId, CommessaDto _commessa, AnagraficaFornitoreDto _anagraficaFornitore, IList<FatturaAcquistoDto> _fatturaAcquistos, IList<NotaCreditoDto> _notaCreditos) { this.Id = _id; this.CommessaId = _commessaId; this.TotaleFattureAcquisto = _totaleFattureAcquisto; this.Stato = _stato; this.TotalePagamenti = _totalePagamenti; this.Note = _note; this.TotaleNoteCredito = _totaleNoteCredito; this.AnagraficaFornitoreId = _anagraficaFornitoreId; this.Commessa = _commessa; this.AnagraficaFornitore = _anagraficaFornitore; this.FatturaAcquistos = _fatturaAcquistos; this.NotaCreditos = _notaCreditos; }
public PagamentoUnificatoDto(int _id, DateTime? _data, decimal? _importo, string _note, string _codice, string _tipoPagamento, string _descrizione, int _aziendaId, int _anagraficaFornitoreId, AziendaDto _azienda, AnagraficaFornitoreDto _anagraficaFornitore, IList<PagamentoDto> _pagamentos, IList<PagamentoUnificatoFatturaAcquistoDto> _pagamentoUnificatoFatturaAcquistos) { this.Id = _id; this.Data = _data; this.Importo = _importo; this.Note = _note; this.Codice = _codice; this.TipoPagamento = _tipoPagamento; this.Descrizione = _descrizione; this.AziendaId = _aziendaId; this.AnagraficaFornitoreId = _anagraficaFornitoreId; this.Azienda = _azienda; this.AnagraficaFornitore = _anagraficaFornitore; this.Pagamentos = _pagamentos; this.PagamentoUnificatoFatturaAcquistos = _pagamentoUnificatoFatturaAcquistos; }
public ReportJobDto(int _id, DateTime? _creazione, string _codice, string _denominazione, string _tipo, DateTime? _elaborazione, string _note, string _nomeFile, int _aziendaId, int? _anagraficaCommittenteId, int? _anagraficaFornitoreId, AziendaDto _azienda, AnagraficaCommittenteDto _anagraficaCommittente, AnagraficaFornitoreDto _anagraficaFornitore) { this.Id = _id; this.Creazione = _creazione; this.Codice = _codice; this.Denominazione = _denominazione; this.Tipo = _tipo; this.Elaborazione = _elaborazione; this.Note = _note; this.NomeFile = _nomeFile; this.AziendaId = _aziendaId; this.AnagraficaCommittenteId = _anagraficaCommittenteId; this.AnagraficaFornitoreId = _anagraficaFornitoreId; this.Azienda = _azienda; this.AnagraficaCommittente = _anagraficaCommittente; this.AnagraficaFornitore = _anagraficaFornitore; }