alter view In_Cust
as
select d.Customer_Name,
a.Company_name_details,convert(varchar,(convert(datetime,b.Events_Adv_Invoice_Da
te)),106) as In_Date,
convert(varchar,(convert(datetime,b.Events_Adv_Billing_From_Date)),106) as From_
Date,
convert(varchar,(convert(datetime,b.Events_Adv_Billing_To_Date)),106) as To_Date
,
b.Events_Adv_Invoice_No,
b.Events_Adv_Month,b.Events_Adv_Total_Invoice_Amount,
b.Events_Total_Rental,
(convert(char(5),e.Receipts_Vch_No)+''+(convert(char(5),e.Receipts_Vch_Dt))) as
Payment_Details
from Company_Name_Details a,Events_Advertisement_Invoice b,Adv_Order_Agreement_M
aster c,
Enquiry_Advertisement_Master d,Accounts_Receipts_Root e where a.Company_code=b.C
ompany_code and
a.Company_code=e.Company_code and d.Enquiry_No=c.Enquiry_No and b.Adv_Order_No=c
.Adv_Order_No
select * from In_Cust where Customer_Name='SUNIL' and Company_name_details='comp
any03' and From_Date='07 Apr 2011' and To_Date='08 Apr 2011'
================================================================================
================
alter view All_Cust
as
select
d.Customer_Name,
a.Company_code,
b.Events_Adv_Invoice_No,
b.Events_Adv_Month,b.Events_Adv_Total_Invoice_Amount,
b.Events_Total_Rental,
convert(varchar,(convert(datetime,b.Events_Adv_Invoice_Date)),106) as In_Date,
convert(varchar,(convert(datetime,b.Events_Adv_Billing_From_Date)),106) as From_
Date,
convert(varchar,(convert(datetime,b.Events_Adv_Billing_To_Date)),106) as To_Date
,
(convert(char(5),e.Receipts_Vch_No)+''+(convert(char(5),e.Receipts_Vch_Dt))) as
Payment_Details
from Company_Name_Details a,Events_Advertisement_Invoice b,Adv_Order_Agreement_M
aster c,
Enquiry_Advertisement_Master d,Accounts_Receipts_Root e where a.Company_code=b.C
ompany_code and
a.Company_code=e.Company_code and d.Enquiry_No=c.Enquiry_No and b.Adv_Order_No=c
.Adv_Order_No
select * from All_Cust where Company_code= 'C01'and Customer_Name='PRAVEENA' and
From_Date='01 Mar 2011' and To_Date='22 Mar 2011'
select * from All_Cust where From_Date='01 Mar 2011' and To_Date='22 Mar 2011'
=================================================================
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
public partial class Report_Advertisement_and_Rental_Outstanding_Report : System
.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings
["erpdata"].ConnectionString);
SqlCommand cmd = new SqlCommand();
SqlDataAdapter adp = new SqlDataAdapter();
SqlDataReader dr2;
string query;
decimal price_sum;
decimal price_sum1;
decimal price_sum2;
protected void Page_Load(object sender, EventArgs e)
{
Label5.Visible = false; Label15.Visible = false;
Label6.Visible = false; Label16.Visible = false;
Label7.Visible = false; Label17.Visible = false;
Label8.Visible = false; Label18.Visible = false;
Lab_cust.Visible = false; Label19.Visible = false;
ddl_customer.Visible = false; lblmsg.Visible = false;
Label23.Visible = false;
Label24.Visible = false;
if (!Page.IsPostBack)
{
con.Open();
cmd = new SqlCommand("Select Company_code,Company_name_details from
Company_Name_Details Order By Company_name_details asc", con);
SqlDataReader dr;
dr = cmd.ExecuteReader();
ddl_company.DataSource = dr;
ddl_company.DataTextField = "Company_name_details";
ddl_company.DataValueField = "Company_code";
ddl_company.DataBind();
ddl_company.Items.Insert(0, "--select--");
ddl_company.Items.Insert(1, "--All--");
con.Close();
}
}
protected void bnt_View_Click(object sender, ImageClickEventArgs e)
{
Repeater2.DataSource = null;
Repeater2.DataBind();
Repeater3.DataSource = null;
Repeater3.DataBind();
if (rbtsummary.Checked == true && rbtcust.Checked == false)
{
if (ddl_company.SelectedIndex == 1)
{
Label6.Visible = true; Label5.Visible = true;
Label8.Visible = true; Label7.Visible = true;
Lab_cust.Visible = false; Label23.Visible = true; FormView1.Visible
= true;
query = "select * from All_Cust where From_Date='" + txt_fromdate.Te
xt + "' and To_Date='" + txt_todate.Text + "'";
con.Open();
cmd = new SqlCommand(query, con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter ada = new SqlDataAdapter(query, con);
DataSet dset = new DataSet();
ada.Fill(dset);
if (dset.Tables[0].Rows.Count != 0)
{
Repeater3.DataSource = dset;
Repeater3.DataBind();
FormView1.DataSource = dset;
FormView1.DataBind();
Label6.Text = txt_fromdate.Text;
Label8.Text = txt_todate.Text;
Panel1.Visible = true;
}
else
{
ddl_customer.Visible = false; FormView1.Visible = false;
lblmsg.Visible = true; lblmsg.Text = "No Data Found";
}
con.Close();
}
else
{
ddl_customer.Visible = false; FormView1.Visible = false;
lblmsg.Visible = true; lblmsg.Text = "No Data Found";
}
}
else if (rbtcust.Checked == true && rbtsummary.Checked == false)
{
string a = ddl_customer.Text.ToString();
if (ddl_company.SelectedIndex != 1 & ddl_customer.SelectedIndex != 0)
{
Label16.Visible = true; Label15.Visible = true;
Label18.Visible = true; Label17.Visible = true;
Label19.Visible = true; FormView2.Visible = true;
FormView1.Visible = false; Label24.Visible = true; ddl_customer.Visi
ble = true;
query = "select * from All_Cust where Company_name_details='" + ddl_
company.SelectedItem.ToString() + "' and Customer_Name='" + a + "' and From_Date
='" + txt_fromdate.Text + "' and To_Date='" + txt_todate.Text + "'";
con.Open();
cmd = new SqlCommand(query, con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter ada = new SqlDataAdapter(query, con);
DataSet dset = new DataSet();
ada.Fill(dset);
if (dset.Tables[0].Rows.Count != 0)
{
Repeater2.DataSource = dset;
Repeater2.DataBind();
FormView2.DataSource = dset;
FormView2.DataBind();
Label16.Text = txt_fromdate.Text;
Label18.Text = txt_todate.Text;
Label20.Text = ddl_customer.SelectedItem.ToString();
}
else
{
FormView2.Visible = false;
ddl_customer.Visible = false;
Label20.Visible = false; Label15.Visible = false;
Label16.Visible = false; Label17.Visible = false; Label18.Visibl
e = false;
lblmsg.Visible = true; lblmsg.Text = "No Data Found";