Moved numpad control to Tanshu.Common. Billing feature complete. Delete not working as expected
Signed-off-by: unknown <tanshu@.(none)>
This commit is contained in:
98
Tanshu.Accounts.PointOfSale/Reports/SaleAnalysisForm.cs
Normal file
98
Tanshu.Accounts.PointOfSale/Reports/SaleAnalysisForm.cs
Normal file
@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class frmSaleAnalysisForm : Form
|
||||
{
|
||||
int? details = null;
|
||||
IList<SalesAnalysis> det;
|
||||
//private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public frmSaleAnalysisForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
//log.Warn(string.Format("Sales Analysis by: {0}", Session.User.Name));
|
||||
}
|
||||
|
||||
private void dtpStart_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
ShowStatement();
|
||||
}
|
||||
|
||||
private void ShowStatement()
|
||||
{
|
||||
DateTime startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value));
|
||||
DateTime finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value));
|
||||
|
||||
if (details.HasValue)
|
||||
{
|
||||
var list = new SalesAnalysisBI().GetSaleDetail(startDate, finishDate, details.Value);
|
||||
dgvSale.AutoGenerateColumns = true;
|
||||
dgvSale.DataSource = list;
|
||||
dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dgvSale.Columns[2].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
||||
dgvSale.Columns[3].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
||||
}
|
||||
else
|
||||
{
|
||||
det = new SalesAnalysisBI().GetSale(startDate, finishDate);
|
||||
dgvSale.AutoGenerateColumns = true;
|
||||
dgvSale.DataSource = det;
|
||||
dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dgvSale.Columns[0].Visible = false;
|
||||
dgvSale.Columns[2].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
||||
dgvSale.Columns[3].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
||||
}
|
||||
|
||||
|
||||
decimal freeSale = 0, voids = 0, pending = 0, net = 0, tax = 0;
|
||||
new SalesAnalysisBI().GetAdditionalInfo(ref freeSale, ref voids, ref pending, ref net, ref tax, startDate, finishDate);
|
||||
|
||||
txtVoid.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", voids);
|
||||
txtPending.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", pending);
|
||||
txtNet.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", net);
|
||||
txtTax.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", tax);
|
||||
txtGross.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", net + tax);
|
||||
}
|
||||
|
||||
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 dgvSale_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!details.HasValue)
|
||||
details = ((SalesAnalysis)dgvSale.SelectedRows[0].DataBoundItem).TypeID;
|
||||
else
|
||||
details = null;
|
||||
ShowStatement();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{ throw ex; }
|
||||
}
|
||||
|
||||
private void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (det != null)
|
||||
{
|
||||
DateTime startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value));
|
||||
DateTime finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value));
|
||||
Accounts.Print.Thermal.PrintSale(Session.User.Name, det, startDate, finishDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user