private void SaveVoucherDetails() { BusinessLayer.Accounts.TrnDebitNoteHeader objDebitNote = new TrnDebitNoteHeader(); Entity.Accounts.TrnDebitNoteHeader DebitNote = new Entity.Accounts.TrnDebitNoteHeader(); DebitNote.DNHeaderID = DNHeaderID; DebitNote.CompanyID_FK = Convert.ToInt32(Session["CompanyId"].ToString().Trim()); DebitNote.FinYearID_FK = Convert.ToInt32(Session["FinYrID"].ToString().Trim()); DebitNote.BranchID_FK = Convert.ToInt32(Session["BranchId"].ToString().Trim()); DebitNote.DNVoucherDate = Convert.ToDateTime(txtVoucherDate.Text.Trim() + " 00:00:00"); DebitNote.SupplierLedgerID_FK = Convert.ToInt32(ddlSupplierLedger.SelectedValue.Trim()); DebitNote.TotalAmount = Convert.ToDecimal(txtTotalAmt.Text.Trim()); DebitNote.DNNarration = txtNarration.Text.Trim(); DebitNote.OperationBy = Convert.ToInt32(Session["UserId"].ToString().Trim()); DebitNote.XMLDebitNoteDetails = PrepareXMLString(); int RowsAffected = objDebitNote.Save(DebitNote); if (RowsAffected != -1) { PopulateHeaderGrid(); LoadDueBills(); txtNarration.Text = ""; DataTable DT = objDebitNote.GetAllById(DebitNote.DNHeaderID); txtVchNo.Text = DT.Rows[0]["DNVoucherNo"].ToString(); Message.IsSuccess = true; Message.Text = "Your request has been processed successfully!"; btnPrint.Attributes.Add("onclick", "javascript:openPopup('PrintDebitNote.aspx?id=" + DebitNote.DNHeaderID + "'); return false;"); } Message.Show = true; }
protected void dgvDebitNote_RowDeleting(object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(dgvDebitNote.DataKeys[e.RowIndex].Value.ToString()); BusinessLayer.Accounts.TrnDebitNoteHeader objDebitNote = new TrnDebitNoteHeader(); objDebitNote.Delete(id); PopulateHeaderGrid(); }
private void PopulateHeaderGrid() { int CompanyId = Convert.ToInt32(Session["CompanyId"].ToString().Trim()); int FinYrID = Convert.ToInt32(Session["FinYrID"].ToString().Trim()); int BranchId = Convert.ToInt32(Session["BranchId"].ToString().Trim()); string DNVoucherNo = txtVchNoSearch.Text.Trim(); string FromDate = txtVchDateSearch.Text.Trim(); string ToDate = txtVchDateSearchTo.Text.Trim(); BusinessLayer.Accounts.TrnDebitNoteHeader objDebitNote = new TrnDebitNoteHeader(); DataTable DT = objDebitNote.GetAll(CompanyId, FinYrID, BranchId, DNVoucherNo, FromDate, ToDate); if (DT != null) { dgvDebitNote.DataSource = DT; dgvDebitNote.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { clsGeneralFunctions gf = new clsGeneralFunctions(); char chr = Convert.ToChar(130); string strValues = ""; if (!IsPostBack) { if (Request.QueryString["id"] != null && Request.QueryString["id"].Trim().Length > 0) { BusinessLayer.Accounts.TrnDebitNoteHeader ObjTrnDebitNoteHeader = new TrnDebitNoteHeader(); int intID = Convert.ToInt32(Request.QueryString["id"].Trim()); strValues = Session["CompanyID"].ToString(); strValues += chr.ToString() + intID.ToString(); DataTable DT = ObjTrnDebitNoteHeader.GetAll(intID); dgvReceipt.DataSource = DT; dgvReceipt.DataBind(); string CommanyId = Session["CompanyId"].ToString(); //LoadDetails(ds1.Tables[0]); //LoadFooterRow(ds.Tables[0]); LoadFooterRow(DT); LoadHeader(DT); LoadSignature(); if (CommanyId == "2") { img.ImageUrl = "../Images/ReportHeader.png"; } else if (CommanyId == "4") { img.ImageUrl = "../Images/DiplomaHeader.jpg"; } else if (CommanyId == "1") { img.ImageUrl = "../Images/Management.png"; } } } }