CB Merge
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.Invoicing;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Services;
|
||||
|
||||
namespace VKMAachen.Invoicing
|
||||
{
|
||||
internal class CustomInvoiceNumberGenerator : InvoiceNumberGenerator
|
||||
{
|
||||
protected override String ApplyPatternWithId(String pattern, long number, String id)
|
||||
{
|
||||
string next = pattern;
|
||||
|
||||
if (!String.IsNullOrEmpty(next))
|
||||
{
|
||||
int pos = next.IndexOf("{n");
|
||||
if (pos >= 0)
|
||||
{
|
||||
int stop = next.IndexOf("}", pos);
|
||||
if (stop > pos)
|
||||
{
|
||||
int nCount = stop - pos - 1;
|
||||
|
||||
String nextNumberStr = number.ToString();
|
||||
|
||||
while (nextNumberStr.Length < nCount)
|
||||
nextNumberStr = "0" + nextNumberStr;
|
||||
|
||||
next = next.Replace(next.Substring(pos, stop - pos + 1), nextNumberStr);
|
||||
}
|
||||
}
|
||||
|
||||
DateTime dt = DateTime.Now.Date.AddMonths(-1);
|
||||
|
||||
next = next.Replace("{jj}", String.Format("{0:yy}", dt));
|
||||
next = next.Replace("{jjjj}", String.Format("{0:yyyy}", dt));
|
||||
|
||||
next = next.Replace("{MM}", String.Format("{0:MM}", dt));
|
||||
next = next.Replace("{mm}", String.Format("{0:MM}", dt));
|
||||
|
||||
}
|
||||
|
||||
return next;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user