narsil/Tanshu.Accounts.PointOfSale/Masters/TaxListForm.cs
tanshu 5e64209b76 Feature: Added a Tax Management form and a beer consumption report.
Chore: Fixed some Form_Load function names as they were copied from old forms and were not neat.
Feature: Management BI Improved and should be pretty much solid by now.
2016-07-04 11:51:39 +05:30

65 lines
1.8 KiB
C#

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();
using (var bi = new TaxBI())
_list = bi.List();
bsList.DataSource = _list;
}
private void TaxListForm_Load(object sender, EventArgs e)
{
using (var bi = new TaxBI())
_list = bi.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();
using (var bi = new TaxBI())
_list = bi.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);
}
}
}