2010-03-02 17:56:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Tanshu.Accounts.Helpers;
|
|
|
|
|
using Tanshu.Accounts.Print;
|
|
|
|
|
using Tanshu.Accounts.Contracts;
|
2011-01-30 07:14:05 +00:00
|
|
|
|
using Tanshu.Accounts.Repository;
|
|
|
|
|
using Tanshu.Accounts.Entities;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.PointOfSale
|
|
|
|
|
{
|
2011-02-18 16:54:48 +00:00
|
|
|
|
public partial class frmRecieveAdvance : Form
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
bool loading = true;
|
2011-02-18 16:54:48 +00:00
|
|
|
|
public frmRecieveAdvance()
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnAdd_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Convert.ToDecimal(txtAmount.Text) == 0)
|
|
|
|
|
return;
|
2011-01-30 07:14:05 +00:00
|
|
|
|
Advance adv = new Advance();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
adv.Narration = txtNarration.Text;
|
|
|
|
|
adv.Amount = Convert.ToDecimal(txtAmount.Text.Trim());
|
2011-06-23 12:47:48 +00:00
|
|
|
|
using (var bi = new UserBI())
|
|
|
|
|
adv.CashierIn = bi.Get(x => x.UserID == (int)txtCashier.Tag);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
adv.DateIn = DateTime.Now;
|
|
|
|
|
new AdvanceBI().Insert(adv);
|
|
|
|
|
GridBind();
|
|
|
|
|
PrintAdvances();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-02-18 16:54:48 +00:00
|
|
|
|
private void frmRecieveAdvance_Load(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
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;
|
2011-01-06 07:17:00 +00:00
|
|
|
|
txtCashier.Text = Session.User.Name;
|
|
|
|
|
txtCashier.Tag = Session.User.UserID;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
loading = false;
|
|
|
|
|
GridBind();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GridBind()
|
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
var advance = new AdvanceBI().GetAdvances(dtpFrom.Value, dtpTo.Value, true);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
dgExpenses.DataSource = advance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void dtpFrom_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!loading)
|
|
|
|
|
GridBind();
|
|
|
|
|
}
|
|
|
|
|
private void PrintAdvances()
|
|
|
|
|
{
|
2011-01-17 14:55:43 +00:00
|
|
|
|
Thermal.PrintAdvance(Session.User.Name, txtAmount.Text.Trim(), txtNarration.Text.Trim());
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
private string AddDate(string SqlStringP, DateTime FromDate, DateTime ToDate)
|
|
|
|
|
{
|
|
|
|
|
return SqlStringP.Replace("$From$", string.Format(FromDate.ToString(), "dd-MMM-yyyy" + " 05:00:00")).Replace("$To$", string.Format(ToDate.ToString(), "dd-MMM-yyyy" + " 23:59:59"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void txtAmount_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void txtAmount_Leave(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (txtAmount.Text.Trim() == "")
|
|
|
|
|
{
|
|
|
|
|
txtAmount.Focus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|