using Swift.DAL.AccountReport;
using Swift.web.Library;
using System;
using System.Data;
using System.Text;
using System.Web;
namespace Swift.web.AccountReport.DayBook
{
public partial class dayBookReportUser : System.Web.UI.Page
{
private string vName = null;
private string fromDate = null;
private string toDate = null;
private string vType = null;
private string userName = null;
private SwiftLibrary _sl = new SwiftLibrary();
private DayBookReportDAO st = new DayBookReportDAO();
protected void Page_Load(object sender, EventArgs e)
{
_sl.CheckSession();
if (!IsPostBack)
{
GenerateDayBookRepotUser();
}
}
protected string FromDate()
{
return GetStatic.ReadQueryString("startDate", "");
}
protected string ToDate()
{
return GetStatic.ReadQueryString("endDate", "");
}
protected string VoucherType()
{
return GetStatic.ReadQueryString("vType", "");
}
protected string VoucherName()
{
return GetStatic.ReadQueryString("vName", "");
}
protected string UserName()
{
return GetStatic.ReadQueryString("userName", "");
}
private void GenerateDayBookRepotUser()
{
vName = VoucherName();
fromDate = FromDate();
toDate = ToDate();
vType = VoucherType();
userName = UserName();
DataSet ds = st.GetDayBookReportUser(fromDate, toDate, vType, userName);
if (ds == null || ds.Tables.Count == 0)
{
return;
}
int i = 0;
if (ds.Tables != null)
{
var tbl = ds.Tables[i];
var sb = new StringBuilder();
double DRTotal = 0, cRTotal = 0;
int sNo = 1;
sb.AppendLine("
");
// sb.AppendLine("
//
// "); sb.AppendLine(" "); sb.AppendLine("
// Daybook Report "); sb.AppendLine(" | "); sb.AppendLine("
//
// ");
sb.AppendLine("");
sb.AppendLine(" User Name: " + userName + " ");
sb.AppendLine(" | ");
sb.AppendLine("
");
sb.AppendLine("");
string vNumber = null;
foreach (DataRow item in tbl.Rows) { vNumber = item["billno"].ToString(); }
sb.AppendLine("Voucher No : " + vNumber + " | ");
sb.AppendLine("Voucher Type : " + vName + " | ");
sb.AppendLine("
");
sb.AppendLine("");
sb.AppendLine("");
sb.AppendLine(" ");
sb.AppendLine("");
sb.AppendLine("SN | ");
sb.AppendLine("AC No | ");
sb.AppendLine("Name | ");
sb.AppendLine("Dr Amount | ");
sb.AppendLine("Cr Amount | ");
sb.AppendLine(" ");
foreach (DataRow item in tbl.Rows)
{
sb.AppendLine("");
DRTotal += GetStatic.ParseDouble(item["DRTotal"].ToString());
cRTotal += GetStatic.ParseDouble(item["cRTotal"].ToString());
//var vNumber = item["billno"].ToString();
sb.AppendLine("" + sNo + " | ");
sb.AppendLine("" + item["acc_num"] + " | ");
sb.AppendLine("" + item["acct_name"] + " | ");
sb.AppendLine("" + GetStatic.ShowDecimal(item["DRTotal"].ToString()) + " | ");
sb.AppendLine("" + GetStatic.ShowDecimal(item["cRTotal"].ToString()) + " | ");
sb.AppendLine(" ");
sNo++;
}
sb.AppendLine("");
sb.AppendLine("" + "Total" + " | ");
sb.AppendLine("" + GetStatic.ShowDecimal(DRTotal.ToString()) + " | ");
sb.AppendLine("" + GetStatic.ShowDecimal(cRTotal.ToString()) + " | ");
sb.AppendLine(" ");
sb.AppendLine(" ");
sb.AppendLine(" | ");
sb.AppendLine("
");
sb.AppendLine("
");
reportDiv.InnerHtml = sb.ToString();
i++;
}
//var sb = new StringBuilder();
//double DRTotal = 0, cRTotal = 0;
//int sNo = 1;
//drTotal.Text = GetStatic.ShowDecimal(cRTotal.ToString());
//crTotal.Text = GetStatic.ShowDecimal(DRTotal.ToString());
//foreach (DataRow item in dt.Rows)
//{
// sb.AppendLine("");
// sb.AppendLine("");
// sb.AppendLine("Voucher No : " + item["billno"] + " | ");
// sb.AppendLine("Voucher Type : " + vName + " | ");
// sb.AppendLine("
");
// sb.AppendLine("");
// sb.AppendLine("SN | ");
// sb.AppendLine("AC No | ");
// sb.AppendLine("Name | ");
// sb.AppendLine("Dr Amount | ");
// sb.AppendLine("Cr Amount | ");
// sb.AppendLine("
");
// sb.AppendLine("");
// DRTotal += GetStatic.ParseDouble(item["DRTotal"].ToString());
// cRTotal += GetStatic.ParseDouble(item["cRTotal"].ToString());
// sb.AppendLine("" + sNo + " | ");
// sb.AppendLine("" + item["acc_num"] + " | ");
// sb.AppendLine("" + item["acct_name"] + " | ");
// sb.AppendLine("" +
// GetStatic.ShowDecimal(item["DRTotal"].ToString()) + " | "); sb.AppendLine("" + GetStatic.ShowDecimal(item["cRTotal"].ToString()) + " | ");
// sb.AppendLine("
");
// sb.AppendLine("
");
// sNo++;
// reportDiv.InnerHtml = sb.ToString();
//}
//drTotal.Text = GetStatic.ShowDecimal(cRTotal.ToString());
//crTotal.Text = GetStatic.ShowDecimal(DRTotal.ToString());
}
protected void pdf_Click(object sender, EventArgs e)
{
GetStatic.GetPDF(HttpUtility.UrlDecode(hidden.Value));
}
}
}