Files
ayanova7/source/Plugins/AyaNova.Plugin.QBI/SetQBImportInventoryAccounts.cs
2018-06-29 19:47:36 +00:00

62 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AyaNova.PlugIn.QBI
{
public partial class SetQBImportInventoryAccounts : Form
{
public SetQBImportInventoryAccounts()
{
InitializeComponent();
}
private void SetQBImportInventoryAccounts_Load(object sender, EventArgs e)
{
this.btnCancel.Image = Util.AyaImage("Cancel24");
this.btnOK.Image = Util.AyaImage("OK24");
this.Icon = Util.AyaIcon("Part16icon");
//Fill combo's and select defaults
cbAsset.BindingContext = new BindingContext();//Ensure unique binding context so multiple combo boxes bound to same datasource can be selected independantly
cbAsset.DisplayMember = "FullName";
cbAsset.ValueMember = "ID";
cbAsset.DataSource = Util.QBAccounts;
if (!string.IsNullOrEmpty(Util.QDat.QBInventoryAssetAccountRef))
cbAsset.SelectedValue = Util.QDat.QBInventoryAssetAccountRef;
cbCogs.BindingContext = new BindingContext();
cbCogs.DisplayMember = "FullName";
cbCogs.ValueMember = "ID";
cbCogs.DataSource = Util.QBAccounts;
if (!string.IsNullOrEmpty(Util.QDat.QBInventoryCOGSAccountRef))
cbCogs.SelectedValue = Util.QDat.QBInventoryCOGSAccountRef;
cbIncome.BindingContext = new BindingContext();
cbIncome.DisplayMember = "FullName";
cbIncome.ValueMember = "ID";
cbIncome.DataSource = Util.QBAccounts;
if (!string.IsNullOrEmpty(Util.QDat.QBInventoryIncomeAccountReference))
cbIncome.SelectedValue = Util.QDat.QBInventoryIncomeAccountReference;
}
private void btnOK_Click(object sender, EventArgs e)
{
Util.QDat.QBInventoryAssetAccountRef=cbAsset.SelectedValue.ToString();
Util.QDat.QBInventoryCOGSAccountRef = cbCogs.SelectedValue.ToString();
Util.QDat.QBInventoryIncomeAccountReference = cbIncome.SelectedValue.ToString();
Util.SaveQBIData();
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}