narsil/Tanshu.Accounts.PointOfSale/Masters/TaxListForm.cs

62 lines
1.6 KiB
C#
Raw Permalink Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.Repository;
namespace Tanshu.Accounts.PointOfSale
{
public partial class TaxListForm : Form
{
private IList<Tax> _list;
public TaxListForm()
{
InitializeComponent();
}
private void btnAdd_Click(object sender, EventArgs e)
{
using (var frm = new TaxEditForm())
frm.ShowDialog();
2018-08-24 10:41:33 +00:00
_list = TaxBI.List();
bsList.DataSource = _list;
}
private void TaxListForm_Load(object sender, EventArgs e)
{
2018-08-24 10:41:33 +00:00
_list = TaxBI.List();
bsList.DataSource = _list;
}
private void btnEdit_Click(object sender, EventArgs e)
{
var id = ((Tax)bsList.Current).TaxID;
using (var frm = new TaxEditForm(id))
frm.ShowDialog();
2018-08-24 10:41:33 +00:00
_list = TaxBI.List();
bsList.DataSource = _list;
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void dgvTaxes_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
var data = dgvTaxes.Rows[e.RowIndex].DataBoundItem as Tax;
if (data == null)
return;
if (e.ColumnIndex != 1)
return;
var rate = (decimal)e.Value;
e.Value = string.Format("{0:P}", rate);
}
}
}