54 lines
2.4 KiB
C#
54 lines
2.4 KiB
C#
using Ease.Core.DataAccess;
|
|
using HRM.BO;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
public class CheckListDA
|
|
{
|
|
#region Constructor
|
|
public CheckListDA() { }
|
|
#endregion
|
|
|
|
internal static DataSet GetCheckList(TransactionContext tc, DateTime fromVoucherDate, DateTime toVoucherDate, int voucherType, int costCenterID, int detailParamID, int masterParamID)
|
|
{
|
|
#region Dynamic SQL
|
|
string sql = "where gt.gltranid = gtd.gltranid "
|
|
+ "and gtd.glid=gl.glid";
|
|
|
|
sql = SQLParser.TagSQL(sql) + SQLParser.MakeSQL("gt.voucherdate between %d and %d", fromVoucherDate, toVoucherDate);
|
|
|
|
if (voucherType != 0)
|
|
sql = SQLParser.TagSQL(sql) + SQLParser.MakeSQL("gt.gltrantype=%n", voucherType);
|
|
|
|
if (costCenterID > 0)
|
|
sql = SQLParser.TagSQL(sql) + SQLParser.MakeSQL("gtd.costcenterid=%n", costCenterID);
|
|
|
|
if (masterParamID > 0)
|
|
sql = SQLParser.TagSQL(sql) + SQLParser.MakeSQL("gt.masterparamid=%n", masterParamID);
|
|
|
|
if (detailParamID > 0)
|
|
sql = SQLParser.TagSQL(sql) + SQLParser.MakeSQL("gtd.detailparamid=%n", detailParamID);
|
|
#endregion
|
|
|
|
string query = SQLParser.MakeSQL("select partial2.*,(ur2.field1 + ' ' + ur2.field2) SubsidaryHead2 from "
|
|
+ "(select partial1.*, (ur1.field1 + ' ' + ur1.field2) SubsidaryHead1 from (select transac.*,gtur.userrecord1id,gtur.userrecord2id,gtur.amount SubAmount, gtur.description SubDescription from "
|
|
+ "(select gt.voucherdate VoucherDate, gt.gltrantype VoucherType, gt.voucherNo VoucherNo, "
|
|
+ "gt.masterparamid, gtd.costcenterid , "
|
|
+ "gtd.detailparamid, gl.glcode PostingCode, gl.glDescription PostingHead, gtd.description Description, gtd.transide TranSide, gtd.amount Amount, gtd.gltrandetailid "
|
|
+ "from gltran gt, gltrandetail gtd, gl "
|
|
+ " %q) transac left outer join gltranuserrecord gtur "
|
|
+ "on transac.gltrandetailid = gtur.gltrandetailid ) partial1 left outer join userrecord ur1 on partial1.userrecord1id = ur1.userrecordid) partial2 "
|
|
+ "left outer join userrecord ur2 on partial2.userrecord2id = ur2.userrecordid", sql);
|
|
|
|
return tc.ExecuteDataSet(query);
|
|
|
|
}
|
|
}
|
|
}
|