2010-03-02 17:56:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using Tanshu.Accounts.DAOFactory;
|
|
|
|
|
using Tanshu.Accounts.Contracts;
|
|
|
|
|
using Tanshu.Data.DAO;
|
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.BI
|
|
|
|
|
{
|
|
|
|
|
public class ManagementBI
|
|
|
|
|
{
|
|
|
|
|
public decimal GetBalance(decimal? tax, DateTime startDate, DateTime endDate)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
|
|
|
|
|
{
|
|
|
|
|
return dao.GetBalance(tax);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public List<Guid> GetUpdateBillList(decimal tax, bool voided, bool paid, bool creditCard, DateTime startDate, DateTime endDate)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
|
|
|
|
|
{
|
|
|
|
|
return dao.GetUpdateBillList(tax, voided, paid, creditCard);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public decimal Update(Guid voucherID, decimal tax, DateTime startDate, DateTime endDate)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
|
|
|
|
|
{
|
|
|
|
|
return dao.Update(voucherID, tax);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Reorder(DateTime startDate, DateTime endDate, ShowProgessDelegate showProgressDelegate)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
|
|
|
|
|
{
|
|
|
|
|
dao.Reorder(showProgressDelegate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool MergeData(DateTime startDate, DateTime endDate, string sourceDB, string targetDB)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
|
|
|
|
|
{
|
|
|
|
|
return dao.MergeData(sourceDB, targetDB);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public List<PendingBillsBO> GetPaidBills(DateTime startDate, DateTime finishDate)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IManagementDAO dao = factory.GetManagementDAO(startDate, finishDate, connection))
|
|
|
|
|
{
|
|
|
|
|
return dao.GetPaidBills();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|