diff --git a/src/bnhtrade.Core/Data/Database/Account/Journal.cs b/src/bnhtrade.Core/Data/Database/Account/Journal.cs
new file mode 100644
index 0000000..26a5a94
--- /dev/null
+++ b/src/bnhtrade.Core/Data/Database/Account/Journal.cs
@@ -0,0 +1,208 @@
+using FikaAmazonAPI.AmazonSpApiSDK.Models.CatalogItems;
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Runtime.InteropServices.Marshalling;
+using System.Text;
+using System.Threading.Tasks;
+using static System.ComponentModel.Design.ObjectSelectorEditor;
+
+namespace bnhtrade.Core.Data.Database.Account
+{
+ internal class Journal : Connection
+ {
+ private bnhtrade.Core.Data.Database.SqlWhereBuilder sqlBuilder;
+
+ ///
+ /// Results filter
+ ///
+ public List AccountJournalId { get; set; }
+
+ public Journal()
+ {
+ Init();
+ }
+
+ public void Init()
+ {
+ sqlBuilder = new SqlWhereBuilder();
+ AccountJournalId = new List();
+ }
+
+ ///
+ ///
+ ///
+ /// Dictionary were key is the table primary key
+ public Dictionary Read()
+ {
+ sqlBuilder.Init();
+
+ //build sql query
+ string sql = @"
+ SELECT tblAccountJournal.AccountJournalID
+ ,tblAccountJournal.AccountJournalTypeID
+ ,tblAccountJournal.EntryDate
+ ,tblAccountJournal.PostDate
+ ,tblAccountJournal.LastModified
+ ,tblAccountJournal.IsLocked
+ ,tblAccountJournalPost.AccountJournalPostID
+ ,tblAccountJournalPost.AccountChartOfID
+ ,tblAccountJournalPost.AmountGbp
+ FROM tblAccountJournal
+ INNER JOIN tblAccountJournalPost ON tblAccountJournal.AccountJournalID = tblAccountJournalPost.AccountJournalID
+ WHERE 1 = 1 ";
+
+ // build the where statments
+ if (AccountJournalId.Any())
+ {
+ sqlBuilder.In("tblAccountJournal.AccountJournalID", AccountJournalId, "AND");
+ }
+
+ // append where string to the sql
+ if (sqlBuilder.IsSetSqlWhereString)
+ {
+ sql = sql + sqlBuilder.SqlWhereString;
+ }
+
+ // build tuple list
+ var dbJournalList = new List<(
+ uint AccountJournalId
+ , uint AccountJournalTypeId
+ , DateTime EntryDate
+ , DateTime PostDate
+ , DateTime LastModified
+ , bool IsLocked
+ )>();
+
+ var dbJournalPostList = new List<(
+ uint AccountJournalId
+ , uint AccountJournalPostId
+ , uint AccountChartOfId
+ , decimal AmountGbp
+ )>();
+
+
+ bool hasRows = false;
+
+ using (SqlConnection conn = new SqlConnection(SqlConnectionString))
+ {
+ conn.Open();
+
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ sqlBuilder.AddParametersToSqlCommand(cmd);
+
+ using (SqlDataReader reader = cmd.ExecuteReader())
+ {
+ if (reader.HasRows)
+ {
+ hasRows = true;
+ uint lastJournalId = 0;
+ while (reader.Read())
+ {
+ // read journal header
+ uint journalId = (uint)reader.GetInt32(0);
+ if (journalId != lastJournalId)
+ {
+ lastJournalId = journalId;
+
+ (uint AccountJournalId
+ , uint AccountJournalTypeId
+ , DateTime EntryDate
+ , DateTime PostDate
+ , DateTime LastModified
+ , bool IsLocked
+ )
+ journal =
+ ( journalId
+ , (uint)reader.GetInt32(1)
+ , DateTime.SpecifyKind(reader.GetDateTime(2), DateTimeKind.Utc)
+ , DateTime.SpecifyKind(reader.GetDateTime(3), DateTimeKind.Utc)
+ , DateTime.SpecifyKind(reader.GetDateTime(4), DateTimeKind.Utc)
+ , reader.GetBoolean(5)
+ );
+
+ dbJournalList.Add(journal);
+ }
+
+ // read journal posts
+ (uint AccountJournalId
+ , uint AccountJournalPostId
+ , uint AccountChartOfId
+ , decimal AmountGbp
+ )
+ journalPost =
+ ( journalId
+ , (uint)reader.GetInt32(6)
+ , (uint)reader.GetInt32(7)
+ , reader.GetDecimal(8)
+ );
+
+ dbJournalPostList.Add(journalPost);
+ }
+ }
+ }
+ }
+ }
+
+ var returnList = new Dictionary();
+ if (hasRows)
+ {
+ // build lists to filter db results by
+ var journalTypeIdList = new List();
+ var accountIdList = new List();
+ foreach (var item in dbJournalList)
+ {
+ journalTypeIdList.Add(item.AccountJournalTypeId);
+ }
+ foreach (var item in dbJournalPostList)
+ {
+ accountIdList.Add(item.AccountChartOfId);
+ }
+
+ // get journalTypes from db
+ var dbJournalType = new Data.Database.Account.JournalType();
+ dbJournalType.IdList = journalTypeIdList;
+ var journalTypeDict = dbJournalType.Read();
+
+ // get accounts from db
+ var dbAccount = new Data.Database.Account.ReadAccountCode();
+ var accountDict = dbAccount.ByAccountId(accountIdList);
+
+ // build final return dictionary
+ foreach (var dbJournal in dbJournalList)
+ {
+ // build posts
+ var newPosts = new List();
+ foreach (var dbJournalPost in dbJournalPostList)
+ {
+ if (dbJournalPost.AccountJournalId == dbJournal.AccountJournalId)
+ {
+ var newPost = new Core.Model.Account.Journal.Post(
+ dbJournalPost.AccountJournalPostId
+ , accountDict[dbJournalPost.AccountChartOfId]
+ , dbJournalPost.AmountGbp);
+
+ newPosts.Add(newPost);
+ }
+ }
+
+ // create the journal
+ var newJournal = new Core.Model.Account.Journal(
+ dbJournal.AccountJournalId
+ , journalTypeDict[dbJournal.AccountJournalTypeId]
+ , newPosts
+ , dbJournal.EntryDate
+ , dbJournal.PostDate
+ , dbJournal.LastModified
+ , dbJournal.IsLocked);
+
+ returnList.Add(dbJournal.AccountJournalId, newJournal);
+ }
+ }
+ // all done, return the list herevar
+ return returnList;
+ }
+ }
+}
diff --git a/src/bnhtrade.Core/Data/Database/Account/JournalType.cs b/src/bnhtrade.Core/Data/Database/Account/JournalType.cs
new file mode 100644
index 0000000..a39ad80
--- /dev/null
+++ b/src/bnhtrade.Core/Data/Database/Account/JournalType.cs
@@ -0,0 +1,144 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace bnhtrade.Core.Data.Database.Account
+{
+ internal class JournalType : Connection
+ {
+ private bnhtrade.Core.Data.Database.SqlWhereBuilder sqlBuilder;
+
+ ///
+ /// Results filter
+ ///
+ public List IdList { get; set; }
+
+ ///
+ /// Searches for the specificed phases within the item description. Uses the LIKE AND sql function
+ ///
+ public List TitleList { get; set; }
+
+ public JournalType()
+ {
+ Init();
+ }
+
+ public void Init()
+ {
+ sqlBuilder = new SqlWhereBuilder();
+ IdList = new List();
+ TitleList = new List();
+ }
+
+ ///
+ ///
+ ///
+ /// Dictionary where key is the table primary key
+ public Dictionary Read()
+ {
+ // create the return (emptyP list) here
+ var returnList = new Dictionary();
+ sqlBuilder.Init();
+
+ //build sql query
+ string sql = @"
+ SELECT [AccountJournalTypeID]
+ ,[TypeTitle]
+ ,[ChartOfAccountID_Debit]
+ ,[ChartOfAccountID_Credit]
+ FROM [e2A].[dbo].[tblAccountJournalType]
+ WHERE 1 = 1 ";
+
+ // build the where statments
+ if (IdList.Any())
+ {
+ sqlBuilder.In("AccountJournalTypeID", IdList, "AND");
+ }
+ if (TitleList.Any())
+ {
+ sqlBuilder.In("TypeTitle", TitleList, "AND");
+ }
+
+ // append where string to the sql
+ if (sqlBuilder.IsSetSqlWhereString)
+ {
+ sql = sql + sqlBuilder.SqlWhereString;
+ }
+
+ // create dictionary to add credit/debit accounts on after db read
+ var creditDict = new Dictionary();
+ var debitDict = new Dictionary();
+
+ using (SqlConnection conn = new SqlConnection(SqlConnectionString))
+ {
+ conn.Open();
+
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ sqlBuilder.AddParametersToSqlCommand(cmd);
+
+ using (SqlDataReader reader = cmd.ExecuteReader())
+ {
+ if (reader.HasRows)
+ {
+ while (reader.Read())
+ {
+ // read from db and create object
+ uint journalTypeId = (uint)reader.GetInt32(0);
+ string title = reader.GetString(1);
+ int? debitAccountId = null;
+ if (!reader.IsDBNull(2)) { debitAccountId = reader.GetInt32(2); }
+ int? creditAccountId = null;
+ if (!reader.IsDBNull(3)) { creditAccountId = reader.GetInt32(3); }
+
+ // build return list
+ var item = new Model.Account.JournalType(journalTypeId, title);
+ returnList.Add(journalTypeId, item);
+
+ // build dictionaries
+ if (debitAccountId != null)
+ {
+ debitDict.Add(journalTypeId, (uint)debitAccountId);
+ }
+ if (creditAccountId != null)
+ {
+ creditDict.Add(journalTypeId, (uint)creditAccountId);
+ }
+ }
+ }
+ }
+ }
+ }
+ // get account objects from db
+ var accountIdList = debitDict.Values.ToList();
+ accountIdList.AddRange(creditDict.Values.ToList());
+ var dbaccount = new Data.Database.Account.ReadAccountCode();
+ var dbDict = dbaccount.ByAccountId(accountIdList);
+
+ // add to the returnlist
+ foreach (var account in returnList.Values)
+ {
+ Model.Account.Account debitAccount = null;
+ if (debitDict.ContainsKey(account.JournalTypeId))
+ {
+ debitAccount = dbDict[debitDict[account.JournalTypeId]];
+ }
+
+ Model.Account.Account creditAccount = null;
+ if (creditDict.ContainsKey(account.JournalTypeId))
+ {
+ creditAccount = dbDict[creditDict[account.JournalTypeId]]; // key of 59 needed
+ }
+
+ account.AddDefaultAccounts(creditAccount, debitAccount);
+ }
+
+ // all done, return the list here
+ return returnList;
+ }
+ }
+}
+
diff --git a/src/bnhtrade.Core/Data/Database/Account/ReadAccountCode.cs b/src/bnhtrade.Core/Data/Database/Account/ReadAccountCode.cs
index 814d552..ba238a7 100644
--- a/src/bnhtrade.Core/Data/Database/Account/ReadAccountCode.cs
+++ b/src/bnhtrade.Core/Data/Database/Account/ReadAccountCode.cs
@@ -10,7 +10,6 @@ namespace bnhtrade.Core.Data.Database.Account
public class ReadAccountCode : Connection
{
private Data.Database.SqlWhereBuilder sqlWhere = new SqlWhereBuilder();
- private List resultList;
public ReadAccountCode()
{
@@ -27,26 +26,45 @@ namespace bnhtrade.Core.Data.Database.Account
var dictionary = new Dictionary();
foreach (var item in list)
{
- dictionary.Add(item.Id, item);
+ dictionary.Add(item.Value.Id, item.Value);
}
return dictionary;
}
- public List ByAccountCode(List accountCodeList)
+ public Dictionary ByAccountId(List accountIdList)
{
Innit();
+ var resultDict = new Dictionary();
+
+ if (accountIdList == null || !accountIdList.Any())
+ {
+ return resultDict;
+ }
+
+ sqlWhere.In("tblAccountChartOf.AccountChartOfID", accountIdList, " WHERE ");
+ resultDict = Execute(sqlWhere.SqlWhereString, sqlWhere.ParameterList);
+ return resultDict;
+ }
+
+ public Dictionary ByAccountCode(List accountCodeList)
+ {
+ Innit();
+ var resultDict = new Dictionary();
if (accountCodeList == null || !accountCodeList.Any())
{
- return resultList;
+ return resultDict;
}
sqlWhere.In("tblAccountChartOf.AccountCode", accountCodeList, " WHERE ");
- return Execute(sqlWhere.SqlWhereString, sqlWhere.ParameterList);
+ resultDict = Execute(sqlWhere.SqlWhereString, sqlWhere.ParameterList);
+ return resultDict;
}
- private List Execute(string sqlWhere, Dictionary parameters)
+ private Dictionary Execute(string sqlWhere, Dictionary parameters)
{
+ var resultDict = new Dictionary();
+
//build sql query
string sqlString = @"
SELECT tblAccountChartOf.AccountChartOfID
@@ -91,18 +109,18 @@ namespace bnhtrade.Core.Data.Database.Account
int multiplier = reader.GetInt32(6);
var result = new Model.Account.Account(tablePk, accountCode, title, description, type, basicType, multiplier);
- resultList.Add(result);
+ resultDict.Add(tablePk, result);
}
}
- return resultList;
}
}
}
+ return resultDict;
}
private void Innit()
{
- resultList = new List();
+ sqlWhere.Init();
}
}
}
diff --git a/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs b/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs
index c75213c..812e4a7 100644
--- a/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs
+++ b/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs
@@ -209,5 +209,26 @@ namespace bnhtrade.Core.Data.Database
In(columnReference, stringList, wherePrefix);
}
+
+ ///
+ /// Append an 'In' statement and parameter list to the class properties
+ ///
+ /// Name of the column to used to for the condition statement
+ /// List of values to test in condition statement
+ /// Optional prefix that gets added to the sql string result
+ public void In(string columnReference, List orValueList, string wherePrefix = null)
+ {
+ var stringList = new List();
+
+ if (orValueList != null || !orValueList.Any())
+ {
+ foreach (uint value in orValueList)
+ {
+ stringList.Add(value.ToString());
+ }
+ }
+
+ In(columnReference, stringList, wherePrefix);
+ }
}
}
diff --git a/src/bnhtrade.Core/Logic/Account/GetAccountCodeInfo.cs b/src/bnhtrade.Core/Logic/Account/GetAccountCodeInfo.cs
index 9e08fac..d2019f4 100644
--- a/src/bnhtrade.Core/Logic/Account/GetAccountCodeInfo.cs
+++ b/src/bnhtrade.Core/Logic/Account/GetAccountCodeInfo.cs
@@ -35,7 +35,7 @@ namespace bnhtrade.Core.Logic.Account
public List ByAccountCode(List accountCodeList)
{
- return readAccountCode.ByAccountCode(accountCodeList);
+ return readAccountCode.ByAccountCode(accountCodeList).Values.ToList();
}
public Dictionary ConvertToDictionary(List accountCodeList)
diff --git a/src/bnhtrade.Core/Model/Account/Journal.cs b/src/bnhtrade.Core/Model/Account/Journal.cs
new file mode 100644
index 0000000..3ddbdb2
--- /dev/null
+++ b/src/bnhtrade.Core/Model/Account/Journal.cs
@@ -0,0 +1,65 @@
+using Microsoft.VisualBasic;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace bnhtrade.Core.Model.Account
+{
+ public class Journal : IValidatableObject
+ {
+ internal Journal(uint journalId, Core.Model.Account.JournalType type, List posts, DateTime entryDate, DateTime postDate, DateTime lastModifed, bool isLocked)
+ {
+ JournalId = journalId;
+ Type = type;
+ Posts = posts;
+ EntryDate = entryDate;
+ PostDate = postDate;
+ LastModified = lastModifed;
+ IsLocked = isLocked;
+ }
+
+ public uint JournalId { get; private set; }
+ public Core.Model.Account.JournalType Type { get; private set; }
+ public List Posts { get; private set; } = new List();
+ public DateTime EntryDate { get; private set; }
+ public DateTime PostDate { get; private set; }
+ public DateTime LastModified { get;private set; }
+ public bool IsLocked { get; private set; }
+
+ public class Post
+ {
+ internal Post(uint postId, Core.Model.Account.Account account, decimal amountGbp)
+ {
+ PostId = postId;
+ Account = account;
+ AmountGbp = amountGbp;
+ }
+
+ public uint PostId { get; private set; }
+ public Core.Model.Account.Account Account { get; private set; }
+ public decimal AmountGbp { get; private set; }
+ }
+
+ public IEnumerable Validate(ValidationContext validationContext)
+ {
+ var result = new List();
+
+ // get total of posts
+ decimal postTotal = 0;
+ foreach (var post in Posts)
+ {
+ postTotal = postTotal + post.AmountGbp;
+ }
+ if (postTotal != 0)
+ {
+ result.Add(new ValidationResult("Account journal posts do not equal zero"));
+ }
+
+ throw new NotImplementedException();
+ return result;
+ }
+ }
+}
diff --git a/src/bnhtrade.Core/Model/Account/JournalType.cs b/src/bnhtrade.Core/Model/Account/JournalType.cs
new file mode 100644
index 0000000..e31c717
--- /dev/null
+++ b/src/bnhtrade.Core/Model/Account/JournalType.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace bnhtrade.Core.Model.Account
+{
+ public class JournalType
+ {
+ internal JournalType(uint journalTypeId, string title, Model.Account.Account defaultCreditAccount = null, Model.Account.Account defaultDebitAccount = null)
+ {
+ JournalTypeId = journalTypeId;
+ Title = title;
+ DefaultCreditAccount = defaultCreditAccount;
+ DefaultDebitAccount = defaultDebitAccount;
+ }
+
+ internal void AddDefaultAccounts(Model.Account.Account defaultCreditAccount = null, Model.Account.Account defaultDebitAccount = null)
+ {
+ DefaultCreditAccount = defaultCreditAccount;
+ DefaultDebitAccount = defaultDebitAccount;
+ }
+
+ public uint JournalTypeId { get ; private set; }
+
+ public string Title { get; private set; }
+
+ public Model.Account.Account DefaultDebitAccount { get; private set; }
+
+ public bool IsSetDefaultDebitAccount
+ {
+ get { return DefaultDebitAccount != null; }
+ }
+
+ public Model.Account.Account DefaultCreditAccount { get; private set; }
+
+ public bool IsSetDefaultCreditAccount
+ {
+ get { return DefaultCreditAccount != null; }
+ }
+ }
+}
diff --git a/src/bnhtrade.Core/Program.cs b/src/bnhtrade.Core/Program.cs
index d3549e3..41d77ea 100644
--- a/src/bnhtrade.Core/Program.cs
+++ b/src/bnhtrade.Core/Program.cs
@@ -233,6 +233,7 @@ namespace bnhtrade.Core
{
public class AccountQuery
{
+ // externally called & internal
public static decimal CurrencyConvertToGbp(string sqlConnectionString, string currencyCode, decimal amount, DateTime conversionDate)
{
if (currencyCode == "GBP" || amount == 0M)
@@ -288,6 +289,7 @@ namespace bnhtrade.Core
}
}
+ // externally called
public static int CurrencyExchangeRateInsert(string sqlConnectionString, int exchangeRateSource, string currencyCode,
decimal currencyUnitsPerGbp, DateTime periodStart, DateTime periodEnd, bool checkOverride = false)
{
@@ -420,6 +422,7 @@ namespace bnhtrade.Core
}
}
+ // internally called
public static bool AccountJournalEntryIsLocked(string sqlConnectionString, int journalId)
{
using (SqlConnection conn = new SqlConnection(sqlConnectionString))
@@ -449,6 +452,7 @@ namespace bnhtrade.Core
}
}
+ // externally called
public static int AccountJournalInsert(string sqlConnectionString, int journalTypeId, DateTime entryDate, string currencyCode,
decimal amount, int debitAccountId = 0, int creditAccountId = 0, bool lockEntry = false)
{
@@ -492,6 +496,7 @@ namespace bnhtrade.Core
}
}
+ // externally called
// return false on locked journal entry
public static bool AccountJournalDelete(string sqlConnectionString, int accountJournalId)
{
@@ -540,6 +545,7 @@ namespace bnhtrade.Core
}
}
+ // internally called
private static bool AccountJournalPostInsert(string sqlConnectionString, int journalId, DateTime entryDate,
string currencyCode, decimal amount, int debitAccountId = 0, int creditAccountId = 0)
{
@@ -685,6 +691,7 @@ namespace bnhtrade.Core
}
}
+ // externally called
public static bool AccountJournalPostUpdate(string sqlConnectionString, int journalId, string currencyCode, decimal amount,
int debitAccountId = 0, int creditAccountId = 0)
{
diff --git a/src/bnhtrade.Core/Test/Account/Account.cs b/src/bnhtrade.Core/Test/Account/Account.cs
index b1a2459..10d15cc 100644
--- a/src/bnhtrade.Core/Test/Account/Account.cs
+++ b/src/bnhtrade.Core/Test/Account/Account.cs
@@ -11,7 +11,7 @@ namespace bnhtrade.Core.Test.Account
{
public Account()
{
- PurchaseInvoiceLine();
+ Journal();
}
public void PurchaseInvoice()
@@ -27,5 +27,12 @@ namespace bnhtrade.Core.Test.Account
read.ItemDescription = new List { "xbox", "kill" };
var result = read.Read();
}
+
+ public void Journal()
+ {
+ var read = new Data.Database.Account.Journal();
+ read.AccountJournalId = new List { 123, 300, 324, 5678, 22 };
+ var result = read.Read();
+ }
}
}
diff --git a/src/bnhtrade.Core/Test/_BoilerPlate/sql_Read.cs b/src/bnhtrade.Core/Test/_BoilerPlate/sql_Read.cs
new file mode 100644
index 0000000..7121986
--- /dev/null
+++ b/src/bnhtrade.Core/Test/_BoilerPlate/sql_Read.cs
@@ -0,0 +1,94 @@
+using bnhtrade.Core.Data.Database;
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace bnhtrade.Core.Test._BoilerPlate
+{
+ internal class xxxxxxxYourClassNameHerexxxxxxxx : Connection
+ {
+ private bnhtrade.Core.Data.Database.SqlWhereBuilder sqlBuilder;
+
+ ///
+ /// Results filter
+ ///
+ public List ColumnTitle1List { get; set; }
+
+ ///
+ /// Searches for the specificed phases within the item description. Uses the LIKE AND sql function
+ ///
+ public List ColumnTitle2List { get; set; }
+
+ public xxxxxxxYourClassNameHerexxxxxxxx()
+ {
+ Init();
+ }
+
+ public void Init()
+ {
+ sqlBuilder = new SqlWhereBuilder();
+ ColumnTitle1List = new List();
+ ColumnTitle2List = new List();
+ }
+
+ ///
+ ///
+ ///
+ /// Dictionary were key is the table primary key
+ public Dictionary Read()
+ {
+ // create the return (emptyP list) here
+ var returnList = new Dictionary();
+ sqlBuilder.Init();
+
+ //build sql query
+ string sql = @"
+ SELECT item1, item2, item3
+ FROM tblPurchaseLine
+ WHERE 1 = 1 ";
+
+ // build the where statments
+ if (ColumnTitle1List.Any())
+ {
+ sqlBuilder.In("xxxxxxxxxxxxxxColumnTitle1xxxxxxxxxxxxxxxxxx", ColumnTitle1List, "AND");
+ }
+ if (ColumnTitle2List.Any())
+ {
+ sqlBuilder.In("xxxxxxxxxxxxxxColumnTitle2xxxxxxxxxxxxxxxxxx", ColumnTitle2List, "AND");
+ }
+
+ // append where string to the sql
+ if (sqlBuilder.IsSetSqlWhereString)
+ {
+ sql = sql + sqlBuilder.SqlWhereString;
+ }
+
+ using (SqlConnection conn = new SqlConnection(SqlConnectionString))
+ {
+ conn.Open();
+
+ using (SqlCommand cmd = new SqlCommand(sql, conn))
+ {
+ sqlBuilder.AddParametersToSqlCommand(cmd);
+
+ using (SqlDataReader reader = cmd.ExecuteReader())
+ {
+ if (reader.HasRows)
+ {
+ while (reader.Read())
+ {
+ // read from db and create object
+ // and add to return list
+ }
+ }
+ }
+ }
+ }
+ // all done, return the list here
+ return returnList;
+ }
+ }
+}
diff --git a/src/bnhtrade.gui/Forms/Account/PurchaseInvoice.Designer.cs b/src/bnhtrade.gui/Forms/Account/PurchaseInvoice.Designer.cs
index f307d5e..987f6a2 100644
--- a/src/bnhtrade.gui/Forms/Account/PurchaseInvoice.Designer.cs
+++ b/src/bnhtrade.gui/Forms/Account/PurchaseInvoice.Designer.cs
@@ -294,7 +294,7 @@
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.RowTemplate.Height = 30;
- dataGridView1.Size = new Size(1042, 264);
+ dataGridView1.Size = new Size(1042, 280);
dataGridView1.TabIndex = 25;
//
// itemDescriptionDataGridViewTextBoxColumn
@@ -400,10 +400,10 @@
//
tabControl1.Controls.Add(tabPageAccountTransactions);
tabControl1.Controls.Add(tabPageNotes);
- tabControl1.Location = new Point(16, 541);
+ tabControl1.Location = new Point(16, 561);
tabControl1.Name = "tabControl1";
tabControl1.SelectedIndex = 0;
- tabControl1.Size = new Size(1042, 197);
+ tabControl1.Size = new Size(1042, 232);
tabControl1.TabIndex = 27;
//
// tabPageAccountTransactions
@@ -411,7 +411,7 @@
tabPageAccountTransactions.Location = new Point(4, 24);
tabPageAccountTransactions.Name = "tabPageAccountTransactions";
tabPageAccountTransactions.Padding = new Padding(3);
- tabPageAccountTransactions.Size = new Size(1034, 169);
+ tabPageAccountTransactions.Size = new Size(1034, 204);
tabPageAccountTransactions.TabIndex = 0;
tabPageAccountTransactions.Text = "Account Transactions";
tabPageAccountTransactions.UseVisualStyleBackColor = true;
@@ -430,7 +430,7 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(1070, 750);
+ ClientSize = new Size(1070, 805);
Controls.Add(tabControl1);
Controls.Add(textBoxOrderChannel);
Controls.Add(dataGridView1);
diff --git a/src/bnhtrade.gui/Forms/Account/PurchaseInvoice.resx b/src/bnhtrade.gui/Forms/Account/PurchaseInvoice.resx
index 371a720..856c4dd 100644
--- a/src/bnhtrade.gui/Forms/Account/PurchaseInvoice.resx
+++ b/src/bnhtrade.gui/Forms/Account/PurchaseInvoice.resx
@@ -123,6 +123,9 @@
149, 21
+
+ 149, 21
+
True