narsil/Tanshu.Accounts.PointOfSale/Advances/frmAdjustAdvance.cs

61 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.Repository;
using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.Entities;
namespace Tanshu.Accounts.PointOfSale
{
public partial class frmAdjustAdvance : Form
{
bool loading = true;
public frmAdjustAdvance()
{
InitializeComponent();
}
private void frmAdjustAdvance_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
{
var item = (Advance)dgExpenses.SelectedRows[0].DataBoundItem;
txtCashier.Text = item.CashierIn.Name;
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((int)txtNarration.Tag, Session.User.UserID);
FillDataGrid();
}
}
}