Initial Json commit from 2 years ago
This commit is contained in:
@ -90,122 +90,108 @@ namespace Tanshu.Accounts.Management
|
||||
var fDate = finishDate.AddDays(1).AddHours(7);
|
||||
int count = 0;
|
||||
bwGo.ReportProgress(++count, "Starting on " + startDate.ToShortDateString() + " to " + finishDate.ToShortDateString());
|
||||
using (var bi = new ManagementBI())
|
||||
ManagementBI.ClearModifiers(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Modifiers Cleared");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
bwGo.ReportProgress(++count, "Clearing Modifiers");
|
||||
bi.ClearModifiers(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, " -- Modifiers Cleared");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwGo.ReportProgress(++count, "Deleting Tobacco");
|
||||
bi.DeleteTobacco(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, " -- Tobacco Deleted");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwGo.ReportProgress(++count, "Deleting Reprints");
|
||||
bi.DeleteReprints(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, " -- Reprints Deleted");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwGo.ReportProgress(++count, "Deleting Voids");
|
||||
bi.DeleteVoid(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, " -- Voids Deleted");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwGo.ReportProgress(++count, "Combining Kots");
|
||||
bi.CombineKots(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, " -- Kots Combined");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwGo.ReportProgress(++count, "Removing Blank Kots");
|
||||
bi.RemoveBlankKots(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, " -- Blank Kots Removed");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwGo.ReportProgress(++count, "Moving Staff to NC");
|
||||
bi.MoveStaffToNc(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, " -- Staff Moved");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwGo.ReportProgress(++count, "Starting beer");
|
||||
foreach (var beerDate in beer)
|
||||
{
|
||||
if (beerDate.Date < startDate || beerDate.Date > finishDate)
|
||||
continue;
|
||||
bi.SetBeer(beerDate.Date.AddHours(7), beerDate.Date.AddDays(1).AddHours(7), beerDate.Quantity);
|
||||
bwGo.ReportProgress(++count, "Beer set for " + beerDate.Date.ToShortDateString());
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
bwGo.ReportProgress(++count, "Removing Blank Kots");
|
||||
bi.RemoveBlankKots(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, " -- Blank Kots Removed");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
foreach (var saleItem in item.Sale.Where(x => x.IsLiq))
|
||||
{
|
||||
bi.LiqNcSwap(saleItem.Rate, saleItem.Amount, sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Liq NC Swap " + saleItem.Rate.ToString());
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
IList<CreditJson> creditJ = credit.Where(x => x.Date >= startDate && x.Date <= finishDate).ToList();
|
||||
bi.SetQuantityAndDiscount(item.Sale, creditJ, startDate, finishDate);
|
||||
bwGo.ReportProgress(++count, "Sale Done");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bi.RemoveBlankKots(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Blank Kots Removed");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bi.IncreaseLiqIfLess(item.Sale.Where(x => x.IsLiq).ToList(), startDate, finishDate);
|
||||
bwGo.ReportProgress(++count, "Sale Done");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwGo.ReportProgress(++count, "Setting Payments");
|
||||
bi.SetPayments(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, " -- Payments Set");
|
||||
bi.SaveChanges();
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
ManagementBI.DeleteTobacco(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Tobacco Deleted");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
ManagementBI.DeleteReprints(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Reprints Deleted");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
ManagementBI.DeleteVoid(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Voids Deleted");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
ManagementBI.CombineKots(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Kots Combined");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
ManagementBI.RemoveBlankKots(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Blank Kots Removed");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
ManagementBI.MoveStaffToNc(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Staff Moved");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwGo.ReportProgress(++count, "Starting beer");
|
||||
foreach (var beerDate in beer)
|
||||
{
|
||||
if (beerDate.Date < startDate || beerDate.Date > finishDate)
|
||||
continue;
|
||||
ManagementBI.SetBeer(beerDate.Date.AddHours(7), beerDate.Date.AddDays(1).AddHours(7), beerDate.Quantity);
|
||||
bwGo.ReportProgress(++count, "Beer set for " + beerDate.Date.ToShortDateString());
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
ManagementBI.RemoveBlankKots(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Blank Kots Removed");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
foreach (var saleItem in item.Sale.Where(x => x.IsLiq))
|
||||
{
|
||||
ManagementBI.LiqNcSwap(saleItem.Rate, saleItem.Amount, sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Liq NC Swap " + saleItem.Rate.ToString());
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
IList<CreditJson> creditJ = credit.Where(x => x.Date >= startDate && x.Date <= finishDate).ToList();
|
||||
ManagementBI.SetQuantityAndDiscount(item.Sale, creditJ, startDate, finishDate);
|
||||
bwGo.ReportProgress(++count, "Sale Done");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
ManagementBI.RemoveBlankKots(sDate, fDate);
|
||||
bwGo.ReportProgress(++count, "Blank Kots Removed");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
ManagementBI.IncreaseLiqIfLess(item.Sale.Where(x => x.IsLiq).ToList(), startDate, finishDate);
|
||||
bwGo.ReportProgress(++count, "Sale Done");
|
||||
if (bwGo.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
//ManagementBI.SaveChanges();
|
||||
bwGo.ReportProgress(++count, "Cleanup done");
|
||||
}
|
||||
}
|
||||
@ -217,71 +203,68 @@ namespace Tanshu.Accounts.Management
|
||||
int count = 0;
|
||||
var info = new List<ExcelInfo>();
|
||||
var rates = new List<decimal>();
|
||||
using (var bi = new ManagementBI())
|
||||
for (var date = startDate; date <= finishDate; date = date.AddDays(1))
|
||||
{
|
||||
for (var date = startDate; date <= finishDate; date = date.AddDays(1))
|
||||
if (bwExcel.CancellationPending == true)
|
||||
{
|
||||
if (bwExcel.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwExcel.ReportProgress(++count, "Getting data for " + date.ToShortDateString());
|
||||
var currentStart = date.AddHours(7);
|
||||
var currentFinish = date.AddDays(1).AddHours(7);
|
||||
var bills = bi.GetMinMaxBills(currentStart, currentFinish);
|
||||
if (bills == null)
|
||||
continue;
|
||||
|
||||
var saleList = bi.GetSaleAndVat(currentStart, currentFinish);
|
||||
var serviceTax = bi.GetServiceTax(currentStart, currentFinish);
|
||||
|
||||
var ei = new ExcelInfo()
|
||||
{
|
||||
Date = date,
|
||||
StartBill = bi.FullBillID(bills.StartBill, VoucherType.Regular),
|
||||
FinishBill = bi.FullBillID(bills.FinishBill, VoucherType.Regular),
|
||||
SaleAndVat = new Dictionary<decimal, SaleInfo>(),
|
||||
ServiceTax = serviceTax
|
||||
};
|
||||
foreach (var item in saleList)
|
||||
{
|
||||
if (!rates.Contains(item.Rate))
|
||||
rates.Add(item.Rate);
|
||||
ei.SaleAndVat.Add(item.Rate, item);
|
||||
}
|
||||
info.Add(ei);
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwExcel.ReportProgress(++count, "Getting data for " + date.ToShortDateString());
|
||||
var currentStart = date.AddHours(7);
|
||||
var currentFinish = date.AddDays(1).AddHours(7);
|
||||
var bills = ManagementBI.GetMinMaxBills(currentStart, currentFinish);
|
||||
if (bills == null)
|
||||
continue;
|
||||
|
||||
rates.Sort();
|
||||
var saleList = ManagementBI.GetSaleAndVat(currentStart, currentFinish);
|
||||
var serviceTax = ManagementBI.GetServiceTax(currentStart, currentFinish);
|
||||
|
||||
sheet = "Date\tBill Start\tBill Final\t";
|
||||
|
||||
foreach (var item in rates)
|
||||
var ei = new ExcelInfo()
|
||||
{
|
||||
sheet += string.Format("Sale {0:#0.00}%\tVat {0:#0.00}%\t", item * 100);
|
||||
}
|
||||
sheet += "Service Tax\n";
|
||||
|
||||
foreach (var item in info)
|
||||
Date = date,
|
||||
StartBill = ManagementBI.FullBillID(bills.StartBill, Tanshu.Accounts.Entities.VoucherType.Regular),
|
||||
FinishBill = ManagementBI.FullBillID(bills.FinishBill, Tanshu.Accounts.Entities.VoucherType.Regular),
|
||||
SaleAndVat = new Dictionary<decimal, SaleInfo>(),
|
||||
ServiceTax = serviceTax
|
||||
};
|
||||
foreach (var item in saleList)
|
||||
{
|
||||
if (bwExcel.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwExcel.ReportProgress(++count, "Compiling data for " + item.Date.ToShortDateString());
|
||||
sheet += string.Format("{0:dd-MMM-yyyy}\t'{1}\t'{2}\t", item.Date, item.StartBill, item.FinishBill);
|
||||
foreach (var rate in rates)
|
||||
{
|
||||
if (item.SaleAndVat.ContainsKey(rate))
|
||||
sheet += string.Format("{0:#0}\t{1:#0}\t", Math.Round(item.SaleAndVat[rate].Net), Math.Round(item.SaleAndVat[rate].Vat));
|
||||
else
|
||||
sheet += "0\t0\t";
|
||||
}
|
||||
sheet += string.Format("{0:#0}\n", Math.Round(item.ServiceTax));
|
||||
|
||||
if (!rates.Contains(item.Rate))
|
||||
rates.Add(item.Rate);
|
||||
ei.SaleAndVat.Add(item.Rate, item);
|
||||
}
|
||||
info.Add(ei);
|
||||
}
|
||||
|
||||
rates.Sort();
|
||||
|
||||
sheet = "Date\tBill Start\tBill Final\t";
|
||||
|
||||
foreach (var item in rates)
|
||||
{
|
||||
sheet += string.Format("Sale {0:#0.00}%\tVat {0:#0.00}%\t", item * 100);
|
||||
}
|
||||
sheet += "Service Tax\n";
|
||||
|
||||
foreach (var item in info)
|
||||
{
|
||||
if (bwExcel.CancellationPending == true)
|
||||
{
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
bwExcel.ReportProgress(++count, "Compiling data for " + item.Date.ToShortDateString());
|
||||
sheet += string.Format("{0:dd-MMM-yyyy}\t'{1}\t'{2}\t", item.Date, item.StartBill, item.FinishBill);
|
||||
foreach (var rate in rates)
|
||||
{
|
||||
if (item.SaleAndVat.ContainsKey(rate))
|
||||
sheet += string.Format("{0:#0}\t{1:#0}\t", Math.Round(item.SaleAndVat[rate].Net), Math.Round(item.SaleAndVat[rate].Vat));
|
||||
else
|
||||
sheet += "0\t0\t";
|
||||
}
|
||||
sheet += string.Format("{0:#0}\n", Math.Round(item.ServiceTax));
|
||||
|
||||
}
|
||||
e.Result = sheet;
|
||||
}
|
||||
@ -437,35 +420,32 @@ namespace Tanshu.Accounts.Management
|
||||
var currentFinish = date.AddDays(1).AddHours(7);
|
||||
var voucher = string.Empty;
|
||||
var cash = 0M;
|
||||
using (var bi = new ManagementBI())
|
||||
var saleAndVat = ManagementBI.GetSaleAndVat(currentStart, currentFinish);
|
||||
foreach (var item in saleAndVat)
|
||||
{
|
||||
var saleAndVat = bi.GetSaleAndVat(currentStart, currentFinish);
|
||||
foreach (var item in saleAndVat)
|
||||
if (item.Net == 0)
|
||||
throw new ArgumentException();
|
||||
cash += Math.Round(item.Net);
|
||||
var rate = item.Rate * 100 / 1.05M;
|
||||
voucher += GetLedger(string.Format("Sale @ {0:#} %", rate), item.Net.ToString("#0.00"));
|
||||
var vat = Math.Round(item.Vat);
|
||||
if (vat != 0)
|
||||
{
|
||||
if (item.Net == 0)
|
||||
throw new ArgumentException();
|
||||
cash += Math.Round(item.Net);
|
||||
var rate = item.Rate * 100 / 1.05M;
|
||||
voucher += GetLedger(string.Format("Sale @ {0:#} %", rate), item.Net.ToString("#0.00"));
|
||||
var vat = Math.Round(item.Vat);
|
||||
if (vat != 0)
|
||||
{
|
||||
cash += vat;
|
||||
voucher += GetLedger(string.Format("Output Vat @ {0:#}%", rate), vat.ToString("#0.00"));
|
||||
}
|
||||
cash += vat;
|
||||
voucher += GetLedger(string.Format("Output Vat @ {0:#}%", rate), vat.ToString("#0.00"));
|
||||
}
|
||||
}
|
||||
|
||||
var st = Math.Round(bi.GetServiceTax(currentStart, currentFinish));
|
||||
if (st != 0)
|
||||
{
|
||||
cash += st;
|
||||
voucher += GetLedger("Central Service Tax", st.ToString("#0.00"));
|
||||
}
|
||||
var st = Math.Round(ManagementBI.GetServiceTax(currentStart, currentFinish));
|
||||
if (st != 0)
|
||||
{
|
||||
cash += st;
|
||||
voucher += GetLedger("Central Service Tax", st.ToString("#0.00"));
|
||||
}
|
||||
|
||||
if (cash != 0)
|
||||
{
|
||||
voucher = GetLedger("Cash", cash.ToString("#0.00")) + voucher;
|
||||
}
|
||||
if (cash != 0)
|
||||
{
|
||||
voucher = GetLedger("Cash", cash.ToString("#0.00")) + voucher;
|
||||
}
|
||||
return voucher != "" ? GetVoucher(date.ToString("yyyyMMdd"), voucher) : "";
|
||||
}
|
||||
@ -508,7 +488,7 @@ namespace Tanshu.Accounts.Management
|
||||
{2}
|
||||
</VOUCHER>
|
||||
";
|
||||
var servicetaxtemplate = @"";
|
||||
// var servicetaxtemplate = @"";
|
||||
#endregion
|
||||
return string.Format(template, Guid.NewGuid(), date, ledgers);
|
||||
}
|
||||
@ -570,7 +550,7 @@ namespace Tanshu.Accounts.Management
|
||||
<AMOUNT>{3}</AMOUNT>
|
||||
</ALLLEDGERENTRIES.LIST>
|
||||
";
|
||||
var servicetaxtemplate = @"";
|
||||
// var servicetaxtemplate = @"";
|
||||
#endregion
|
||||
return string.Format(template, ledgername, isDeemedPositive, isPartyLedger, amount);
|
||||
}
|
||||
@ -587,13 +567,9 @@ namespace Tanshu.Accounts.Management
|
||||
{
|
||||
var startDate = dtpStart.Value.Date.AddHours(7);
|
||||
var finishDate = dtpFinish.Value.Date.AddDays(1).AddHours(7);
|
||||
using (var bi = new ManagementBI())
|
||||
{
|
||||
bi.UpdateBillID(startDate, finishDate, bwFinalSanction);
|
||||
bi.UpdateOtherBillID(startDate, finishDate, VoucherType.NoCharge, bwFinalSanction);
|
||||
bi.UpdateOtherBillID(startDate, finishDate, VoucherType.Staff, bwFinalSanction);
|
||||
bi.SaveChanges();
|
||||
}
|
||||
ManagementBI.SetPayments(startDate, finishDate);
|
||||
ManagementBI.UpdateBillID(startDate, finishDate);
|
||||
//bi.SaveChanges();
|
||||
}
|
||||
|
||||
private void bwFinalSanction_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user