private string GetBodyAvvisoScadenzaFattura(FatturaVenditaDto fatturaVendita, DateTime data, decimal totaleIncassiAvere) { try { var pathRoot = UtilityWeb.GetRootPath(context); var pathTemplateAvvisoScadenzaFattura = pathRoot + @"\Resources\Templates\TemplateAvvisoScadenzaFatturaVendita.html"; var content = System.IO.File.ReadAllText(pathTemplateAvvisoScadenzaFattura); var codificaFattura = BusinessLogic.Fattura.GetCodifica(fatturaVendita).ToLower(); var codificaAzienda = BusinessLogic.Azienda.GetCodifica(fatturaVendita); var codificaIncassi = GetCodificaIncassi(fatturaVendita.Incassos); var codificaCommittente = BusinessLogic.Committente.GetCodifica(fatturaVendita.Committente); var scadenza = UtilityValidation.GetDataND(fatturaVendita.Scadenza); var totaleIncassiAvuto = UtilityValidation.GetEuro(BusinessLogic.Fattura.GetTotaleIncassiAvuto(fatturaVendita, data)); var totaleFattura = UtilityValidation.GetEuro(fatturaVendita.Totale); content = content.Replace("$codificaAzienda$", codificaAzienda); content = content.Replace("$codificaFattura$", codificaFattura); content = content.Replace("$codificaCommittente$", codificaCommittente); content = content.Replace("$codificaIncassi$", codificaIncassi); content = content.Replace("$scadenza$", scadenza); content = content.Replace("$totaleIncassiAvuto$", totaleIncassiAvuto); content = content.Replace("$totaleIncassiAvere$", UtilityValidation.GetEuro(totaleIncassiAvere)); content = content.Replace("$totaleFattura$", totaleFattura); return(content); } catch (Exception ex) { UtilityError.Write(ex); } return(null); }
private string GetBodyAvvisoScadenzaFattura(FatturaAcquistoDto fatturaAcquisto, DateTime data, decimal totalePagamentiDare) { try { var pathRoot = UtilityWeb.GetRootPath(context); var pathTemplateAvvisoScadenzaFattura = pathRoot + @"\Resources\Templates\TemplateAvvisoScadenzaFatturaAcquisto.html"; var content = System.IO.File.ReadAllText(pathTemplateAvvisoScadenzaFattura); var codificaFattura = BusinessLogic.Fattura.GetCodifica(fatturaAcquisto).ToLower(); var codificaAzienda = BusinessLogic.Azienda.GetCodifica(fatturaAcquisto); var codificaFornitore = BusinessLogic.Fornitore.GetCodifica(fatturaAcquisto.Fornitore); var codificaPagamenti = GetCodificaPagamenti(fatturaAcquisto.Pagamentos); var scadenza = UtilityValidation.GetDataND(fatturaAcquisto.Scadenza); var totalePagamentiDato = UtilityValidation.GetEuro(BusinessLogic.Fattura.GetTotalePagamentiDato(fatturaAcquisto, data)); var totaleFattura = UtilityValidation.GetEuro(fatturaAcquisto.Totale); content = content.Replace("$codificaAzienda$", codificaAzienda); content = content.Replace("$codificaFattura$", codificaFattura); content = content.Replace("$codificaFornitore$", codificaFornitore); content = content.Replace("$codificaPagamenti$", codificaPagamenti); content = content.Replace("$scadenza$", scadenza); content = content.Replace("$totalePagamentiDato$", totalePagamentiDato); content = content.Replace("$totalePagamentiDare$", UtilityValidation.GetEuro(totalePagamentiDare)); content = content.Replace("$totaleFattura$", totaleFattura); return(content); } catch (Exception ex) { UtilityError.Write(ex); } return(null); }
private string GetBodyNotificaReport(AziendaDto azienda, DateTime elaborazione, string url, Tipi.TipoReport tipoReport) { try { var pathRoot = UtilityWeb.GetRootPath(context); var templateName = ""; if (tipoReport == Tipi.TipoReport.Committenti) { templateName = "TemplateReportCommittenti.html"; } else if (tipoReport == Tipi.TipoReport.Fornitori) { templateName = "TemplateReportFornitori.html"; } var pathTemplateReport = pathRoot + @"\Resources\Templates\" + templateName; var content = System.IO.File.ReadAllText(pathTemplateReport); var codificaAzienda = BusinessLogic.Azienda.GetCodifica(azienda); content = content.Replace("$elaborazione$", elaborazione.ToString("dd/MM/yyyy")); content = content.Replace("$url$", url); content = content.Replace("$codificaAzienda$", codificaAzienda); return(content); } catch (Exception ex) { UtilityError.Write(ex); } return(null); }
private void btnStampaReport_Click(object sender, EventArgs e) { try { var anagraficaCommittente = (AnagraficaCommittenteDto)editCommittente.Model; if (anagraficaCommittente != null) { var ragioneSociale = (anagraficaCommittente.RagioneSociale != null ? anagraficaCommittente.RagioneSociale.Replace(" ", "") : null); var data = DateTime.Today.ToString("ddMMyyyy"); var elaborazione = UtilityValidation.GetData(editElaborazione.Value); string pathTemplate = UtilityWeb.GetRootPath(Context) + @"Resources\Templates\TemplateSituazioneCommittente.doc"; var fileName = "SituazioneCommittente_" + ragioneSociale + "_" + data + ".PDF"; var pathReport = UtilityWeb.GetRootPath(Context) + @"Resources\Reports\" + fileName; var azienda = (AziendaDto)editAzienda.Model; var viewModel = new Committente.CommittenteViewModel(); var committenti = viewModel.ReadCommittenti(anagraficaCommittente).ToList(); var report = BusinessLogic.ReportJob.GetReportCommittente(azienda, anagraficaCommittente, committenti, elaborazione); if (report != null) { bool performed = report.Create(pathTemplate, pathReport); if (performed) { string url = UtilityWeb.GetRootUrl(Context) + @"/Resources/Reports/" + fileName; editNomeFile.Url = url; editNomeFile.Value = fileName; } } } } catch (Exception ex) { UtilityError.Write(ex); } }
private void CheckReportFornitori() { try { var wcf = new WcfService.Service(); var aziende = wcf.ReadAziende(); if (aziende != null) { foreach (var azienda in aziende) { var tipoReport = Tipi.TipoReport.Fornitori; var occorrenza = 7; //in giorni var notifica = BusinessLogic.Notifica.GetNewNotifica(azienda, tipoReport, name); var _notifica = wcf.ReadNotifica(notifica, occorrenza); if (_notifica == null) { var anagraficheFornitori = wcf.ReadAnagraficheFornitori(azienda).ToList(); if (anagraficheFornitori != null) { var data = DateTime.Today.ToString("ddMMyyyy"); var elaborazione = DateTime.Now; string pathTemplate = UtilityWeb.GetRootPath(Context) + @"Resources\Templates\TemplateResocontoFornitori.doc"; var fileName = "ResocontoFornitori_" + data + ".PDF"; var pathReport = UtilityWeb.GetRootPath(Context) + @"Resources\Reports\" + fileName; var fornitori = wcf.ReadFornitori(anagraficheFornitori).ToList(); var report = BusinessLogic.ReportJob.GetReportFornitori(azienda, anagraficheFornitori, fornitori, elaborazione); if (report != null) { bool performed = report.Create(pathTemplate, pathReport); if (performed) { string url = UtilityWeb.GetRootUrl(Context) + @"/Resources/Reports/" + fileName; var subject = "Report Business Analyst - " + UtilityEnum.GetDescription <Tipi.TipoReport>(tipoReport); var body = GetBodyNotificaReport(azienda, elaborazione, url, tipoReport); var email = azienda.Email; if (email != null && email.Length > 0) { UtilityEmail.Send("*****@*****.**", subject, body); var sent = UtilityEmail.Send(email, subject, body); if (sent) { notifica.Descrizione = subject; wcf.CreateNotifica(notifica); } } } } } } } } } catch (Exception ex) { UtilityError.Write(ex); } }
private void btnStampaReport_Click(object sender, EventArgs e) { try { bool saved = Save(); if (saved) { var azienda = (AziendaDto)editAzienda.Model; if (azienda != null) { var viewModelAnagraficaFornitore = new AnagraficaFornitore.AnagraficaFornitoreViewModel(); var anagraficheFornitori = viewModelAnagraficaFornitore.ReadAnagraficheFornitori(azienda).ToList(); if (anagraficheFornitori != null) { var data = DateTime.Today.ToString("ddMMyyyy"); var elaborazione = UtilityValidation.GetData(editElaborazione.Value); string pathTemplate = UtilityWeb.GetRootPath(Context) + @"Resources\Templates\TemplateResocontoFornitori.doc"; var fileName = "ResocontoFornitori_" + data + ".PDF"; var pathReport = UtilityWeb.GetRootPath(Context) + @"Resources\Reports\" + fileName; var viewModel = new Fornitore.FornitoreViewModel(); var fornitori = viewModel.ReadFornitori(anagraficheFornitori).ToList(); var report = BusinessLogic.ReportJob.GetReportFornitori(azienda, anagraficheFornitori, fornitori, elaborazione); if (report != null) { bool performed = report.Create(pathTemplate, pathReport); if (performed) { string url = UtilityWeb.GetRootUrl(Context) + @"/Resources/Reports/" + fileName; editNomeFile.Url = url; editNomeFile.Value = fileName; } } } } } } catch (Exception ex) { UtilityError.Write(ex); } }