mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-19 14:37:16 +00:00
135 lines
4.8 KiB
C#
135 lines
4.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace bnhtrade.Core.Logic.Export
|
|
{
|
|
class ValidateSalesInvoice : Logic.Account.ValidateInvoice
|
|
{
|
|
//public bool IsValidInvoice(Model.Export.SetSalesInvoice invoice)
|
|
//{
|
|
// ErrorMessage = null;
|
|
|
|
// var baseInvoice = CopyInvoiceToBase(invoice);
|
|
// if (!base.IsValidInvoice(baseInvoice))
|
|
// {
|
|
// return false;
|
|
// }
|
|
|
|
// // check each match string only appears once
|
|
// var dicLookup = new Dictionary<string, string>();
|
|
// foreach (var line in invoice.InvoiceLineList)
|
|
// {
|
|
// if (dicLookup.ContainsKey(line.LineTypeMatchString))
|
|
// {
|
|
// ErrorMessage = "'Line type match string' duplication.";
|
|
// return false;
|
|
// }
|
|
// else
|
|
// {
|
|
// dicLookup.Add(line.LineTypeMatchString, null);
|
|
// }
|
|
// }
|
|
|
|
// return true;
|
|
//}
|
|
//public bool IsValidInvoiceHeader(Model.Export.SetSalesInvoice invoice)
|
|
//{
|
|
// ErrorMessage = null;
|
|
|
|
// var baseInvoice = CopyInvoiceHeaderToBase(invoice);
|
|
// if (base.IsValidInvoiceHeader(baseInvoice))
|
|
// {
|
|
// return true;
|
|
// }
|
|
// else
|
|
// {
|
|
// return false;
|
|
// }
|
|
//}
|
|
//public bool IsValidInvoiceLine(Model.Export.SetSalesInvoiceLine invoiceLine)
|
|
//{
|
|
// ErrorMessage = null;
|
|
|
|
// var baseLine = CopyInvoiceLineToBase(invoiceLine);
|
|
// if (!IsValidLineTypeMatchString(invoiceLine.LineTypeMatchString)
|
|
// || !base.IsValidInvoiceLine(baseLine))
|
|
// {
|
|
// return false;
|
|
// }
|
|
|
|
// return true;
|
|
//}
|
|
//public bool IsValidLineTypeMatchString(string matchString)
|
|
//{
|
|
// ErrorMessage = null;
|
|
// var stringCheck = new Logic.Utilities.StringCheck();
|
|
// if (!stringCheck.MaxLength(matchString, 250))
|
|
// {
|
|
// ErrorMessage = "Invalid Line Type Match String: " + stringCheck.ErrorMessage;
|
|
// return false;
|
|
// }
|
|
// return true;
|
|
//}
|
|
//private Model.Account.SalesInvoice CopyInvoiceToBase(Model.Export.SetSalesInvoice invoice)
|
|
//{
|
|
// var baseInvoice = CopyInvoiceHeaderToBase(invoice);
|
|
// if (invoice.IsSetInvoiceLineList)
|
|
// {
|
|
// var baseLineList = new List<Model.Account.SalesInvoiceLine>();
|
|
// foreach (var line in invoice.InvoiceLineList)
|
|
// {
|
|
// baseLineList.Add(CopyInvoiceLineToBase(line));
|
|
// }
|
|
// baseInvoice.InvoiceLineList = baseLineList;
|
|
// }
|
|
// return baseInvoice;
|
|
//}
|
|
|
|
//private Model.Account.SalesInvoice CopyInvoiceHeaderToBase(Model.Export.SetSalesInvoice invoice)
|
|
//{
|
|
// var baseInvoice = new Model.Account.SalesInvoice();
|
|
|
|
// if (invoice.IsSetContactName)
|
|
// { baseInvoice.ContactName = invoice.ContactName; }
|
|
// if (invoice.IsSetInvoiceAmount)
|
|
// { baseInvoice.InvoiceAmount = invoice.InvoiceAmount; }
|
|
// if (invoice.IsSetInvoiceCurrencyCode)
|
|
// { baseInvoice.InvoiceCurrencyCode = invoice.InvoiceCurrencyCode; }
|
|
// if (invoice.IsSetInvoiceDate)
|
|
// { baseInvoice.InvoiceDate = invoice.InvoiceDate; }
|
|
// if (invoice.IsSetInvoiceNumber)
|
|
// { baseInvoice.InvoiceNumber = invoice.InvoiceNumber; }
|
|
// if (invoice.IsSetInvoiceReference)
|
|
// { baseInvoice.InvoiceReference = invoice.InvoiceReference; }
|
|
// if (invoice.IsSetIsComplete)
|
|
// { baseInvoice.IsComplete = invoice.IsComplete; }
|
|
|
|
// return baseInvoice;
|
|
//}
|
|
//private Model.Account.SalesInvoiceLine CopyInvoiceLineToBase(Model.Export.SetSalesInvoiceLine invoiceLine)
|
|
//{
|
|
// var baseLine = new Model.Account.SalesInvoiceLine();
|
|
|
|
// if (invoiceLine.IsSetAccountCode)
|
|
// { baseLine.AccountCode = invoiceLine.AccountCode; }
|
|
|
|
// // something missing here ??????
|
|
|
|
// if (invoiceLine.IsSetDescription)
|
|
// { baseLine.Description = invoiceLine.Description; }
|
|
// if (invoiceLine.IsSetNetAmount)
|
|
// { baseLine.TotalNetAmount = invoiceLine.NetAmount; }
|
|
|
|
// // tax adjustment to set ??????????
|
|
|
|
// if (invoiceLine.IsSetTaxCode)
|
|
// { baseLine.TaxCode = invoiceLine.TaxCode; }
|
|
|
|
// return baseLine;
|
|
//}
|
|
}
|
|
}
|