Fix amazon settlement period and other updates

This commit is contained in:
2020-02-11 17:20:45 +00:00
committed by GitHub
parent 7e50da21e7
commit 56647c7648
10 changed files with 128 additions and 46 deletions

View File

@@ -8,21 +8,27 @@ using System.Transactions;
namespace bnhtrade.Core.Logic.Export
{
public class AmazonSettlementData
public class AmazonSettlement
{
private string sqlConnectionString;
private Dictionary<string, Model.Account.TaxCode> taxCodeBySkuNumer;
public AmazonSettlementData(string sqlConnectionString)
public AmazonSettlement(string sqlConnectionString)
{
this.sqlConnectionString = sqlConnectionString;
}
public void ToInvoice()
{
var console = new UI.Console.Update();
var log = new Logic.Log.LogEvent();
log.LogInformation("Starting processing of Amazon settlement data into export invoice table...");
// check settlement reports consistancy
var consistencyCheck = new Data.Database.Consistency.ImportAmazonSettlement(sqlConnectionString).PeriodDateGaps();
if (consistencyCheck == false )
{ return; }
// get list of unprocssed settlement reports to export
var settlementData = new Data.Database.Import.ReadAmazonSettlement(sqlConnectionString);
var settlementList = settlementData.AllUnprocessed();
@@ -234,12 +240,13 @@ namespace bnhtrade.Core.Logic.Export
}
catch (Exception ex)
{
scope.Dispose();
log.LogError(ex.Message);
return;
}
}
Console.Write("\r");
log.LogInformation("Finished processing of Amazon settlement data. " + invoiceList.Count() + " invoices created from "+ settlementIdList.Count() + " Amazon settlement reports.");
log.LogInformation("\rFinished processing of Amazon settlement data. " + invoiceList.Count() + " invoices created from "+ settlementIdList.Count() + " Amazon settlement reports.");
}
private string BuildLineItemCode(string skuNumber, string transactionType, string amountType, string amountDescription)