Esempio n. 1
0
        protected void SelectedPartDetail(string item)
        {
            try
            {
                if (ViewState["lookupid"].ToString() == "1")
                {
                    txtCusCode.Text = item;
                    txtCusDesc.Text = sysFunc.GetStringValuesAgainstCodes("CusCode", item, "CusDesc", "Customer", Session["DealerCode"].ToString());
                }
                else if (ViewState["lookupid"].ToString() == "93")
                {
                    txtInsCompCode.Text = item;
                    txtInsCompDesc.Text = sysFunc.GetStringValuesAgainstCodes("InsCompCode='" + item + "'", "InsuranceCompanies", "InsCompDescription");
                }
                else if (ViewState["lookupid"].ToString() == "94")
                {
                    txtInsBrCode.Text = item;
                    txtInsBrDesc.Text = sysFunc.GetStringValuesAgainstCodes("BranchCode='" + item + "' and InsCompCode='" + txtInsCompCode.Text + "' ", "Branch", "BranchDesc");
                }
            }

            catch (Exception ex)
            {
                sysFunc.UserMsg(lblMsg, Color.Red, ex.Message);
            }
        }
Esempio n. 2
0
 protected void SelectedPartDetail(string item)
 {
     if (Session["Comp"].ToString() == "Company")
     {
         txtInsCompCode.Text = item;
         txtInsCompDesc.Text = SysFunc.GetStringValuesAgainstCodes("InsCompCode='" + item + "'", "InsuranceCompanies", "InsCompDescription");
     }
     else
     {
         txtInsBrCode.Text = item;
         txtInsBrDesc.Text = SysFunc.GetStringValuesAgainstCodes("BranchCode='" + item + "' and InsCompCode='" + txtInsCompCode.Text + "' ", "Branch", "BranchDesc");
     }
 }
Esempio n. 3
0
        protected void Set_values(string Item)
        {
            if (ViewState["lookupid"].ToString() == "3")
            {
                txtreg.Text = Item;
                string sql = "SP_Get_VechicleDataForCVO '" + Session["DealerCode"].ToString() + "','" + Item + "'";

                DataTable dt = new DataTable();

                dt = sysFunc.GetData(sql);

                if (dt.Rows.Count > 0)
                {
                    txtreg.Text         = dt.Rows[0]["RegNo"].ToString();
                    txtChassisNo.Text   = dt.Rows[0]["ChassisNo"].ToString();
                    txtEngineNo.Text    = dt.Rows[0]["EngineNo"].ToString();
                    txtVehicle.Text     = dt.Rows[0]["ProdCode"].ToString();
                    txtColor.Text       = dt.Rows[0]["ColorDesc"].ToString();
                    txtOldcustomer.Text = dt.Rows[0]["CusDesc"].ToString();
                    txtOldCusCode.Text  = dt.Rows[0]["CusCode"].ToString();
                }
                String query = "SP_Get_CVODataByRegNo '" + Session["DealerCode"].ToString() + "','" + txtreg.Text + "'";


                dt = sysFunc.GetData(query);

                if (dt.Rows.Count > 0)
                {
                    gv_CVO.DataSource = dt;
                    gv_CVO.DataBind();
                }

                Session["CVODS"] = dt;
            }
            else if (ViewState["lookupid"].ToString() == "1")
            {
                txtNewCusDesc.Text  = sysFuncs.GetStringValuesAgainstCodes("CusCode", Item, "CusDesc", "Customer", Session["DealerCode"].ToString());
                txtNewcustomer.Text = Item;
            }
            else if (ViewState["lookupid"].ToString() == "76")
            {
                txtCVONo.Text = Item;
                String query = "SP_Get_CVOData'" + Session["DealerCode"].ToString() + "','" + Item + "'";
                dt = sysFunc.GetData(query);

                if (dt.Rows.Count > 0)
                {
                    gv_CVO.DataSource = dt;
                    gv_CVO.DataBind();
                }

                Session["CVODS"] = dt;
            }
        }
Esempio n. 4
0
 protected void SelectedPartDetail(string item)
 {
     try
     {
         if (ViewState["lookupid"].ToString() == "73")
         {
             txtExtno.Text  = item;
             txtLossNo.Text = SysFunc.GetStringValuesAgainstCodes("CustomerEstimateCode='" + txtExtno.Text + "' and DealerCode='" + Session["DealerCode"].ToString() + "'", "CustomerEstimateMaster", "LossNo");
             string lossdate = SysFunc.GetStringValuesAgainstCodes("CustomerEstimateCode='" + txtExtno.Text + "' and DealerCode='" + Session["DealerCode"].ToString() + "'", "CustomerEstimateMaster", "LossDate");
             if (lossdate != null && lossdate != "")
             {
                 txtCreateDate.Text = SysFuncs.GetDate(lossdate);
             }
         }
     }
     catch (Exception ex)
     {
         SysFunc.UserMsg(lblMsg, Color.Red, ex.Message);
     }
 }
Esempio n. 5
0
        public bool UpdateCounterSales(string InvoiceNO, ref SqlTransaction Trans)
        {
            //#/------Updating CounterSalesMaster
            string Update_Qry = string.Empty;
            string SIRNo      = string.Empty;

            SIRNo = SysFunc.GetStringValuesAgainstCodes("InvoiceNo", InvoiceNO, "SIRNo", "SIRMaster", "And DelFlag = 'N' ", Session["DealerCode"].ToString());

            Update_Qry += " Update CounterSaleMaster Set CounterSaleMaster.IssueFlag = ";
            Update_Qry += " (";
            Update_Qry += " Select Case Count(X.SIRNo) When 0 Then 'Y' Else 'N' End From SIRDetail X ";
            Update_Qry += " Where X.SIRNo = '" + SIRNo + "' ";
            Update_Qry += " And X.DealerCode = '" + Session["DealerCode"].ToString() + "' ";
            Update_Qry += " And X.Quantity > X.RecQty ";
            Update_Qry += " ) ";
            Update_Qry += " Where ";
            Update_Qry += " SaleInvNo = '" + InvoiceNO + "' ";
            Update_Qry += " And DealerCode = '" + Session["DealerCode"].ToString() + "' ";
            Update_Qry += " And PostFlag = 'N' ";

            try
            {
                if (SysFunc.ExecuteQuery(Update_Qry, Trans) == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 6
0
        protected void txtEngNo_TextChanged(object sender, EventArgs e)
        {
            ds = new DataSet();
            DataTable dt = new DataTable();

            search_result    = false;
            txtEngNo.ToolTip = "";
            try
            {
                if (txtEngNo.Text.Count() < 6)
                {
                    lblMSG.Text = "6 Characters must be enter in Engine number";
                    PopupControlMSG.ShowOnPageLoad = true;
                    return;
                }
                else
                {
                    lblMasg.Text = "";
                }
                SqlParameter[] paramData =
                {
                    new SqlParameter("@EngineNo", SqlDbType.VarChar, 5),
                    new SqlParameter("@Chk",      SqlDbType.Char, 1)
                };
                if (txtEngNo.Text == "")
                {
                    return;
                }
                else
                {
                    if (cmbBrand.Value.ToString().Trim() == "001")
                    {
                        txtChassisNo.Text  = "";
                        cmbProdCode.Text   = ""; txtVersion.Text = ""; cmbColorCode.Text = ""; txtInvoiceNo.Text = "";
                        dpInvoiceDate.Text = ""; txtProdDesc.Text = ""; txtColorName.Text = "";

                        if (myFunc.CodeExists("customervehicle", "EngineNo", txtEngNo.Text.Trim(), ref ds, Session["DealerCode"].ToString()))
                        {
                            txtRegNo.Text     = ds.Tables[0].Rows[0]["RegNo"].ToString();
                            dpRegDate.Text    = ds.Tables[0].Rows[0]["tdDate"].ToString();
                            txtChassisNo.Text = ds.Tables[0].Rows[0]["ChassisNo"].ToString();
                            cmbProdCode.Text  = ds.Tables[0].Rows[0]["ProdCode"].ToString();
                            txtProdDesc.Text  = myFunc.GetStringValuesAgainstCodes("ProdCode", cmbProdCode.Text, "ProdDesc", "Vehicle");
                            cmbColorCode.Text = ds.Tables[0].Rows[0]["ColorCode"].ToString();
                            txtColorName.Text = myFunc.GetStringValuesAgainstCodes("ProdCode", cmbProdCode.Text, "Color", "Vehicle");

                            FillProduct(ds);
                        }
                        else
                        {
                            paramData[0].Value = txtEngNo.Text;
                            paramData[1].Value = "Y";


                            //ds = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(GlobalVar.mDataConnection, "sp_2W_Get_NewVehicleInfo_SDMS", paramData);



                            dt = myFunc.GetData("select * from customervehicle where EngineNo='" + txtEngNo.Text + "'");

                            ds.Tables.Add(dt);
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                txtChassisNo.Text = ds.Tables[0].Rows[0]["ChasisNo"].ToString();
                                cmbProdCode.Text  = ds.Tables[0].Rows[0]["ProdCode"].ToString();
                                txtProdDesc.Text  = ds.Tables[0].Rows[0]["ProdDesc"].ToString();
                                txtColorName.Text = ds.Tables[0].Rows[0]["ColorDesc"].ToString();
                                FillProduct(ds);
                                if (txtColorName.Text.Trim() == "NoColor")
                                {
                                    txtColorName.Text = "BLACK";
                                    cmbColorCode.Text = "00002";
                                }
                                else
                                {
                                    if (myFunc.CodeExists("Vehicle", "ProdCode='" + cmbProdCode.Text.Trim() + "' AND  Color='" + txtColorName.Text.Trim() + "'", ref ds))
                                    {
                                        cmbColorCode.Text = ds.Tables[0].Rows[0]["ColorCode"].ToString();
                                    }
                                }
                            }
                            else
                            {
                                lblMSG.Text = "Record Not found " + txtEngNo.Text;
                                PopupControlMSG.ShowOnPageLoad = true;
                            }
                        }

                        if (search_result == false)
                        {
                            paramData[0].Value = txtEngNo.Text;
                            paramData[1].Value = "N";
                            //ds = SqlHelper.ExecuteDataset(this.StrMCDMainDBCon, "sp_2W_Get_NewVehicleInfo_SDMS", paramData);
                            dt = myFunc.GetData("select * from customervehicle where EngineNo='" + txtEngNo.Text + "'");
                            ds.Tables.Add(dt);
                            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                            {
                                txtEngNo.ToolTip = txtEngNo.ToolTip + ds.Tables[0].Rows[i]["EngineNo"].ToString() + System.Environment.NewLine;
                            }
                        }
                        txtEngNo.Focus();
                    }
                }
            }
            catch (Exception ex) { throw ex; }
        }
        private void LoadGrid(string DCNumber, string PONumber, string DealerCode)
        {
            DataTable     dtParts = new DataTable();
            DataSet       ds      = new DataSet();
            DataSet       dsParts = new DataSet();
            SqlDataReader dr      = null;
            string        mPONo   = "";
            string        mDCNo   = "";

            if (PONumber == "")
            {
                mPONo = this.Session["PONumber"].ToString();
            }
            else
            {
                mPONo = PONumber;
            }
            //if (DCNumber == "")
            //{
            //    mDCNo = this.Session["DCNumber"].ToString();
            //}
            //else
            //{
            //    mDCNo = DCNumber;
            //}
            try
            {
                SqlParameter[] param =
                {
                    new SqlParameter("@DealerCode", SqlDbType.Char, 10),
                    new SqlParameter("@PONO",       SqlDbType.Char, 10)
                };

                param[0].Value = this.Session["DealerCode"].ToString();
                param[1].Value = mPONo;



                myFunc.ExecuteSP("Sp_2W_GetPO_ForDC", param, ref dr);
                dtParts.Load(dr);
                //ds = (DataSet)ViewState["ObjPOds"];
                ds = (DataSet)this.Session["DCDataSet"];
                ds.Tables["DCItems"].Rows.Clear();
                if (dtParts.Rows.Count != 0)
                {
                    foreach (DataRow dRow in dtParts.Rows)
                    {
                        SqlParameter[] paramPO_Parts =
                        {
                            new SqlParameter("@PONO",       SqlDbType.Char, 10),
                            new SqlParameter("@DealerCode", SqlDbType.Char, 10),
                            new SqlParameter("@ItemCode",   SqlDbType.Char, 10)
                        };

                        paramPO_Parts[0].Value = mPONo;
                        paramPO_Parts[1].Value = this.Session["DealerCode"].ToString();
                        paramPO_Parts[2].Value = dRow["ItemCode"].ToString();
                        dsParts = myFunc.FillDataSet("SP_Spare_Get_PartPOInfo", paramPO_Parts);

                        DataRow row = ds.Tables["DCItems"].NewRow();
                        row["Sno"] = ds.Tables["DCItems"].Rows.Count + 1;

                        row["PartItemNo"]      = myFunc.GetStringValuesAgainstCodes("ItemCode", paramPO_Parts[2].Value.ToString(), "PartItemNo", "Item");
                        row["PartItemName"]    = myFunc.GetStringValuesAgainstCodes("ItemCode", paramPO_Parts[2].Value.ToString(), "ItemDesc", "Item");
                        row["unit"]            = myFunc.GetStringValuesAgainstCodes("UnitCode='" + dRow["UnitCode"].ToString() + "'", "unit", "UnitDesc");
                        row["POQuantity"]      = dsParts.Tables[0].Rows[0]["POQty"].ToString();
                        row["BalanceQuantity"] = dsParts.Tables[0].Rows[0]["BalanceQty"].ToString();
                        if (DCNumber == "")
                        {
                            row["DCQuantity"] = dsParts.Tables[0].Rows[0]["BalanceQty"].ToString();
                        }
                        else
                        {
                            row["DCQuantity"] = myFunc.GetDCQty(DCNumber, dRow["ItemCode"].ToString());
                        }

                        row["Selected"] = true;

                        ds.Tables["DCItems"].Rows.Add(row);
                    }


                    //if (GridViewDC.VisibleRowCount > 0)
                    //{
                    //    CheckBox chkSelect;
                    //    TextBox txtDCQty;
                    //    Label lblBalQty;
                    //    foreach (GridViewRow gvr in GridViewDC.Rows)
                    //    {
                    //        chkSelect = (CheckBox)gvr.Cells[0].FindControl("ChkSelect");
                    //        txtDCQty = (TextBox)gvr.Cells[6].FindControl("txtDCQuantity");
                    //        lblBalQty = (Label)gvr.Cells[5].FindControl("LbBalanceQuantity");
                    //        chkSelect.Checked = true;
                    //        txtDCQty.Text = lblBalQty.Text;
                    //        //chkSelect.Enabled = false;
                    //    }
                    //}
                    //txtVendorNo.Text = dsVendorInfo.Tables[0].Rows[0]["vendorCode"].ToString();
                    //txtVendorDesc.Text = dsVendorInfo.Tables[0].Rows[0]["vendorDesc"].ToString();
                }
                Session["DCDataSet"]    = ds;
                GridViewDC.DataSource   = ds.Tables["DCItems"];
                GridViewDC.DataSourceID = null;
                GridViewDC.DataBind();
            }
            catch (Exception ex)
            {
                //ObjGeneral.UserMsg(LbErr, Color.Red, "Error: " + ex.Message, txtDCNo);
            }
        }
Esempio n. 8
0
        protected void lnkSelect_Click1(object sender, EventArgs e)
        {
            LinkButton  btnlnk = (LinkButton)sender;
            GridViewRow gvr    = (GridViewRow)btnlnk.Parent.Parent;

            LinkButton lnk = (LinkButton)gvr.FindControl("lnkRegNo");

            sysFun.FillDropDown(ddlProduct, "SELECT rtrim(ltrim(ProdCode)) as ProdCode ,ProdDesc FROM Vehicle Where DealerCode IN('" + Session["DealerCode"].ToString() + "', 'COMON') and VehicleCategory='" + Session["VehicleCategory"].ToString() + "' ", "ProdDesc", "ProdCode", "Select");
            sysFun.FillDropDown(ddlVersion, "SELECT Distinct  VersionCode,VersionDesc FROM Versions Where DealerCode IN('" + Session["DealerCode"].ToString() + "', 'COMON') ", "VersionDesc", "VersionCode", "Select");
            if (lnk.Text == "")
            {
                //clearData();
                return;
            }
            try
            {
                ddlProduct.Enabled = true;

                DataTable dt = new DataTable();

                string sql = "select * from CustomerVehicle where RegNo = '" + lnk.Text + "'";
                dt = sysFun.GetData(sql);


                if (dt.Rows[0]["InvoiceDate"].ToString().Trim() != "")
                {
                    DateTime InvoiceDate = (DateTime)dt.Rows[0]["InvoiceDate"];
                    txtInvDate.Text = InvoiceDate.ToString("dd-MM-yyyy");
                }

                if (dt.Rows[0]["tdDate"].ToString() != "")
                {
                    DateTime RegDate = (DateTime)dt.Rows[0]["tdDate"];
                    txtRegDate.Text = RegDate.ToString("dd-MM-yyyy");
                }

                if (dt.Rows[0]["DeliveryDate"].ToString() != "")
                {
                    DateTime DelDate = (DateTime)dt.Rows[0]["DeliveryDate"];
                    txtDeliveryDate.Text = DelDate.ToString("dd-MM-yyyy");
                }

                if (dt.Rows[0]["EndUserCode"].ToString() != "0" || dt.Rows[0]["EndUserCode"].ToString() != "")
                {
                    ddlAcctof.SelectedValue = dt.Rows[0]["EndUserCode"].ToString();
                    txtAccDesc.Text         = sysFuns.GetStringValuesAgainstCodes("CusCode='" + dt.Rows[0]["EndUserCode"].ToString() + "' and DealerCode='" + Session["DealerCode"].ToString() + "'", "Customer", "CusDesc");
                }
                ddlBrand.SelectedValue = dt.Rows[0]["BrandCode"].ToString();
                //LoadProductddl();
                ddlProduct.SelectedValue = dt.Rows[0]["ProdCode"].ToString().Trim();
                //loadVersionddl();
                ddlVersion.SelectedValue = dt.Rows[0]["VersionCode"].ToString();
                txtRegNo.Text            = dt.Rows[0]["RegNo"].ToString();
                txtEngineNo.Text         = dt.Rows[0]["EngineNo"].ToString();
                txtChassisNo.Text        = dt.Rows[0]["ChassisNo"].ToString();
                ddlColor.SelectedValue   = dt.Rows[0]["ColorCode"].ToString();
                txtInvoiceNo.Text        = dt.Rows[0]["InvoiceNo"].ToString();
                txtAccCode.Text          = dt.Rows[0]["EndUserCode"].ToString();
                txtCusVehCode.Text       = dt.Rows[0]["CusVehCode"].ToString();
                txtPolicyNo.Text         = dt.Rows[0]["InsPolicyNo"].ToString();
                txtWBNo.Text             = dt.Rows[0]["WorkbookNo"].ToString();
                txtCusCode.Text          = dt.Rows[0]["CusCode"].ToString();
                txtCusDesc.Text          = sysFuns.GetStringValuesAgainstCodes("CusCode='" + dt.Rows[0]["CusCode"].ToString() + "' and DealerCode='" + Session["DealerCode"].ToString() + "'", "Customer", "CusDesc");
                if (dt.Rows[0]["InsBranchCode"].ToString() != "")
                {
                    ddlInsCo.SelectedValue = dt.Rows[0]["InsBranchCode"].ToString();
                }
                else
                {
                    ddlInsCo.SelectedIndex = 0;
                }
                txtChassisNo.Enabled = false;
                txtEngineNo.Enabled  = false;
                txtRegNo.Enabled     = false;
                txtProdDesc.Text     = ddlBrand.SelectedItem.Text + "-" + ddlProduct.SelectedItem.Text + "-" + ddlVersion.SelectedItem.Text;
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.Message;
            }
        }
Esempio n. 9
0
        protected void btnShowReport_Click(object sender, EventArgs e)
        {
            if (dtFrom.Text == "" || dtTo.Text == "")
            {
                lblMSG.Text = "Please select dates";
                return;
            }
            SqlDataReader  rder;
            ReportDocument RD = new ReportDocument();
            DateTime       FromDate;
            DateTime       ToDate;

            string FDate = dtFrom.Date.ToString("yyyy/MM/dd");
            string TDate = dtTo.Date.ToString("yyyy/MM/dd");

            FromDate = Convert.ToDateTime(FDate);
            ToDate   = Convert.ToDateTime(TDate);

            //ReportDocument RD = new ReportDocument();
            DataSet dsRpt = new DataSet();

            DXBMS.Data.DataSet1 objDsReports = new Data.DataSet1();


            SqlParameter[] param =
            {
                new SqlParameter("@DealerCode", SqlDbType.Char, 5),               //0
                new SqlParameter("@FromDate",   SqlDbType.DateTime),              //0
                new SqlParameter("@ToDate",     SqlDbType.DateTime),              //0
            };
            param[0].Value = Session["DealerCode"].ToString();
            param[1].Value = FromDate.ToString("yyyy-MM-dd");
            param[2].Value = ToDate.ToString("yyyy-MM-dd");



            //if (myFunc.ExecuteSPDMIS("sp2W_Spare_InvoiceDetail", param, ref rder))
            //if(myFunc.ExecuteSP("sp2W_Spare_InvoiceDetail",param,ref rder))
            //{
            //    objDsReports.sp2W_Spare_InvoiceDetail.Load(rder);


            //}

            DataTable dt  = new DataTable();
            string    sql = "exec sp2W_Spare_InvoiceDetail '" + Session["DealerCode"].ToString() + "','" + FromDate.ToString("yyyy-MM-dd") + "','" + ToDate.ToString("yyyy-MM-dd") + "'";

            dt = myFunc.GetData(sql);
            RD.PrintOptions.PaperSize = PaperSize.PaperA4;


            //RD.Load(Server.MapPath("../../SpareReports/rptInvoices.rpt"));
            RD.Load(Server.MapPath("../rptInvoices.rpt"));
            RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Phone1", "Dealer") + "'";
            RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Email", "Dealer") + "'";

            RD.DataDefinition.FormulaFields["DealerName"].Text    = "'" + myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "DealerDesc", "Dealer") + "'";
            RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Address1", "Dealer") + "" +
                                                                    myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Address2", "Dealer") + "" +
                                                                    myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Address3", "Dealer") + " (" +
                                                                    myFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Phone1", "Dealer") + ") '";
            RD.DataDefinition.FormulaFields["UserID"].Text      = "'" + Session["UserID"].ToString() + "'";
            RD.DataDefinition.FormulaFields["FromCode"].Text    = "'" + FDate + "'";
            RD.DataDefinition.FormulaFields["ToCode"].Text      = "'" + TDate + "'";
            RD.DataDefinition.FormulaFields["Terminal"].Text    = "'" + Environment.MachineName + "'";
            RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "Invoice Detail Report" + "\"";
            RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'";
            RD.DataDefinition.FormulaFields["Pic"].Text         = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'";
            //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'";
            //RD.Database.Tables[0].SetDataSource(objDsReports);
            RD.Database.Tables[0].SetDataSource(dt);

            // convert and show
            string FilePath = Server.MapPath("~") + "\\Download\\";
            string FileName = "InvoicesList" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf";
            string File     = FilePath + FileName;

            RD.ExportToDisk(ExportFormatType.PortableDocFormat, File);

            string URL;

            URL = "../../../../Download/OpenPdf.aspx?FileName=" + FileName;
            string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');";

            ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
        }