using Swift.DAL.AccountReport; using Swift.web.Library; using System; using System.Data; using System.Text; namespace Swift.web.AccountReport.BalanceSheet { public partial class SubLedger : System.Web.UI.Page { private readonly SwiftLibrary _s1 = new SwiftLibrary(); private readonly AccountStatementDAO st = new AccountStatementDAO(); protected void Page_Load(object sender, EventArgs e) { _s1.CheckSession(); GenerateReport(); } protected string GetMapCode() { return GetStatic.ReadQueryString("mapcode", ""); } protected string GetHead() { return GetStatic.ReadQueryString("head", ""); } protected string GetTreeSape() { return GetStatic.ReadQueryString("treeSape", ""); } protected string GetDate() { return GetStatic.ReadQueryString("dt", ""); } protected string GetDate1() { return GetStatic.ReadQueryString("dt1", ""); } protected string GetSentFromFlag() { return GetStatic.ReadQueryString("sentfrom", ""); } private void GenerateReport() { string mapcode = GetMapCode(); string head = GetHead(); string treeSape = GetTreeSape(); string rdate = GetDate(); string date = (GetSentFromFlag() == "pl_account_dt") ? GetDate1() : ""; var secondCall = ""; var secondCallDate = ""; if (GetSentFromFlag() == "pl_account") { secondCall = "&sentfrom=pl_account"; secondCallDate = date; } var sb = new StringBuilder(""); var sb2 = new StringBuilder(""); var dt = st.GetSubLedgerReport(mapcode, treeSape, rdate, date); int sno = 0; double total = 0, DR = 0, CR = 0; if (dt.Rows.Count > 0 && dt != null) { foreach (DataRow item in dt.Rows) { sno++; total = total + Convert.ToDouble(item["Total"].ToString()); DR = DR + Convert.ToDouble(item["DR"].ToString()); CR = CR + Convert.ToDouble(item["CR"].ToString()); var drcrMode = " (CR)"; if (Convert.ToDouble(item["DR"].ToString()) - Convert.ToDouble(item["CR"].ToString()) > 0) { drcrMode = " (DR)"; } sb.AppendLine(""); sb.AppendLine("" + sno.ToString() + ""); sb.AppendLine("" + item["acct_name"].ToString() + ""); sb.AppendLine("" + GetStatic.ShowAbsDecimal(item["DR"].ToString()) + ""); sb.AppendLine("" + GetStatic.ShowAbsDecimal(item["CR"].ToString()) + ""); sb.AppendLine(" " + GetStatic.ShowAbsDecimal(item["Total"].ToString()) + drcrMode + " "); sb.AppendLine(""); } sb.AppendLine(""); sb.AppendLine("TOTAL:"); sb.AppendLine(" " + GetStatic.ShowAbsDecimal(DR.ToString()) + ""); sb.AppendLine(" " + GetStatic.ShowAbsDecimal(CR.ToString()) + ""); sb.AppendLine(" " + GetStatic.ShowAbsDecimal(total.ToString()) + ""); sb.AppendLine(""); rptBody.InnerHtml = sb.ToString(); } if (mapcode.Length == 4 || mapcode.Length.ToString() == "4") { mapcode = mapcode + "00"; } sno = 0; total = DR = CR = 0; //if (string.IsNullOrEmpty(GetStatic.ReadQueryString("dt1", ""))) //{ // //2/5/2016 // DateTime reportdate = Convert.ToDateTime(rdate); // date = "1/" + reportdate.Month + "/" + reportdate.Year; //} var dt2 = st.GetSubLedgerReport2(mapcode, date, rdate); if (dt2.Rows.Count > 0 && dt2 != null) { sb2.AppendLine("
"); sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); foreach (DataRow item in dt2.Rows) { sno++; total = total + Convert.ToDouble(item["total"].ToString()); DR = DR + Convert.ToDouble(item["dr_closing"].ToString()); CR = CR + Convert.ToDouble(item["cr_closing"].ToString()); // var startDate = $("#startDate").val(); //var endDate = $("#endDate").val(); //var acInfo = GetItem("acInfo")[0]; //var acInfotxt = GetItem("acInfo")[1]; //var url = "StatementDetails.aspx?startDate=" + startDate + "&endDate=" + endDate + "&acNum=" + acInfo + "&acName=" + acInfotxt; var drcrMode = " (CR)"; if (Convert.ToDouble(item["dr_closing"].ToString()) - Convert.ToDouble(item["cr_closing"].ToString()) > 0) { drcrMode = " (DR)"; } sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine("");//link here in account number sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); } sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine(""); sb2.AppendLine("
SNAC Num AC Name DR Closing   CR Closing  Balance  
" + sno.ToString() + " " + item["acct_num"].ToString() + " " + item["acct_name"].ToString() + " " + GetStatic.ShowAbsDecimal(item["dr_closing"].ToString()) + " " + GetStatic.ShowAbsDecimal(item["cr_closing"].ToString()) + " " + GetStatic.ShowAbsDecimal(item["total"].ToString()) + drcrMode + "
TOTAL: " + GetStatic.ShowAbsDecimal(DR.ToString()) + " " + GetStatic.ShowAbsDecimal(CR.ToString()) + " " + GetStatic.ShowAbsDecimal(total.ToString()) + "
"); bottomRptBody.InnerHtml = sb2.ToString(); } } } }