$(window).bind("load", function () {
loaddata();
});
function loaddata() {
$.ajax({
type: 'POST',
url: 'SystemParameters.aspx/filldata',
contentType: "application/json",
dataType: "json",
success: function (data) {
var lstbillpara = data.d;
$.each(lstbillpara, function (index, billpara) {
$('#txtipcharges').attr('code', billpara.IP_Treat_Charges);
$('#txtipcharges').val($('#ddl').find('option[value="' + billpara.IP_Treat_Charges + '"]').text().trim());
$('#txtipchargespayable').attr('code', billpara.IP_Treat_Payable);
$('#txtipchargespayable').val($('#ddl').find('option[value="' + billpara.IP_Treat_Payable + '"]').text().trim());
$('#txtEntryBy').val(billpara.entryby);
$('#txtEntryDate').val(billpara.entrydate);
$('#txtUpdateBy').val(billpara.updateby);
$('#txtUpdateDate').val(billpara.updatedate);
$('#txtCBEntryBy').val(billpara.entryby);
$('#txtCBEntryDate').val(billpara.entrydate);
$('#txtCBUpdateBy').val(billpara.updateby);
$('#txtCBUpdateDate').val(billpara.updatedate);
$('#txtRevenue').attr('code', billpara.Revenue);
$('#txtRevenue').val($('#ddl').find('option[value="' + billpara.Revenue + '"]').text().trim());
$('#txtAcntRec').attr('code', billpara.AccountReceivable);
$('#txtAcntRec').val($('#ddl').find('option[value="' + billpara.AccountReceivable + '"]').text().trim());
$('#txtCheckup').attr('code', billpara.Checkup);
$('#txtCheckup').val($('#ddl').find('option[value="' + billpara.Checkup + '"]').text().trim());
$('#txtChargespayable').attr('code', billpara.ChargesPayable);
$('#txtChargespayable').val($('#ddl').find('option[value="' + billpara.ChargesPayable + '"]').text().trim());
$('#txtCheckUpChrgesPayable').attr('code', billpara.ChargesPayable);
$('#txtCheckUpChrgesPayable').val($('#ddl').find('option[value="' + billpara.ChargesPayable + '"]').text().trim());
$('#txtAcntPayable').attr('code', billpara.AccountPayable);
$('#txtAcntPayable').val($('#ddl').find('option[value="' + billpara.AccountPayable + '"]').text().trim());
$('#txtTDS').attr('code', billpara.TDS);
$('#txtTDS').val($('#ddl').find('option[value="' + billpara.TDS + '"]').text().trim());
}); //for each
},
error: function () {
alert("Error! Try again...");
}
}); //ajax
}
==========================================================
public class SystemPara
{
public string IP_Treat_Charges { get; set; }
public string IP_Treat_Payable { get; set; }
public string error { get; set; }
public string entryby { get; set; }
public string entrydate { get; set; }
public string Revenue { get; set; }
public string AccountReceivable { get; set; }
public string Checkup { get; set; }
public string ChargesPayable { get; set; }
public string CheckUpChargesPayable { get; set; }
public string AccountPayable { get; set; }
public string TDS { get; set; }
public string updateby { get; set; }
public string updatedate { get; set; }
}
static private void SetData(ref List<SystemPara> lst, string IP_Treat_Charges, string IP_Treat_Payable,
string error, string entryby, string entrydate, string Revenue, string AccountReceivable, string Checkup,
string ChargesPayable, string CheckUpChargesPayable, string AccountPayable, string TDS,string updateby, string updatedate)
{
SystemPara bill = new SystemPara();
bill.IP_Treat_Charges = IP_Treat_Charges;
bill.IP_Treat_Payable = IP_Treat_Payable;
bill.error = error;
bill.entryby = entryby;
bill.entrydate = entrydate;
bill.Revenue = Revenue;
bill.AccountReceivable = AccountReceivable;
bill.Checkup = Checkup;
bill.ChargesPayable = ChargesPayable;
bill.CheckUpChargesPayable = CheckUpChargesPayable;
bill.AccountPayable = AccountPayable;
bill.TDS = TDS;
bill.updateby = updateby;
bill.updatedate = updatedate;
lst.Add(bill);
}
[WebMethod]
static public List<SystemPara> filldata()
{
List<SystemPara> lstbill = new List<SystemPara>();
OracleConnection cn = new OracleConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
OracleCommand cm = new OracleCommand("", cn);
cm.CommandText = " SELECT sy_hf_ip_treatment_charges, sy_hf_ip_treatment_payable,SY_ENTERED_BY, "
+ " to_char(SY_ENTERED_DATE,'dd-Mon-yyyy')SY_ENTERED_DATE,SY_CORPORATE_SALE_AC,SY_Corp_Acc_Receivable,"
+ " SY_CORP_CHECKUP_AC,SY_CORP_MED_CHAGRES_PAYABLE,SY_hosp_Acc_Payable,SY_Hosp_Acc_Payable,SY_Hosp_TDS, "
+ " SY_UPDATED_BY,to_char(SY_UPDATED_DATE,'dd-Mon-yyyy')SY_UPDATED_DATE "
+ " FROM id_fin_system_para ";
DataTable dt = new DataTable();
new OracleDataAdapter(cm).Fill(dt);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
SetData(ref lstbill, dr["sy_hf_ip_treatment_charges"].ToString(),
dr["sy_hf_ip_treatment_payable"].ToString(), "",
dr["SY_ENTERED_BY"].ToString(),
dr["SY_ENTERED_DATE"].ToString(),
dr["SY_CORPORATE_SALE_AC"].ToString(),
dr["SY_Corp_Acc_Receivable"].ToString(),
dr["SY_CORP_CHECKUP_AC"].ToString(),
dr["SY_CORP_MED_CHAGRES_PAYABLE"].ToString(),
dr["SY_hosp_Acc_Payable"].ToString(),
dr["SY_Hosp_Acc_Payable"].ToString(),
dr["SY_Hosp_TDS"].ToString(),
dr["SY_UPDATED_BY"].ToString(),
dr["SY_UPDATED_DATE"].ToString());
}
}
return lstbill;
}