mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-21 15:27:15 +00:00
Export amazon settlement report fix
This commit is contained in:
58
src/bnhtrade.Core/Model/Account/AccountCode.cs
Normal file
58
src/bnhtrade.Core/Model/Account/AccountCode.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Model.Account
|
||||
{
|
||||
public class AccountCode
|
||||
{
|
||||
private int? accountCodeId;
|
||||
public int AccountCodeId
|
||||
{
|
||||
get { return (int)accountCodeId; }
|
||||
set { accountCodeId = value; }
|
||||
}
|
||||
public string Title
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Description
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Type
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string BasicType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public bool IsSetAccountCodeId
|
||||
{
|
||||
get { return accountCodeId != null; }
|
||||
}
|
||||
public bool IsSetTitle
|
||||
{
|
||||
get { return Title != null; }
|
||||
}
|
||||
public bool IsSetDescription
|
||||
{
|
||||
get { return Description != null; }
|
||||
}
|
||||
public bool IsSetType
|
||||
{
|
||||
get { return Type != null; }
|
||||
}
|
||||
public bool IsSetBasicType
|
||||
{
|
||||
get { return BasicType != null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
179
src/bnhtrade.Core/Model/Account/Invoice.cs
Normal file
179
src/bnhtrade.Core/Model/Account/Invoice.cs
Normal file
@@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Model.Account
|
||||
{
|
||||
public interface IInvoice : IInvoiceHeader
|
||||
{
|
||||
List<Invoice.InvoiceLine> InvoiceLineList { get; set; }
|
||||
|
||||
bool InvoiceLineListIsSet { get; }
|
||||
}
|
||||
|
||||
public interface IInvoiceLine
|
||||
{
|
||||
string ItemCode { get; set; }
|
||||
|
||||
bool ItemCodeIsSet { get; }
|
||||
|
||||
bool DescriptionIsSet { get; }
|
||||
|
||||
string Description { get; set; }
|
||||
|
||||
int Quantity { get; set; }
|
||||
|
||||
bool QuantityIsSet { get; }
|
||||
|
||||
decimal TotalNetAmount { get; set; }
|
||||
|
||||
bool TotalNetAmountIsSet { get; }
|
||||
|
||||
bool AccountCodeIsSet { get; }
|
||||
|
||||
int AccountCode { get; set; }
|
||||
|
||||
bool TaxCodeIsSet { get; }
|
||||
|
||||
string TaxCode { get; set; }
|
||||
|
||||
decimal TaxAmountAdjust { get; set; }
|
||||
|
||||
bool TaxAmountAdjustIsSet { get; }
|
||||
|
||||
decimal TaxAmount { get; }
|
||||
|
||||
bool TaxAmountIsSet { get; }
|
||||
|
||||
decimal GrossTotalAmount { get; }
|
||||
|
||||
bool GrossTotalAmountIsSet { get; }
|
||||
}
|
||||
|
||||
|
||||
public abstract class Invoice : InvoiceHeader, IInvoice
|
||||
{
|
||||
public List<InvoiceLine> InvoiceLineList { get; set; } = new List<InvoiceLine>();
|
||||
|
||||
public bool InvoiceLineListIsSet
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InvoiceLineList == null || !InvoiceLineList.Any())
|
||||
{ return false; }
|
||||
else
|
||||
{ return true; }
|
||||
}
|
||||
}
|
||||
|
||||
public class InvoiceLine : IInvoiceLine
|
||||
{
|
||||
private int? accountCode;
|
||||
private decimal? netAmount;
|
||||
private decimal? taxAmount;
|
||||
private decimal? taxAmountAdjust;
|
||||
private int? quantity;
|
||||
private decimal? discount;
|
||||
|
||||
public string ItemCode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool ItemCodeIsSet
|
||||
{
|
||||
get { return ItemCode != null; }
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool DescriptionIsSet
|
||||
{
|
||||
get { return Description != null; }
|
||||
}
|
||||
|
||||
public int Quantity
|
||||
{
|
||||
get { return (int)quantity.GetValueOrDefault(); }
|
||||
set { quantity = value; }
|
||||
}
|
||||
|
||||
public bool QuantityIsSet
|
||||
{
|
||||
get { return quantity != null; }
|
||||
}
|
||||
|
||||
public decimal TotalNetAmount
|
||||
{
|
||||
get { return (decimal)netAmount.GetValueOrDefault(); }
|
||||
set { netAmount = value; }
|
||||
}
|
||||
|
||||
public bool TotalNetAmountIsSet
|
||||
{
|
||||
get { return netAmount != null; }
|
||||
}
|
||||
|
||||
public int AccountCode
|
||||
{
|
||||
get { return (int)accountCode.GetValueOrDefault(); }
|
||||
set { accountCode = value; }
|
||||
}
|
||||
|
||||
public bool AccountCodeIsSet
|
||||
{
|
||||
get { return accountCode != null; }
|
||||
}
|
||||
|
||||
public string TaxCode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool TaxCodeIsSet
|
||||
{
|
||||
get { return TaxCode != null; }
|
||||
}
|
||||
|
||||
public decimal TaxAmount
|
||||
{
|
||||
get { return (decimal)taxAmount.GetValueOrDefault(); }
|
||||
set { taxAmount = decimal.Round(value, 2); }
|
||||
}
|
||||
|
||||
public bool TaxAmountIsSet
|
||||
{
|
||||
get { return taxAmount != null; }
|
||||
}
|
||||
|
||||
public decimal TaxAmountAdjust
|
||||
{
|
||||
get { return (decimal)taxAmountAdjust.GetValueOrDefault(); }
|
||||
set { taxAmountAdjust = decimal.Round(value, 2); }
|
||||
}
|
||||
|
||||
public bool TaxAmountAdjustIsSet
|
||||
{
|
||||
get { return taxAmountAdjust != null; }
|
||||
}
|
||||
|
||||
public decimal GrossTotalAmount
|
||||
{
|
||||
get { return (decimal)netAmount.GetValueOrDefault() + TaxAmount; }
|
||||
}
|
||||
|
||||
public bool GrossTotalAmountIsSet
|
||||
{
|
||||
get { return (TotalNetAmountIsSet && TaxAmountIsSet); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
135
src/bnhtrade.Core/Model/Account/InvoiceHeader.cs
Normal file
135
src/bnhtrade.Core/Model/Account/InvoiceHeader.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Model.Account
|
||||
{
|
||||
public interface IInvoiceHeader
|
||||
{
|
||||
string ContactName { get; set; }
|
||||
bool ContactNameIsSet { get; }
|
||||
decimal InvoiceAmount { get; set; }
|
||||
bool InvoiceAmountIsSet { get; }
|
||||
string InvoiceCurrencyCode { get; set; }
|
||||
bool InvoiceCurrencyCodeIsSet { get; }
|
||||
DateTime InvoiceDate { get; set; }
|
||||
bool InvoiceDateIsSet { get; }
|
||||
DateTime InvoiceDueDate { get; set; }
|
||||
bool InvoiceDueDateIsSet { get; }
|
||||
DateTimeKind InvoiceDateKind { get; set; }
|
||||
bool InvoiceDateKindIsSet { get; }
|
||||
string InvoiceNumber { get; set; }
|
||||
bool InvoiceNumberIsSet { get; }
|
||||
string InvoiceReference { get; set; }
|
||||
bool InvoiceReferenceIsSet { get; }
|
||||
bool IsCreditNote { get; set; }
|
||||
bool IsCreditNoteIsSet { get; }
|
||||
}
|
||||
|
||||
public abstract class InvoiceHeader : IInvoiceHeader
|
||||
{
|
||||
private string invoiceCurrencyCode;
|
||||
private DateTime? invoiceDate;
|
||||
private DateTime? invoiceDueDate;
|
||||
private DateTimeKind? invoiceDateKind = DateTimeKind.Utc;
|
||||
private decimal? invoiceAmount;
|
||||
|
||||
public InvoiceHeader()
|
||||
{
|
||||
IsCreditNote = false;
|
||||
}
|
||||
|
||||
public string ContactName { get; set; }
|
||||
|
||||
public bool ContactNameIsSet
|
||||
{
|
||||
get { return ContactName != null; }
|
||||
}
|
||||
|
||||
public DateTime InvoiceDate
|
||||
{
|
||||
get { return (DateTime)invoiceDate.GetValueOrDefault(); }
|
||||
set { invoiceDate = value; }
|
||||
}
|
||||
|
||||
public bool InvoiceDateIsSet
|
||||
{
|
||||
get { return invoiceDate != null; }
|
||||
}
|
||||
|
||||
public DateTime InvoiceDueDate
|
||||
{
|
||||
get { return (DateTime)invoiceDueDate.GetValueOrDefault(); }
|
||||
set { invoiceDueDate = value; }
|
||||
}
|
||||
|
||||
public bool InvoiceDueDateIsSet
|
||||
{
|
||||
get { return invoiceDueDate != null; }
|
||||
}
|
||||
|
||||
public DateTimeKind InvoiceDateKind
|
||||
{
|
||||
get { return (DateTimeKind)invoiceDateKind; }
|
||||
set { invoiceDateKind = value; }
|
||||
}
|
||||
|
||||
public bool InvoiceDateKindIsSet
|
||||
{
|
||||
get { return invoiceDateKind != null; }
|
||||
}
|
||||
|
||||
public string InvoiceCurrencyCode
|
||||
{
|
||||
get { return invoiceCurrencyCode; }
|
||||
set
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
invoiceCurrencyCode = value.ToUpper();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool InvoiceCurrencyCodeIsSet
|
||||
{
|
||||
get { return InvoiceCurrencyCode != null; }
|
||||
}
|
||||
|
||||
public string InvoiceNumber { get; set; }
|
||||
|
||||
public bool InvoiceNumberIsSet
|
||||
{
|
||||
get { return InvoiceNumber != null; }
|
||||
}
|
||||
|
||||
public string InvoiceReference { get; set; }
|
||||
|
||||
public bool InvoiceReferenceIsSet
|
||||
{
|
||||
get { return InvoiceReference != null; }
|
||||
}
|
||||
|
||||
public decimal InvoiceAmount
|
||||
{
|
||||
get { return (decimal)invoiceAmount; }
|
||||
set { invoiceAmount = value; }
|
||||
}
|
||||
|
||||
public bool InvoiceAmountIsSet
|
||||
{
|
||||
get { return invoiceAmount != null; }
|
||||
}
|
||||
public bool IsCreditNote
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public bool IsCreditNoteIsSet
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
47
src/bnhtrade.Core/Model/Account/InvoiceLineItem.cs
Normal file
47
src/bnhtrade.Core/Model/Account/InvoiceLineItem.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Model.Account
|
||||
{
|
||||
public class InvoiceLineItem
|
||||
{
|
||||
public string ItemCode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Title
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Description
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public bool IsNewReviewRequired
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public bool InvoiceLineEntryEnabled
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public int DefaultAccountCode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string DefaultTaxCode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/bnhtrade.Core/Model/Account/SalesInvoice.cs
Normal file
13
src/bnhtrade.Core/Model/Account/SalesInvoice.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Model.Account
|
||||
{
|
||||
public class SalesInvoice : Invoice
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
102
src/bnhtrade.Core/Model/Account/TaxCode.cs
Normal file
102
src/bnhtrade.Core/Model/Account/TaxCode.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Model.Account
|
||||
{
|
||||
public class TaxCode
|
||||
{
|
||||
private decimal? netAmountMultiplier = null;
|
||||
private decimal? grossAmountMultiplier = null;
|
||||
private bool? isActive = null;
|
||||
private bool? isValidOnExpense = null;
|
||||
private bool? isValidOnIncome = null;
|
||||
|
||||
public string TaxCodeId { get; set; }
|
||||
public string TaxRateDescription { get; set; }
|
||||
public string TaxRateTitle { get; set; }
|
||||
public string TaxType { get; set; }
|
||||
public decimal NetAmountMultiplier
|
||||
{
|
||||
get { return (decimal)netAmountMultiplier; }
|
||||
set { netAmountMultiplier = value; }
|
||||
}
|
||||
public decimal GrossAmountMultiplier
|
||||
{
|
||||
get { return (decimal)grossAmountMultiplier; }
|
||||
set { grossAmountMultiplier = value; }
|
||||
}
|
||||
public bool IsActive
|
||||
{
|
||||
get { return (bool)isActive; }
|
||||
set { isActive = value; }
|
||||
}
|
||||
public bool IsSetAll
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsSetGrossAmountMultiplier
|
||||
&& IsSetIsActive
|
||||
&& IsSetIsValidOnExpense
|
||||
&& IsSetIsValidOnIncome
|
||||
&& IsSetNetAmountMultiplier
|
||||
&& IsSetTaxCodeId
|
||||
&& IsSetTaxRateTitle
|
||||
&& IsSetTaxRateDescription
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
}
|
||||
}
|
||||
public bool IsSetGrossAmountMultiplier
|
||||
{
|
||||
get { return grossAmountMultiplier != null; }
|
||||
}
|
||||
public bool IsSetIsActive
|
||||
{
|
||||
get { return isActive != null; }
|
||||
}
|
||||
public bool IsSetIsValidOnExpense
|
||||
{
|
||||
get { return isValidOnExpense != null; }
|
||||
}
|
||||
public bool IsSetIsValidOnIncome
|
||||
{
|
||||
get { return isValidOnIncome != null; }
|
||||
}
|
||||
public bool IsSetNetAmountMultiplier
|
||||
{
|
||||
get { return netAmountMultiplier != null; }
|
||||
}
|
||||
public bool IsSetTaxCodeId
|
||||
{
|
||||
get { return TaxCodeId != null; }
|
||||
}
|
||||
public bool IsSetTaxRateTitle
|
||||
{
|
||||
get { return TaxRateTitle != null; }
|
||||
}
|
||||
public bool IsSetTaxRateDescription
|
||||
{
|
||||
get { return TaxRateDescription != null; }
|
||||
}
|
||||
public bool IsSetTaxType
|
||||
{
|
||||
get { return TaxType != null; }
|
||||
}
|
||||
public bool IsValidOnExpense
|
||||
{
|
||||
get { return (bool)isValidOnExpense; }
|
||||
set { isValidOnExpense = value; }
|
||||
}
|
||||
public bool IsValidOnIncome
|
||||
{
|
||||
get { return (bool)isValidOnIncome; }
|
||||
set { isValidOnIncome = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user