2016-01-04 05:22:01 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Tanshu.Accounts.Repository;
|
|
|
|
|
using Tanshu.Accounts.Contracts;
|
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.PointOfSale
|
|
|
|
|
{
|
2016-07-04 06:21:39 +00:00
|
|
|
|
public partial class TaxAnalysisForm : Form
|
2016-01-04 05:22:01 +00:00
|
|
|
|
{
|
|
|
|
|
IList<TaxAnalysis> _list;
|
|
|
|
|
bool _loading;
|
2016-07-04 06:21:39 +00:00
|
|
|
|
public TaxAnalysisForm()
|
2016-01-04 05:22:01 +00:00
|
|
|
|
{
|
|
|
|
|
_loading = true;
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-04 06:21:39 +00:00
|
|
|
|
private void TaxAnalysisForm_Load(object sender, EventArgs e)
|
2016-01-04 05:22:01 +00:00
|
|
|
|
{
|
|
|
|
|
dtpStart.Format = DateTimePickerFormat.Custom;
|
|
|
|
|
dtpStart.CustomFormat = "dd-MMM-yyyy";
|
|
|
|
|
dtpStart.Value = DateTime.Now.Date;
|
|
|
|
|
dtpFinish.Format = DateTimePickerFormat.Custom;
|
|
|
|
|
dtpFinish.CustomFormat = "dd-MMM-yyyy";
|
|
|
|
|
dtpFinish.Value = DateTime.Now.Date;
|
|
|
|
|
_loading = false;
|
|
|
|
|
ShowStatement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void dtpStart_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ShowStatement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ShowStatement()
|
|
|
|
|
{
|
|
|
|
|
if (_loading)
|
|
|
|
|
return;
|
|
|
|
|
if (DateTime.Today.Subtract(dtpStart.Value.Date).Days > 5 &&
|
|
|
|
|
!Session.IsAllowed("Accounts Audit"))
|
|
|
|
|
return;
|
|
|
|
|
var start = dtpStart.Value.Date.AddHours(6);
|
|
|
|
|
var finish = dtpFinish.Value.Date.AddDays(1).AddHours(5);
|
|
|
|
|
_list = new List<TaxAnalysis>();
|
|
|
|
|
if (finish > start)
|
|
|
|
|
{
|
|
|
|
|
var list = new List<TaxAnalysis>();
|
2018-08-24 10:41:33 +00:00
|
|
|
|
list.AddRange(SalesAnalysisBI.GetServiceTax(start, finish));
|
|
|
|
|
list.AddRange(SalesAnalysisBI.GetVat(start, finish));
|
2016-01-04 05:22:01 +00:00
|
|
|
|
_list = list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dgvSale.AutoGenerateColumns = true;
|
|
|
|
|
dgvSale.DataSource = _list;
|
|
|
|
|
dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
|
|
|
|
dgvSale.Columns[1].DefaultCellStyle.Format = "#.##%;(#.##%);0%";
|
|
|
|
|
dgvSale.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
|
|
|
|
dgvSale.Columns[2].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
|
|
|
|
dgvSale.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
|
|
|
|
dgvSale.Columns[3].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
|
|
|
|
dgvSale.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void dtpFinish_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ShowStatement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnPrint_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (_list != null)
|
|
|
|
|
{
|
|
|
|
|
var startDate = dtpStart.Value.Date.AddHours(6);
|
|
|
|
|
var finishDate = dtpFinish.Value.Date.AddDays(1).AddHours(5);
|
|
|
|
|
//Accounts.Print.Thermal.PrintSale(Session.User.Name, _list, startDate, finishDate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|