using Swift.DAL.ExchangeSystem.LedgerSetup;
using Swift.web.Library;
using System;
using System.Data;
using System.Text;
namespace Swift.web.include
{
public partial class CreateSubGL : System.Web.UI.Page
{
private LedgerDao _obj = new LedgerDao();
private StringBuilder _str = new StringBuilder();
private SwiftLibrary _sl = new SwiftLibrary();
protected void Page_Load(object sender, EventArgs e)
{
_sl.CheckSession();
LoadSubGL();
CreateNewSubGL();
}
private void LoadSubGL()
{
string pId = GetReportParentId();
var dt = _obj.GetLedgerSubHeader(pId);
if (dt == null || dt.Rows.Count == 0)
{
// GetAccount();
}
else
GetSubGL(dt);
GetAccount();
//_str.Append("
");
//foreach (DataRow dr in dt.Rows)
//{
// _str.Append("
");
// _str.Append("
");
// _str.Append("- ");
// _str.Append(" ");
// _str.Append(" ");
// _str.Append("" + dr["acct_num"] + "-" + dr["acct_name"] + " (" + GetStatic.ShowDecimal(dr["clr_bal_amt"].ToString()) + ")" + "");
// _str.Append(" ");
// _str.Append("
");
// _str.Append("
");
// _str.Append("
");
// _str.Append("
");
//}
//CreateNewSubGL();
}
private void GetSubGL(DataTable dt)
{
_str.Append("");
// _str.Append("
");
if (dt == null || dt.Rows.Count == 0)
{
return;
}
_str.Append("
");
foreach (DataRow dr in dt.Rows)
{
_str.Append("- ");
_str.Append(" ");
//_str.Append("");
_str.Append(" ");
_str.Append("" + dr["gl_code"] + "-" + dr["gl_desec"] + "(" + dr["tree_sape"] + ")");
_str.Append(" ");
_str.Append("
");
//_str.Append("
");
_str.Append("
");
_str.Append("");
_str.Append("");
}
_str.Append("");
getSubLedgerGL.InnerHtml = _str.ToString();
}
private string GetParentCode()
{
string a = GetStatic.ReadQueryString("code", "");
string b = a.Replace("tdshow", "");
return b;
}
private void CreateNewSubGL()
{
var str = new StringBuilder();
str.Append("
");
//str.Append("
");
//str.Append("
");
str.Append("
New GL");
str.Append("
New AC");
//str.Append("
New AC");
//str.Append("
");
str.Append("
");
_str.Append("
");
getSubLedgerGL.InnerHtml = _str.ToString();
newSubDL.InnerHtml = str.ToString();
}
private string GetReportParentId()
{
return GetStatic.ReadQueryString("q", "");
}
private void GetAccount()
{
string pId = GetReportParentId();
var dt = _obj.GetLedgerSubGL(pId);
if (dt == null || dt.Rows.Count == 0)
{
return;
}
_str.Append("");
foreach (DataRow dr in dt.Rows)
{
_str.Append("- ");
_str.Append(" ");
_str.Append(" ");
_str.Append("" + dr["acct_num"] + "-" + dr["acct_name"] + " (" + GetStatic.ShowDecimal(dr["clr_bal_amt"].ToString()) + ")" + "");
_str.Append(" ");
_str.Append("
");
}
_str.Append("
");
CreateNewSubGL();
}
}
}