183 lines
5.6 KiB
C#
183 lines
5.6 KiB
C#
using Soneta.Business;
|
|
using Soneta.Business.App;
|
|
using Soneta.Core;
|
|
using Soneta.CRM;
|
|
using Soneta.EwidencjaVat;
|
|
using Soneta.Handel;
|
|
using Soneta.Tools;
|
|
using Soneta.Types;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace FX2_SP_WORKERS.PrzeksięgowanieProwizje
|
|
{
|
|
internal class PrzeksiegowanieParams : ContextBase
|
|
{
|
|
private List<Kontrahent> listaPointow = new List<Kontrahent>();
|
|
private DokEwidencji dok = null;
|
|
private List<DefinicjaDokumentu> listaDefPK = new List<DefinicjaDokumentu>();
|
|
private string[] listaBazSprzedaz = { "WSCHODNI FRONT", "PAN VIKING" };
|
|
public PrzeksiegowanieParams(Context context) : base(context)
|
|
{
|
|
dok = (DokEwidencji)context[typeof(DokEwidencji)];
|
|
|
|
//Ustawianie definicji PK
|
|
listaDefPK = CoreModule.GetInstance(Context).DefDokumentow.WgTypu[TypDokumentu.PKEwidencja].ToList();
|
|
defPK = CoreModule.GetInstance(Context).DefDokumentow.WgSymbolu["PROW"];
|
|
|
|
if (defPK is null)
|
|
defPK = listaDefPK.FirstOrDefault();
|
|
|
|
//Ustawianie listy sprzedaży detalicznej
|
|
listaPointow = CRMModule.GetInstance(Context).Kontrahenci.WgNazwy
|
|
.Where(x => x.AccessRight is not AccessRights.Denied && x.Nazwa.ToLower().StartsWith("sprzedaż detaliczna"))
|
|
.ToList();
|
|
|
|
//Ustawianie daty przeksięgowania
|
|
dataPrzyksiegowania = dok.DataEwidencji;
|
|
|
|
if (dok.Typ == TypDokumentu.SprzedażEwidencja)
|
|
if (dok.Dokument is null || dok.Dokument is not DokumentHandlowy)
|
|
sumaRaportu = ((SprzedazEwidencja)dok).VAT_Brutto.Value;
|
|
else
|
|
sumaRaportu = ((DokumentHandlowy)dok.Dokument).Suma.Brutto;
|
|
}
|
|
|
|
private DefinicjaDokumentu defPK = null;
|
|
|
|
[Caption("Definicja PK"), Priority(1), DefaultWidth(25)]
|
|
public DefinicjaDokumentu DefPK
|
|
{
|
|
get => defPK;
|
|
set
|
|
{
|
|
if (value is not null)
|
|
{
|
|
defPK = value;
|
|
OnChanged(EventArgs.Empty);
|
|
}
|
|
}
|
|
}
|
|
public object GetListDefPK()
|
|
{
|
|
return listaDefPK;
|
|
}
|
|
|
|
private decimal sumaRaportu = 0;
|
|
|
|
[Caption("Suma raportu płatności"), Priority(2), DefaultWidth(25)]
|
|
public decimal SumaRaportu
|
|
{
|
|
get => sumaRaportu;
|
|
set
|
|
{
|
|
sumaRaportu = value;
|
|
OnChanged(EventArgs.Empty);
|
|
}
|
|
}
|
|
public bool IsReadOnlySumaRaportu()
|
|
{
|
|
return dok.Typ == TypDokumentu.SprzedażEwidencja;
|
|
}
|
|
|
|
public Kontrahent punktPointa = null;
|
|
|
|
[Caption("Punkt Pointa"), Priority(3), DefaultWidth(25)]
|
|
public Kontrahent PunktPointaWschodni
|
|
{
|
|
get => punktPointa;
|
|
set
|
|
{
|
|
punktPointa = value;
|
|
OnChanged(EventArgs.Empty);
|
|
}
|
|
}
|
|
|
|
public bool IsVisiblePunktPointaWschodni()
|
|
{
|
|
return dok.Typ != TypDokumentu.SprzedażEwidencja && listaBazSprzedaz.Contains(((Login)Context[typeof(Login)]).Database.Name.Trim().ToUpper());
|
|
}
|
|
public object GetListPunktPointaWschodni()
|
|
{
|
|
return listaPointow;
|
|
}
|
|
|
|
[Caption("Punkt Pointa"), Priority(3), DefaultWidth(25)]
|
|
public Kontrahent[] PunktPointa
|
|
{
|
|
get => punktPointaSprzedazList;
|
|
set
|
|
{
|
|
punktPointaSprzedazList = value;
|
|
|
|
if (value.Any())
|
|
punktPointa = value.FirstOrDefault();
|
|
OnChanged(EventArgs.Empty);
|
|
}
|
|
}
|
|
|
|
public bool IsVisiblePunktPointa()
|
|
{
|
|
return dok.Typ != TypDokumentu.SprzedażEwidencja && !listaBazSprzedaz.Contains(((Login)Context[typeof(Login)]).Database.Name.Trim().ToUpper());
|
|
}
|
|
|
|
private Kontrahent[] punktPointaSprzedazList = null;
|
|
|
|
[Caption("Kontrahent"), Priority(3), DefaultWidth(25)]
|
|
public Kontrahent[] PunktPointaSprzedaz
|
|
{
|
|
get => punktPointaSprzedazList;
|
|
set
|
|
{
|
|
punktPointaSprzedazList = value;
|
|
|
|
if (value.Any())
|
|
punktPointa = value.FirstOrDefault();
|
|
OnChanged(EventArgs.Empty);
|
|
}
|
|
}
|
|
public bool IsVisiblePunktPointaSprzedaz()
|
|
{
|
|
return dok.Typ == TypDokumentu.SprzedażEwidencja;
|
|
}
|
|
|
|
private Date dataPrzyksiegowania;
|
|
|
|
[Caption("Data przyksięowania"), Priority(4), DefaultWidth(15), Required]
|
|
public Date DataPrzyksiegowania
|
|
{
|
|
get => dataPrzyksiegowania;
|
|
set
|
|
{
|
|
dataPrzyksiegowania = value;
|
|
OnChanged(EventArgs.Empty);
|
|
}
|
|
}
|
|
|
|
private string kontoKsiegowania = "202";
|
|
private string[] listaKontoKsiegowania = { "202", "204" };
|
|
|
|
[Caption("Księgowanie na konto"), Priority(5), DefaultWidth(15)]
|
|
public string KontoKsiegowania
|
|
{
|
|
get => kontoKsiegowania;
|
|
set
|
|
{
|
|
if(listaKontoKsiegowania.Contains(value))
|
|
kontoKsiegowania = value;
|
|
|
|
OnChanged(EventArgs.Empty);
|
|
}
|
|
}
|
|
public object GetListKontoKsiegowania()
|
|
{
|
|
return listaKontoKsiegowania;
|
|
}
|
|
|
|
public bool IsReadOnlyKontoKsiegowania()
|
|
{
|
|
return ((Login)Context[typeof(Login)]).Database.Name.Trim().ToUpper() != "PAN VIKING";
|
|
}
|
|
}
|
|
} |