Added Basecode to Product
Added Voucher Type During Printing Added Discount Report Fixed Void bill table not getting cleared error Added PAX to table Removed Itital Setup button in MainForm as it was not doing anything
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
@ -8,69 +9,108 @@ namespace Tanshu.Accounts.Management
|
||||
{
|
||||
public partial class QuantityForm : Form
|
||||
{
|
||||
IList<BillDetail> _list;
|
||||
//private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public QuantityForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
//log.Warn(string.Format("Sales Analysis by: {0}", Session.User.Name));
|
||||
}
|
||||
|
||||
private void dtpStart_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
ShowStatement();
|
||||
}
|
||||
|
||||
private void ShowStatement()
|
||||
{
|
||||
_list = new SalesAnalysisBI().GetBillDetails(dtpStart.Value, dtpFinish.Value);
|
||||
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;
|
||||
}
|
||||
|
||||
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 btnGo_Click(object sender, EventArgs e)
|
||||
{
|
||||
string type = null;
|
||||
int baseCode = 0;
|
||||
if (rbLight.Checked)
|
||||
{
|
||||
type = "Light";
|
||||
baseCode = 1;
|
||||
}
|
||||
else if (rbPremium.Checked)
|
||||
{
|
||||
type = "Premium";
|
||||
baseCode = 2;
|
||||
}
|
||||
else if (rbWheat.Checked)
|
||||
{
|
||||
type = "Wheat";
|
||||
baseCode = 3;
|
||||
}
|
||||
else if (rbDark.Checked)
|
||||
{
|
||||
type = "Dark";
|
||||
baseCode = 4;
|
||||
}
|
||||
else if (rbFestival.Checked)
|
||||
{
|
||||
type = "Festival";
|
||||
baseCode = 5;
|
||||
}
|
||||
dtpStart.Value = dtpStart.Value.Date.AddHours(7);
|
||||
dtpFinish.Value = dtpFinish.Value.Date.AddDays(1).AddHours(7);
|
||||
var quantity = GetQuantity(baseCode);
|
||||
var newQuantity = Convert.ToDecimal(txtQuantity.Text);
|
||||
if (MessageBox.Show(quantity.ToString(), "Quantity of Beer", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes && quantity > newQuantity)
|
||||
{
|
||||
MessageBox.Show(SetQuantity(baseCode, newQuantity).ToString());
|
||||
}
|
||||
MessageBox.Show(GetQuantity(type).ToString());
|
||||
}
|
||||
private decimal GetQuantity(string type)
|
||||
private decimal GetQuantity(int baseCode)
|
||||
{
|
||||
""
|
||||
using (var bi = new ManagementBI())
|
||||
return bi.GetQuantity(baseCode, dtpStart.Value, dtpFinish.Value);
|
||||
}
|
||||
private decimal SetQuantity(int baseCode, decimal quantity)
|
||||
{
|
||||
using (var bi = new ManagementBI())
|
||||
return bi.SetQuantity(baseCode, quantity, dtpStart.Value, dtpFinish.Value);
|
||||
}
|
||||
|
||||
private void btnGetClipboard_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Clipboard format -- Date,BaseCode,Quantity"
|
||||
var fmtCsv = DataFormats.CommaSeparatedValue;
|
||||
|
||||
// read the CSV
|
||||
var dataobject = Clipboard.GetDataObject();
|
||||
if (dataobject == null)
|
||||
{
|
||||
MessageBox.Show(@"No Data in clipboard");
|
||||
return;
|
||||
}
|
||||
var stream = (System.IO.Stream)dataobject.GetData(fmtCsv);
|
||||
var enc = new System.Text.UTF8Encoding();
|
||||
|
||||
IFormatProvider culture = new CultureInfo("en-US", true);
|
||||
|
||||
using (var reader = new System.IO.StreamReader(stream, enc))
|
||||
{
|
||||
using (var bi = new ManagementBI())
|
||||
{
|
||||
string line;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
DateTime startDate;
|
||||
int baseCode;
|
||||
decimal quantity;
|
||||
var data = line.Split(',');
|
||||
if (!DateTime.TryParseExact(data[0], "dd-MMM-yyyy", culture, DateTimeStyles.NoCurrentDateDefault, out startDate))
|
||||
continue;
|
||||
var finishDate = startDate.AddDays(1).AddHours(7);
|
||||
startDate = startDate.AddHours(7);
|
||||
if (!int.TryParse(data[1], out baseCode))
|
||||
continue;
|
||||
if (baseCode <=0)
|
||||
continue;
|
||||
if (!decimal.TryParse(data[2], out quantity))
|
||||
continue;
|
||||
|
||||
bi.SetQuantity(baseCode, quantity, startDate, finishDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
this.rbFestival = new System.Windows.Forms.RadioButton();
|
||||
this.txtQuantity = new System.Windows.Forms.TextBox();
|
||||
this.btnGo = new System.Windows.Forms.Button();
|
||||
this.btnGetClipboard = new System.Windows.Forms.Button();
|
||||
this.flpProducts.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -50,7 +51,6 @@
|
||||
this.dtpFinish.Name = "dtpFinish";
|
||||
this.dtpFinish.Size = new System.Drawing.Size(90, 20);
|
||||
this.dtpFinish.TabIndex = 21;
|
||||
this.dtpFinish.ValueChanged += new System.EventHandler(this.dtpFinish_ValueChanged);
|
||||
//
|
||||
// dtpStart
|
||||
//
|
||||
@ -60,7 +60,6 @@
|
||||
this.dtpStart.Name = "dtpStart";
|
||||
this.dtpStart.Size = new System.Drawing.Size(90, 20);
|
||||
this.dtpStart.TabIndex = 20;
|
||||
this.dtpStart.ValueChanged += new System.EventHandler(this.dtpStart_ValueChanged);
|
||||
//
|
||||
// label10
|
||||
//
|
||||
@ -152,17 +151,28 @@
|
||||
//
|
||||
this.btnGo.Location = new System.Drawing.Point(12, 207);
|
||||
this.btnGo.Name = "btnGo";
|
||||
this.btnGo.Size = new System.Drawing.Size(335, 23);
|
||||
this.btnGo.Size = new System.Drawing.Size(150, 23);
|
||||
this.btnGo.TabIndex = 24;
|
||||
this.btnGo.Text = "Go";
|
||||
this.btnGo.UseVisualStyleBackColor = true;
|
||||
this.btnGo.Click += new System.EventHandler(this.btnGo_Click);
|
||||
//
|
||||
// btnGetClipboard
|
||||
//
|
||||
this.btnGetClipboard.Location = new System.Drawing.Point(168, 207);
|
||||
this.btnGetClipboard.Name = "btnGetClipboard";
|
||||
this.btnGetClipboard.Size = new System.Drawing.Size(179, 23);
|
||||
this.btnGetClipboard.TabIndex = 25;
|
||||
this.btnGetClipboard.Text = "Go Clipboard";
|
||||
this.btnGetClipboard.UseVisualStyleBackColor = true;
|
||||
this.btnGetClipboard.Click += new System.EventHandler(this.btnGetClipboard_Click);
|
||||
//
|
||||
// QuantityForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(359, 242);
|
||||
this.Controls.Add(this.btnGetClipboard);
|
||||
this.Controls.Add(this.btnGo);
|
||||
this.Controls.Add(this.flpProducts);
|
||||
this.Controls.Add(this.dtpFinish);
|
||||
@ -194,5 +204,6 @@
|
||||
private System.Windows.Forms.RadioButton rbFestival;
|
||||
private System.Windows.Forms.TextBox txtQuantity;
|
||||
private System.Windows.Forms.Button btnGo;
|
||||
private System.Windows.Forms.Button btnGetClipboard;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user