92 lines
2.9 KiB
C#
92 lines
2.9 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.QBOI
|
|
{
|
|
public partial class SetQBImportServiceRateAccounts : Form
|
|
{
|
|
public SetQBImportServiceRateAccounts()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void SetQBImportServiceRateAccounts_Load(object sender, EventArgs e)
|
|
{
|
|
if (Util.QUSA)
|
|
{
|
|
ckTaxable.Checked = Util.QDat.ImportItemTaxable;
|
|
}
|
|
else
|
|
{
|
|
//populate tax codes combo
|
|
cbTaxCode.BindingContext = new BindingContext();//Ensure unique binding context so multiple combo boxes bound to same datasource can be selected independantly
|
|
cbTaxCode.DisplayMember = "FullName";
|
|
cbTaxCode.ValueMember = "ID";
|
|
cbTaxCode.DataSource = Util.QBTaxCodes;
|
|
cbTaxCode.SelectedIndex = 0;
|
|
|
|
if (!string.IsNullOrEmpty(Util._ImportRateToQBDefaultTaxCodeId))
|
|
cbTaxCode.SelectedValue = Util._ImportRateToQBDefaultTaxCodeId;
|
|
|
|
|
|
//Hide taxable checkbox and show tax codes combo box and title
|
|
ckTaxable.Visible = false;
|
|
lblTaxCodes.Visible = true;
|
|
cbTaxCode.Visible = true;
|
|
}
|
|
|
|
this.btnCancel.Image = Util.AyaImage("Cancel24");
|
|
this.btnOK.Image = Util.AyaImage("OK24");
|
|
this.Icon = Util.AyaIcon("Rates16icon");
|
|
|
|
//Fill combo's and select defaults
|
|
|
|
|
|
// cbIncomeAccount.BindingContext = new BindingContext();
|
|
cbIncomeAccount.DisplayMember = "FullName";
|
|
cbIncomeAccount.ValueMember = "ID";
|
|
cbIncomeAccount.DataSource = Util.QBAccounts;
|
|
if (!string.IsNullOrEmpty(Util.QDat.QBServiceIncomeAccountRef))
|
|
cbIncomeAccount.SelectedValue = Util.QDat.QBServiceIncomeAccountRef;
|
|
|
|
|
|
}
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
if (Util.QUSA)
|
|
{
|
|
Util.QDat.ImportItemTaxable = ckTaxable.Checked;
|
|
}
|
|
else
|
|
{
|
|
object o = cbTaxCode.SelectedValue;
|
|
if (o == null)
|
|
{
|
|
Util._ImportRateToQBDefaultTaxCodeId = string.Empty;
|
|
}
|
|
else
|
|
{
|
|
Util._ImportRateToQBDefaultTaxCodeId = o.ToString();
|
|
}
|
|
}
|
|
|
|
Util.QDat.QBServiceIncomeAccountRef = cbIncomeAccount.SelectedValue.ToString();
|
|
|
|
Util.SaveQBIData();
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
} |