LvrAviseImporter - auch als Plugin, Anpassung der Auswahl der HPs - CreateHilfeplanInfos - wird so überschreibbar
This commit is contained in:
@@ -11,15 +11,11 @@ namespace BeWo.Service.Import.AvisImport
|
||||
public class AviseImporter
|
||||
{
|
||||
//Der Rückgabewert wird beim Client in einer Messagebox angezeigt
|
||||
public virtual String ImportAvise(List<Avis> avise)
|
||||
public virtual String ImportAvise(List<Avis> avise, List<HilfeplanInfo> hilfeplaene)
|
||||
{
|
||||
var hilfeplaene = CreateHilfeplanInfos();
|
||||
|
||||
var importresult = ImportAbschlagszahlungen(avise, hilfeplaene);
|
||||
|
||||
String importDaten = "1 Datensatz";
|
||||
String vorhandenDaten = "1 Datensatz";
|
||||
|
||||
int importiertCount = 0;
|
||||
int bereitsVorhandenCount = 0;
|
||||
var irFalseList = new List<AvisImportResult>();
|
||||
@@ -74,7 +70,6 @@ namespace BeWo.Service.Import.AvisImport
|
||||
{
|
||||
sb.AppendLine(ir.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var text = sb.ToString();
|
||||
@@ -93,7 +88,6 @@ namespace BeWo.Service.Import.AvisImport
|
||||
foreach (var avis in avise)
|
||||
{
|
||||
var ir = ImportAbschlagszahlung(avis, hilfeplaene);
|
||||
|
||||
result.Add(ir);
|
||||
}
|
||||
|
||||
@@ -124,7 +118,6 @@ namespace BeWo.Service.Import.AvisImport
|
||||
else
|
||||
{
|
||||
result.Message = String.Format("Es wurde kein Hilfeplan mit passendem Zeitraum gefunden.");
|
||||
|
||||
DateTime monatStart = new DateTime(avis.GueltigkeitsDatum.Year, avis.GueltigkeitsDatum.Month, 1);
|
||||
DateTime monatEnde = monatStart.AddMonths(1);
|
||||
|
||||
@@ -176,7 +169,6 @@ namespace BeWo.Service.Import.AvisImport
|
||||
|
||||
//Prüfe ob Klientname vorkommt
|
||||
//var nameBuchung = avis.Verwendungszweck.ToLower();
|
||||
|
||||
//var nachname = hp.CustomerLastName.ToLower();
|
||||
//var vorname = hp.CustomerFirstName.ToLower();
|
||||
//nachname = nachname.Replace("ö", "oe");
|
||||
@@ -187,9 +179,7 @@ namespace BeWo.Service.Import.AvisImport
|
||||
//vorname = vorname.Replace("ü", "ue");
|
||||
//vorname = vorname.Replace("ä", "ae");
|
||||
//vorname = vorname.Replace("ß", "ss");
|
||||
|
||||
//var name = String.Format("{0}{1}", nachname, vorname);
|
||||
|
||||
//if (nameBuchung.Contains(name))
|
||||
//{
|
||||
// return true;
|
||||
@@ -201,7 +191,6 @@ namespace BeWo.Service.Import.AvisImport
|
||||
public virtual AccountingTransaction CreateAbschlagszahlung(Avis avis, HilfeplanInfo hp)
|
||||
{
|
||||
var newAz = new AccountingTransaction();
|
||||
|
||||
newAz.CostBearer2SupportConcept = hp.CostBearer2SupportConcept;
|
||||
newAz.Amount = avis.Betrag;
|
||||
newAz.BookingDate = avis.BuchungsDatum;
|
||||
@@ -220,39 +209,8 @@ namespace BeWo.Service.Import.AvisImport
|
||||
public virtual bool CheckObAbschlagszahlungBereitsImportiert(Avis avis, HilfeplanInfo hp)
|
||||
{
|
||||
var azAltList = DAOFactory.SearchDAO.FindAccountingTransactionsWithImportNotice(CreateImportNotice(avis));
|
||||
|
||||
return azAltList != null && azAltList.Any();
|
||||
}
|
||||
|
||||
public virtual List<HilfeplanInfo> CreateHilfeplanInfos()
|
||||
{
|
||||
List<HilfeplanInfo> liste = new List<HilfeplanInfo>();
|
||||
|
||||
var scList = DAOFactory.GenericDAO.GetAllActiveAndArchived<SupportConcept>();
|
||||
|
||||
foreach (var supportConcept in scList)
|
||||
{
|
||||
foreach (var cb2sc in supportConcept.CostBearer2SupportConceptList)
|
||||
{
|
||||
HilfeplanInfo hi = new HilfeplanInfo();
|
||||
|
||||
hi.Start = cb2sc.StartDate;
|
||||
hi.Ende = cb2sc.EndDate;
|
||||
|
||||
hi.Aktenzeichen = cb2sc.CustomerReferenceNumber;
|
||||
hi.CostBearer2SupportConcept = cb2sc;
|
||||
hi.CustomerFirstName = cb2sc.SupportConcept.Customer.Person.FirstName;
|
||||
hi.CustomerLastName = cb2sc.SupportConcept.Customer.Person.LastName;
|
||||
|
||||
if (hi.Start.HasValue && hi.Ende.HasValue && !String.IsNullOrEmpty(hi.Aktenzeichen))
|
||||
{
|
||||
liste.Add(hi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return liste;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,25 +32,56 @@ namespace BeWo.Service.Import.AvisImport
|
||||
{
|
||||
var reader = new LvrAvisPdfReader();
|
||||
var avise = reader.LeseAvise(daten);
|
||||
var hilfeplaene = CreateHilfeplanInfos();
|
||||
|
||||
return ImportAvise(avise);
|
||||
return ImportAvise(avise, hilfeplaene);
|
||||
}
|
||||
|
||||
public String ImportTextAvise(String text)
|
||||
{
|
||||
var reader = new LvrAvisTextReader();
|
||||
var avise = reader.LeseAvise(text);
|
||||
var hilfeplaene = CreateHilfeplanInfos();
|
||||
|
||||
return ImportAvise(avise);
|
||||
return ImportAvise(avise, hilfeplaene);
|
||||
}
|
||||
|
||||
public String ImportCsvAvise(String csv)
|
||||
public virtual String ImportCsvAvise(String csv)
|
||||
{
|
||||
var reader = new LvrAvisCsvReader();
|
||||
var avise = reader.LeseEinzelAvise(csv);
|
||||
|
||||
return ImportAvise(avise);
|
||||
}
|
||||
var hilfeplaene = CreateHilfeplanInfos();
|
||||
|
||||
return ImportAvise(avise, hilfeplaene);
|
||||
}
|
||||
|
||||
// AB: verschoben um, die Hilfeplanauswahl ggf. spezifischer machen zu können
|
||||
public virtual List<HilfeplanInfo> CreateHilfeplanInfos()
|
||||
{
|
||||
List<HilfeplanInfo> liste = new List<HilfeplanInfo>();
|
||||
var scList = DAOFactory.GenericDAO.GetAllActiveAndArchived<SupportConcept>();
|
||||
|
||||
foreach (var supportConcept in scList)
|
||||
{
|
||||
foreach (var cb2sc in supportConcept.CostBearer2SupportConceptList)
|
||||
{
|
||||
HilfeplanInfo hi = new HilfeplanInfo();
|
||||
hi.Start = cb2sc.StartDate;
|
||||
hi.Ende = cb2sc.EndDate;
|
||||
hi.Aktenzeichen = cb2sc.CustomerReferenceNumber;
|
||||
hi.CostBearer2SupportConcept = cb2sc;
|
||||
hi.CustomerFirstName = cb2sc.SupportConcept.Customer.Person.FirstName;
|
||||
hi.CustomerLastName = cb2sc.SupportConcept.Customer.Person.LastName;
|
||||
|
||||
if (hi.Start.HasValue && hi.Ende.HasValue && !String.IsNullOrEmpty(hi.Aktenzeichen))
|
||||
{
|
||||
liste.Add(hi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return liste;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using BeWo.Service.MessageContracts;
|
||||
using BS.Shared.Core;
|
||||
|
||||
|
||||
namespace BeWo.Service.Plugins
|
||||
{
|
||||
public class DataImporter : AbstractIDSpecificDefaultClass<DataImporter>
|
||||
@@ -27,7 +28,7 @@ namespace BeWo.Service.Plugins
|
||||
|
||||
public virtual UploadImportFileResult ImportLvrAvise(string filename, byte[] daten)
|
||||
{
|
||||
var aviseImport = new LvrAviseImporter();
|
||||
var aviseImport = PluginLoader.FindClass<LvrAviseImporter>();
|
||||
var message = aviseImport.ImportAvise(filename, daten);
|
||||
|
||||
var result = new UploadImportFileResult();
|
||||
@@ -36,6 +37,5 @@ namespace BeWo.Service.Plugins
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user