private void BindGrid() { if (txtDateFrom.Text != "") { Query += " AND CONVERT(DATE,GR_Date)>='" + Convert.ToDateTime(txtDateFrom.Text.Trim(), cul).ToString("yyyy-MM-dd") + "'"; } if (txtDateTo.Text != "") { Query += " AND CONVERT(DATE,GR_Date)<='" + Convert.ToDateTime(txtDateTo.Text.Trim(), cul).ToString("yyyy-MM-dd") + "'"; } if (Convert.ToInt32(drpBaseCity.SelectedValue) > 0) { Query += " AND From_City=" + Convert.ToInt32(drpBaseCity.SelectedValue); } if (Convert.ToInt64(drpSenderName.SelectedValue) > 0) { Query += " AND Sender_Idno=" + Convert.ToInt64(drpSenderName.SelectedValue); } InvoiceRepDAL objDAL = new InvoiceRepDAL(); String Inv = txtInvoiceNo.Text; Int64 date = Convert.ToInt64(ddlDateRange.SelectedValue); Int64 city = Convert.ToInt64(drpBaseCity.SelectedValue); Int64 invIdno = objDAL.InvIdno(ApplicationFunction.ConnectionString(), date, city); PrintReport(date, city); }
private DataTable getInvoiceDetails(Int32 Inv_Idno) { string str = string.Empty; string str1 = string.Empty; string str2 = string.Empty; string str3 = string.Empty; string str4 = string.Empty; InvoiceRepDAL objclsInvoiceRepDAL = new InvoiceRepDAL(); DataTable lst = objclsInvoiceRepDAL.selectInvoiceReportDetails("SelectInvDet", Inv_Idno, ApplicationFunction.ConnectionString()); return(lst); }
private void BindCity(Int64 UserId) { BindDropdownDAL obj = new BindDropdownDAL(); var FrmCity = obj.BindCityUserWise(UserId); drpBaseCity.DataSource = FrmCity; drpBaseCity.DataTextField = "CityName"; drpBaseCity.DataValueField = "CityIdno"; drpBaseCity.DataBind(); objInvcDAL = null; drpBaseCity.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0")); }
private void BindSenderName() { InvoiceRepDAL obj = new InvoiceRepDAL(); var SenderName = obj.BindSender(); drpSenderName.DataSource = SenderName; drpSenderName.DataTextField = "Acnt_Name"; drpSenderName.DataValueField = "Acnt_Idno"; drpSenderName.DataBind(); objInvcDAL = null; drpSenderName.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0")); }
private void BindTruckNo() { BindDropdownDAL obj = new BindDropdownDAL(); var lst = obj.BindTruckNo(); ddlTruckNo.DataSource = lst; ddlTruckNo.DataTextField = "Lorry_No"; ddlTruckNo.DataValueField = "Lorry_Idno"; ddlTruckNo.DataBind(); objInvcDAL = null; ddlTruckNo.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0")); }
private void TotalRecords() { using (TransportMandiEntities db = new TransportMandiEntities(MultipleDBDAL.strDynamicConString())) { string UserClass = Convert.ToString(Session["Userclass"]); Int64 UserIdno = 0; if (UserClass != "Admin") { UserIdno = Convert.ToInt64(Session["UserIdno"]); } InvoiceRepDAL obj = new InvoiceRepDAL(); Int64 iInvTyp = (Convert.ToString(ddlInvType.SelectedValue) == "" ? 0 : Convert.ToInt64(ddlInvType.SelectedValue)); DataTable list1 = obj.SelectRep("SelectInvwiseRep", Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)), 0, 0, 0, UserIdno, iInvTyp, ApplicationFunction.ConnectionString()); lblTotalRecord.Text = "T. Record (s): " + Convert.ToString(list1.Rows.Count); } }
protected void lnkBtn_Click(object sender, EventArgs e) { InvoiceRepDAL objDAL = new InvoiceRepDAL(); if (string.IsNullOrEmpty(txtInvoiceNo.Text) == true) { ShowMessageErr("Please Enter Invoice NO.!"); return; } String Inv = txtInvoiceNo.Text; Int64 date = Convert.ToInt64(ddlDateRange.SelectedValue); Int64 city = Convert.ToInt64(drpBaseCity.SelectedValue); Int64 invIdno = objDAL.InvIdno(ApplicationFunction.ConnectionString(), Convert.ToInt64(Inv), date, city); PrintReport(invIdno, date, city); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "CallPrint('print')", true); }
private void BindGrid() { try { InvoiceRepDAL obj = new InvoiceRepDAL(); string userclass = Convert.ToString(Session["Userclass"]); Int64 UserIdno = 0; if (userclass != "Admin") { UserIdno = Convert.ToInt64(Session["UserIdno"]); } Int64 iFromCityIDNO = (Convert.ToString(drpBaseCity.SelectedValue) == "" ? 0 : Convert.ToInt64(drpBaseCity.SelectedValue)); Int64 iSenderIDNO = (Convert.ToString(drpSenderName.SelectedValue) == "" ? 0 : Convert.ToInt64(drpSenderName.SelectedValue)); Int32 iInvoiceNo = (Convert.ToString(txtInvoiceNo.Text) == "" ? 0 : Convert.ToInt32(txtInvoiceNo.Text)); Int64 iInvTyp = (Convert.ToString(ddlInvType.SelectedValue) == "" ? 0 : Convert.ToInt64(ddlInvType.SelectedValue)); string strAction = ""; if (ddlRepType.SelectedIndex == 0) { strAction = "SelectInvwiseRep"; } else { strAction = "SelectGrwiseRep"; } DataTable DsGrdetail = obj.SelectRep(strAction, Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)), iFromCityIDNO, iSenderIDNO, iInvoiceNo, UserIdno, iInvTyp, ApplicationFunction.ConnectionString()); if ((DsGrdetail != null) && (DsGrdetail.Rows.Count > 0)) { Int32 j = 0; Int32 GrIdno = 0; Int32 InvIdno = 0; if (ddlRepType.SelectedIndex == 1) { for (int k = 0; k < DsGrdetail.Rows.Count; k++) { GrIdno = Convert.ToInt32(DsGrdetail.Rows[k]["Gr_Idno"]); InvIdno = Convert.ToInt32(DsGrdetail.Rows[k]["ID"]); if (k == 0) { DsGrdetail.Rows[k]["Gross_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["Gross_Amnt"]); DsGrdetail.Rows[k]["Bilty_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["Bilty_Amnt"]); DsGrdetail.Rows[k]["Short_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["Short_Amnt"]); DsGrdetail.Rows[k]["ConsignrServTax"] = Convert.ToString(DsGrdetail.Rows[k]["ConsignrServTax"]); DsGrdetail.Rows[k]["TrServTax_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["TrServTax_Amnt"]); DsGrdetail.Rows[k]["Net_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["Net_Amnt"]); DsGrdetail.Rows[k]["Gr_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["Gr_Amnt"]); DsGrdetail.Rows[k]["Tot_Qty"] = Convert.ToString(DsGrdetail.Rows[k]["Tot_Qty"]); DsGrdetail.Rows[k]["Tot_Weght"] = Convert.ToString(DsGrdetail.Rows[k]["Tot_Weght"]); j++; } else { if (GrIdno == Convert.ToInt32(DsGrdetail.Rows[k - 1]["Gr_Idno"])) { DsGrdetail.Rows[k]["Gr_Amnt"] = ""; DsGrdetail.Rows[k]["Tot_Qty"] = ""; DsGrdetail.Rows[k]["Tot_Weght"] = ""; } else { j = 0; DsGrdetail.Rows[k]["Gr_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["Gr_Amnt"]); DsGrdetail.Rows[k]["Tot_Qty"] = Convert.ToString(DsGrdetail.Rows[k]["Tot_Qty"]); DsGrdetail.Rows[k]["Tot_Weght"] = Convert.ToString(DsGrdetail.Rows[k]["Tot_Weght"]); } if (InvIdno == Convert.ToInt32(DsGrdetail.Rows[k - 1]["ID"])) { DsGrdetail.Rows[k]["Gross_Amnt"] = ""; DsGrdetail.Rows[k]["Bilty_Amnt"] = ""; DsGrdetail.Rows[k]["Short_Amnt"] = ""; DsGrdetail.Rows[k]["ConsignrServTax"] = ""; DsGrdetail.Rows[k]["TrServTax_Amnt"] = ""; DsGrdetail.Rows[k]["Net_Amnt"] = ""; } else { j = 0; DsGrdetail.Rows[k]["Gross_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["Gross_Amnt"]); DsGrdetail.Rows[k]["Bilty_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["Bilty_Amnt"]); DsGrdetail.Rows[k]["Short_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["Short_Amnt"]); DsGrdetail.Rows[k]["ConsignrServTax"] = Convert.ToString(DsGrdetail.Rows[k]["ConsignrServTax"]); DsGrdetail.Rows[k]["TrServTax_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["TrServTax_Amnt"]); DsGrdetail.Rows[k]["Net_Amnt"] = Convert.ToString(DsGrdetail.Rows[k]["Net_Amnt"]); } } } } ViewState["dtCSV"] = DsGrdetail; grdMain.DataSource = DsGrdetail; grdMain.DataBind(); ShowHideColumns(); Double TotalNetAmount = 0, TotGrossAmnt = 0, TotBilAmnt = 0, TotShrtAmnt = 0, TotConServTax = 0, ToTrServTax = 0; for (int i = 0; i < DsGrdetail.Rows.Count; i++) { TotGrossAmnt += Convert.ToDouble(string.IsNullOrEmpty(Convert.ToString(DsGrdetail.Rows[i]["Gross_Amnt"])) ? "0" : DsGrdetail.Rows[i]["Gross_Amnt"].ToString()); TotBilAmnt += Convert.ToDouble(string.IsNullOrEmpty(Convert.ToString(DsGrdetail.Rows[i]["Bilty_Amnt"])) ? "0" : DsGrdetail.Rows[i]["Bilty_Amnt"].ToString()); TotShrtAmnt += Convert.ToDouble(string.IsNullOrEmpty(Convert.ToString(DsGrdetail.Rows[i]["Short_Amnt"])) ? "0" : DsGrdetail.Rows[i]["Short_Amnt"].ToString()); TotConServTax += Convert.ToDouble(string.IsNullOrEmpty(Convert.ToString(DsGrdetail.Rows[i]["ConsignrServTax"])) ? "0" : DsGrdetail.Rows[i]["ConsignrServTax"].ToString()); ToTrServTax += Convert.ToDouble(string.IsNullOrEmpty(Convert.ToString(DsGrdetail.Rows[i]["TrServTax_Amnt"])) ? "0" : DsGrdetail.Rows[i]["TrServTax_Amnt"].ToString()); TotalNetAmount += Convert.ToDouble(string.IsNullOrEmpty(Convert.ToString(DsGrdetail.Rows[i]["Net_Amnt"])) ? "0" : DsGrdetail.Rows[i]["Net_Amnt"].ToString()); } lblGrossAmnt.Text = TotGrossAmnt.ToString("N2"); lblBilAmnt.Text = TotBilAmnt.ToString("N2"); lblShrtAmnt.Text = TotShrtAmnt.ToString("N2"); lblConServtax.Text = TotConServTax.ToString("N2"); lblTrServTax.Text = ToTrServTax.ToString("N2"); lblNetTotalAmount.Text = TotalNetAmount.ToString("N2"); int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1; int lastRowOnPage = startRowOnPage + grdMain.Rows.Count - 1; lblcontant.Text = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + DsGrdetail.Rows.Count.ToString(); lblcontant.Visible = true; imgBtnExcel.Visible = true; if (Convert.ToInt32(hidPrintType.Value) == 7) { lnkBtn.Visible = true; } else { lnkBtn.Visible = false; } divpaging.Visible = true; lblTotalRecord.Text = "T. Record(s): " + DsGrdetail.Rows.Count; if (ddlRepType.SelectedIndex == 0) { foreach (DataControlField col in grdMain.Columns) { if ((col.HeaderText == "Gr No.") || (col.HeaderText == "Gr Date") || (col.HeaderText == "Qty") || (col.HeaderText == "Weight") || (col.HeaderText == "Gr Amnt") || (col.HeaderText == "Chln No") || (col.HeaderText == "Gr Shrtg Amnt") || (col.HeaderText == "Lorry No.")) { col.Visible = false; } } } else { foreach (DataControlField col in grdMain.Columns) { if ((col.HeaderText == "Gr No.") || (col.HeaderText == "Gr Date") || (col.HeaderText == "Qty") || (col.HeaderText == "Weight") || (col.HeaderText == "Gr Amnt") || (col.HeaderText == "Chln No") || (col.HeaderText == "Gr Shrtg Amnt") || (col.HeaderText == "Lorry No.")) { col.Visible = true; } } } } else { ViewState["dtCSV"] = null; grdMain.DataSource = null; grdMain.DataBind(); //printRep.Visible = false; imgBtnExcel.Visible = false; lnkBtn.Visible = false; lblTotalRecord.Text = "Total Record (s): 0 "; lblcontant.Visible = false; divpaging.Visible = false; } } catch (Exception Ex) { throw (Ex); } }