BeWoWalzPaiva/Service/CustomAccountingService - Storno
This commit is contained in:
51
ReportImp/BeWoWalzPaiva/Service/CustomAccountingService.cs
Normal file
51
ReportImp/BeWoWalzPaiva/Service/CustomAccountingService.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared;
|
||||
using BS.Shared.DataContracts;
|
||||
|
||||
|
||||
|
||||
namespace BeWoWalzPaiva.Service
|
||||
{
|
||||
public class CustomAccountingService : AccountingService
|
||||
{
|
||||
|
||||
public override ServiceInvoice ErstelleStornoRechnung(InvoiceBaseDC ibdc)
|
||||
{
|
||||
var i = base.ErstelleStornoRechnung(ibdc);
|
||||
|
||||
SetzeRechnungsnummer(i.InvoiceBase, ibdc);
|
||||
i.InvoiceBase.StornoInvoiceBaseOid = ibdc.InvoiceBaseOid.Value;
|
||||
DAOFactory.GenericDAO.Insert(i);
|
||||
|
||||
var original = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(ibdc.InvoiceBaseOid.Value);
|
||||
original.StornoInvoiceBaseOid = i.Oid;
|
||||
DAOFactory.GenericDAO.Update(original);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
private void SetzeRechnungsnummer(InvoiceBase neu, InvoiceBaseDC alt)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(neu.InvoiceNumber))
|
||||
{
|
||||
neu.InvoiceNumber = alt.InvoiceNumber + " Storno";
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(neu.InvoiceTypeText))
|
||||
{
|
||||
neu.InvoiceTypeText = "Storno";
|
||||
}
|
||||
else
|
||||
{
|
||||
neu.InvoiceTypeText += " Storno";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user