Files
BeWoPlaner/ReportImp/BewegtSystemischeBeratung/Invoicing/CustomInvoiceNumberGenerator.cs
2021-04-14 00:24:38 +02:00

82 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.Invoicing;
using BeWo.Service.Plugins;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.Services;
namespace BewegtSystemischeBeratung.Invoicing
{
//internal class CustomInvoiceNumberGenerator : InvoiceNumberGenerator
//{
// public override string GetNextInvoiceNumber(int increment, InvoiceBase invoiceBase)
// {
// //if (invoiceBase == null || invoiceBase.Type == InvoiceType.Settlement)
// //{
// // return null;
// //}
// var next = base.GetNextInvoiceNumber(increment, invoiceBase);
// int number = 0;
// String pattern = "";
// if (next.IndexOf(":") > 0)
// {
// Int32.TryParse(next.Substring(0, next.IndexOf(":")), out number);
// pattern = next.Substring(next.IndexOf(":") + 1);
// }
// String name = "";
// if (invoiceBase != null)
// {
// Customer c = null;
// if (invoiceBase.CostBearer2SupportConcept != null)
// {
// c = invoiceBase.CostBearer2SupportConcept.SupportConcept.Customer;
// }
// else if (invoiceBase.RecipientCustomerOid.HasValue)
// {
// c = DAOFactory.GenericDAO.LoadByID<Customer>(invoiceBase.RecipientCustomerOid.Value);
// }
// if (c != null)
// {
// name = c.Person.FirstNameLastName;
// }
// }
// DateTime dt = DateTime.Now;
// if (invoiceBase != null && invoiceBase.AccountingPeriodStart.HasValue)
// {
// dt = invoiceBase.AccountingPeriodStart.Value;
// }
// pattern = pattern.Replace("{jjjj}", dt.Year.ToString());
// pattern = pattern.Replace("{name}", name);
// return base.ApplyPatternWithId(pattern, number, "");
// }
// protected override string ApplyPatternWithId(string pattern, long number, string id)
// {
// return number + ":" + pattern;
// }
// }
}