Migracja z NAS do Gitea
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
using Soneta.Business;
|
||||
using Soneta.Business.App;
|
||||
using Soneta.Business.UI;
|
||||
using Soneta.Core;
|
||||
using Soneta.Kasa;
|
||||
using Soneta.Ksiega;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FX2_SP_WORKERS.UzupelnijPodmiotOperBank
|
||||
{
|
||||
internal class UzupelnijPodmiotOperBankFun
|
||||
{
|
||||
public static object Start(Context context)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
INavigatorContext navigatorContext = (INavigatorContext)context[typeof(INavigatorContext)];
|
||||
List<int> listaID = ((ZapisKsiegowy[])navigatorContext.SelectedRows).Where(x => x.DefinicjaEwidencji.Typ == TypDokumentu.WyciągBankowyEwidencja
|
||||
&& x.Features["PodmiotOpearcjiBankowej"].ToString() == String.Empty)
|
||||
.Select(x => x.ID)
|
||||
.ToList();
|
||||
|
||||
using (Soneta.Business.Session session = context.Login.CreateSession(false, false))
|
||||
{
|
||||
using (ITransaction tran = session.Logout(true))
|
||||
{
|
||||
|
||||
foreach(int idZapisu in listaID)
|
||||
{
|
||||
ZapisKsiegowy z = KsiegaModule.GetInstance(session).ZapisyKsiegowe.WgDekret.Where(x => x.ID == idZapisu).First();
|
||||
RaportESP raport = KasaModule.GetInstance(session).RaportyESP.NumerWgNumeruDokumentu[z.NumerDokumentu];
|
||||
|
||||
if (raport is not null)
|
||||
{
|
||||
OperacjaBankowa ob = null;
|
||||
try {
|
||||
ob = raport.OperacjeBankowe.Where(x => x.Zaplata.Opis == z.Opis && x.Zaplata.Kwota == z.KwotaZapisu )
|
||||
.FirstOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
ob = raport.OperacjeBankowe.Where(x => x.Zaplata.Opis == z.Opis && x.KwotaRaportu == z.KwotaZapisu)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
if (ob is not null)
|
||||
{
|
||||
z.Features["PodmiotOpearcjiBankowej"] = ob.Podmiot;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
tran.CommitUI();
|
||||
}
|
||||
session.Save();
|
||||
}
|
||||
|
||||
return new MessageBoxInformation("Podmiot operacji bankowe")
|
||||
{
|
||||
Type = MessageBoxInformationType.Information,
|
||||
Text = $"Proces wykonany pomyślnie. Liczba zaktualizowanych operacji: {i}",
|
||||
OKHandler = () => null
|
||||
};
|
||||
}
|
||||
|
||||
public static bool Visible(Context cx)
|
||||
{
|
||||
/*
|
||||
Login log = cx[typeof(Login)] as Login;
|
||||
if (log.Operator.FullName.StartsWith("FX"))
|
||||
return true;
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user