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

79 lines
3.0 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
using Tanshu.Accounts.Helpers;
using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.BI;
namespace Tanshu.Accounts.PointOfSale
{
public partial class SaleTaxReportForm : Form
{
List<SalesAnalysisBO> det;
public SaleTaxReportForm()
{
InitializeComponent();
}
private void dtpStart_ValueChanged(object sender, EventArgs e)
{
ShowStatement();
}
private void ShowStatement()
{
DateTime startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value));
DateTime finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value));
decimal freeSale = 0, voids = 0, pending = 0, net = 0, tax = 0;
det = new SalesAnalysisBI().GetSalesTaxReturn(startDate, finishDate, ref freeSale, ref voids, ref pending, ref net, ref tax);
//dc.CommandTimeout = 50000;
dgvSale.AutoGenerateColumns = true;
dgvSale.DataSource = det;
dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
dgvSale.Columns[0].Visible = false;
dgvSale.Columns[1].DefaultCellStyle.Format = "%";
dgvSale.Columns[2].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
dgvSale.Columns[3].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
dgvSale.Columns[4].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
// txtFreeSale.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", freeSale);
txtVoid.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", voids);
txtPending.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", pending);
txtNet.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", net);
txtTax.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", tax);
txtGross.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", net + tax);
}
private void dtpFinish_ValueChanged(object sender, EventArgs e)
{
ShowStatement();
}
private void Sale_Analysis_Form_Load(object sender, EventArgs e)
{
dtpStart.Value = DateTime.Now;
dtpFinish.Value = DateTime.Now;
ShowStatement();
}
private void btnPrint_Click(object sender, EventArgs e)
{
if (det != null)
{
DateTime startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value));
DateTime finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value));
Tanshu.Accounts.Print.Thermal.PrintSale(det, startDate, finishDate);
}
}
}
}