narsil/Tanshu.Accounts.PointOfSale/Updates/UpdateSales.cs
2011-12-05 14:53:02 +05:30

58 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using Tanshu.Accounts.BI;
using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.Helpers;
using Tanshu.Common;
namespace Tanshu.Accounts.PointOfSale.Updates
{
public partial class UpdateSales : Form
{
private List<PendingBillsBO> pendingBills = new List<PendingBillsBO>();
public UpdateSales()
{
InitializeComponent();
}
private void btnShowBill_Click(object sender, EventArgs e)
{
dtpStart.Value = dtpStart.Value.Date;
dtpFinish.Value = dtpFinish.Value.Date.AddDays(1).AddSeconds(-1);
pendingBills = new ManagementBI().GetPaidBills(dtpStart.Value, dtpFinish.Value);
bsPending.DataSource = pendingBills;
decimal? tax = null;
if (cmbTax.Text == "0%")
tax = 0;
else if (cmbTax.Text == "4%")
tax = .04M;
else if (cmbTax.Text == "5%")
tax = .05M;
else if (cmbTax.Text == "5.25%")
tax = .05M;
else if (cmbTax.Text == "13.125%")
tax = .125M;
decimal target = Convert.ToDecimal(txtTarget.Text);
decimal existing = new ManagementBI().GetBalance(tax, dtpStart.Value, dtpFinish.Value);
txtDiff.Text = (target - existing).ToString("#,##.00");
}
private void dgvPending_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (bsPending.Current != null)
{
//Guid gd = new Guid(dgvPending.Rows[e.RowIndex].Cells[2].Value.ToString());
PendingBillsBO current = (PendingBillsBO)bsPending.Current;
using (SalesForm frmSale = new SalesForm(current.voucherID))
frmSale.ShowDialog();
btnShowBill_Click(this, null);
}
}
}
}