using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MySql.Data.MySqlClient;
using System.Configuration;
using System.Web.Services;
using Newtonsoft.Json;
using System.Web.Script.Serialization;
public partial class module_expensesreceiptsprint : System.Web.UI.Page
{
    public static string constring = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
    public static MySqlConnection con = new MySqlConnection(constring);
    public static DateTime date1; public static DateTime date2;
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    [WebMethod]

    public static object GetData(string reptsids)
    {
        string data = " ";

        using (MySqlConnection con = new MySqlConnection(constring))
        {
            using (MySqlCommand cmd = new MySqlCommand("select  expenses_setup.*,expensesasters.expenses as expenname,date_format(expenses_setup.paydate,'%d-%m-%Y') as recptdate,class_master.class as clsname from expenses_setup left join expensesasters on expenses_setup.exepnses  = expensesasters.id left join class_master on expenses_setup.clsid = class_master.id  where expenses_setup.rectpsnos = '" + reptsids + "'", con))
            {
                if (con.State != ConnectionState.Open) { con.Open(); }
                DataSet ds = new DataSet();
                using (MySqlDataAdapter da = new MySqlDataAdapter(cmd))
                {
                    da.Fill(ds); con.Close();
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        data = JsonConvert.SerializeObject(ds.Tables[0]);
                    }


                }
            }
        }
        return data;
    }
}