narsil/Tanshu.Accounts.PointOfSale/Reports/SaleDetail.cs
unknown d8ecec8bb6 Added inverse Attribute to ProductGroup.
BillInventory Renamed.
Refactored Bill to be more usable.
Added Bill Detail Report.
Added Open Bill and Bill Details Roles.
Zero Rate Products have Yellow background Color.
Refactored UserBI, FoodTableBI, ModifierBI, PrintLocationBI, ProductBI, ProductGroupBI, TaxBI, UserBI,
Cached the Products List.
Product and Product Group Form Working.
2011-06-23 18:17:48 +05:30

75 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Tanshu.Accounts.Repository;
using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.Helpers;
using System.Linq;
namespace Tanshu.Accounts.PointOfSale
{
public partial class FrmSaleDetail : Form
{
IList<SalesAnalysisDetail> _list;
public FrmSaleDetail()
{
InitializeComponent();
}
private void dtpStart_ValueChanged(object sender, EventArgs e)
{
ShowStatement();
}
private void ShowStatement()
{
_list = new SalesAnalysisBI().GetSaleDetail(dtpStart.Value, dtpFinish.Value).ToList();
dgvSale.AutoGenerateColumns = true;
dgvSale.DataSource = _list;
dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
dgvSale.Columns[1].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
dgvSale.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
dgvSale.Columns[2].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
dgvSale.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
}
private void dtpFinish_ValueChanged(object sender, EventArgs e)
{
ShowStatement();
}
private void Sale_Analysis_Form_Load(object sender, EventArgs e)
{
dtpStart.Value = DateTime.Today;
dtpFinish.Value = DateTime.Today;
ShowStatement();
}
private void btnPrint_Click(object sender, EventArgs e)
{
if (_list == null)
return;
var startDate = dtpStart.Value.Date.AddHours(6);
var finishDate = dtpFinish.Value.Date.AddDays(1).AddHours(5);
Print.Thermal.PrintSale(Session.User.Name, _list, startDate, finishDate);
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnExport_Click(object sender, EventArgs e)
{
if (_list == null)
return;
var data = string.Format("{0}\t{1}\t{2}\n", "Product", "Sale", "NC");
foreach (var item in _list)
{
data += string.Format("{0}\t{1}\t{2}\n", item.Product, item.Sale, item.NC);
}
Clipboard.SetText(data,TextDataFormat.Text);
}
}
}