narsil/Tanshu.Accounts.PointOfSale/Sales/AdjustAdvanceForm.cs
2010-03-02 23:26:21 +05:30

60 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Tanshu.Accounts.Helpers;
using System.Data.SqlClient;
using System.Configuration;
using Tanshu.Accounts.BI;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.PointOfSale
{
public partial class AdjustAdvanceForm : Form
{
bool loading = true;
public AdjustAdvanceForm()
{
InitializeComponent();
}
private void AdjustAdvancesForm_Load(object sender, EventArgs e)
{
dtpFrom.Format = DateTimePickerFormat.Custom;
dtpFrom.CustomFormat = "dd-MMM-yyyy";
dtpFrom.Value = DateTime.Now;
dtpTo.Format = DateTimePickerFormat.Custom;
dtpTo.CustomFormat = "dd-MMM-yyyy";
dtpTo.Value = DateTime.Now;
loading = false;
FillDataGrid();
}
private void FillDataGrid()
{
dgExpenses.DataSource = new AdvanceBI().GetAdvances(dtpFrom.Value, dtpTo.Value, false);
}
private void dtpFrom_ValueChanged(object sender, EventArgs e)
{
if (!loading)
FillDataGrid();
}
private void btnSelect_Click(object sender, EventArgs e)
{
try
{
AdvanceDisplayBO item = (AdvanceDisplayBO)dgExpenses.SelectedRows[0].DataBoundItem;
txtCashier.Text = item.Cashier;
txtNarration.Tag = item.AdvanceID;
txtNarration.Text = item.Narration;
txtAmount.Text = item.Amount.ToString();
}
catch { }
}
private void btnAdjust_Click(object sender, EventArgs e)
{
new AdvanceBI().Adjust((Guid)txtNarration.Tag, CurrentUser.user.UserID);
FillDataGrid();
}
}
}