public void getdata() { sdocno = Txtdocno.Text.Trim(); DocNo = Convert.ToInt32(sdocno); //string from = txtfromDate.Text.Split('/')[2] + "/" + txtfromDate.Text.Split('/')[1] + "/" + txtfromDate.Text.Split('/')[0]; //string To = txttoDate.Text.Split('/')[2] + "/" + txttoDate.Text.Split('/')[1] + "/" + txttoDate.Text.Split('/')[0]; //fdate = Convert.ToDateTime(from); //tdate = Convert.ToDateTime(To); //if (fdate > tdate) //{ // MessageBox("From Date is Greater than ToDate"); // txtfromDate.Focus(); //} //else DataTable dt = new DataTable(); //dt = Books.Get_Bookwise_summary(fdate, tdate).Tables[0]; dt = DNDetail.RepGetDN(DocNo, Convert.ToInt32(strFY)).Tables[0]; if (dt.Rows.Count > 0) { ReportDocument CR = new ReportDocument(); CR.Load(Server.MapPath("Report/PrintDN.rpt")); CrptDN.SeparatePages = false; CR.SetDataSource(dt); CrptDN.ReportSource = CR; } else { MessageBox("No Records Found"); Txtdocno.Focus(); } }
public void SaveDNDetails() { if (Session["UserName"] != null) { try { DNDetail objdnd = new DNDetail(); DNMID1 = LblDNMasterID.Text.Trim(); foreach (GridViewRow Row in GrdDN.Rows) { //objdnd.DNDetailID = Convert.ToInt32(((Label)Row.FindControl("LblDNDID")).Text.Trim()); //objdnd.DNMasterID = Convert.ToInt32(((Label)Row.FindControl("LblDNMID")).Text.Trim()); DNDID1 = ((Label)Row.FindControl("LblDNDID")).Text.Trim(); DNDID = Convert.ToInt32(DNDID1); objdnd.DNDetailID = DNDID; objdnd.DNMasterID = Convert.ToInt32(DNMID1); objdnd.AccountCode = ((Label)Row.FindControl("LblAcode")).Text.Trim(); dramt = ((TextBox)Row.FindControl("TxtDebit")).Text.Trim(); cramt = ((TextBox)Row.FindControl("TxtCredit")).Text.Trim(); objdnd.CreditAmount = Convert.ToDecimal(cramt); objdnd.DebitAmount = Convert.ToDecimal(dramt); objdnd.Remarks = ((TextBox)Row.FindControl("TxtCmmt")).Text.Trim(); objdnd.IsActive = true; objdnd.UpdatedBy = Session["UserName"].ToString(); objdnd.strFY = Convert.ToInt32(strFY); if (DNDID > 0) { objdnd.UpdatedBy = Session["UserName"].ToString(); } else { objdnd.CreatedBy = Session["UserName"].ToString(); } objdnd.Save(); } //objjvd.AccountCode = txtAccode.Text.Trim(); //objjvd.ReportCode = txtreportcode.Text.Trim(); //objjvd.CreditAmount = Convert.ToInt32(Txtcreditamt.Text.Trim()); //objjvd.DebitAmount = Convert.ToInt32(Txtdebitamt.Text.Trim()); //objjvd.Remarks = TxtComment.Text.Trim(); //MessageBox("Record saved successfully"); } catch { } } }
protected void GrdDN_RowDeleting(object sender, GridViewDeleteEventArgs e) { DataTable dt2 = new DataTable(); dt2 = (DataTable)Session["tempDNData"]; DNDetail objdnd1 = new DNDetail(); int dndid = Convert.ToInt32(((Label)GrdDN.Rows[e.RowIndex].FindControl("LblDNDID")).Text.Trim()); if (dndid != 0) { objdnd1.Flag = "DNDetail"; objdnd1.ID = dndid; objdnd1.IsActive = false; objdnd1.IsDeleted = true; objdnd1.deleteDNRec(); } else { } dt2.Rows[e.RowIndex].Delete(); GrdDN.DataSource = dt2; GrdDN.DataBind(); Session["tempDNData"] = dt2; if (dt2.Rows.Count == 0) { btnSave.Visible = false; } else { btnSave.Visible = true; } }
protected void Txtdocno_TextChanged(object sender, EventArgs e) { //string DocNost = Txtdocno.Text.Trim(); int DocNo1 = Convert.ToInt32(Txtdocno.Text.Trim()); int strFY1 = Convert.ToInt32(strFY); DataTable dt1 = new DataTable(); dt1 = DNDetail.GetDN(DocNo1, strFY1).Tables[2]; DataTable dt11 = new DataTable(); dt11 = DNDetail.GetDN(DocNo1, strFY1).Tables[0]; if ((dt1.Rows.Count != 0) && (dt1.Rows.Count != 0)) { //TxtCmpycode.Text = ""; //TxtBookcode.Text = ""; //LblBookName.Text = ""; //Txtdocno.Text = ""; TxtdocDate.Text = Convert.ToString(dt11.Rows[0]["DNDocDate"]); LblDNMasterID.Text = Convert.ToString(dt11.Rows[0]["DNMasterID"]); txtDNAccode.Text = Convert.ToString(dt11.Rows[0]["DNAccountCode"]); lblDNacname.Text = Convert.ToString(dt11.Rows[0]["DNAccountName"]); GrdDN.DataSource = dt1; GrdDN.DataBind(); btnSave.Visible = true; Session["tempDNData"] = dt1; } else { MessageBox("Invalid Document No."); TxtdocDate.Text = DateTime.Now.ToString("dd/MM/yyyy"); GrdDN.DataSource = DNDetail.GetDN(DocNo1, strFY1).Tables[2]; GrdDN.DataBind(); } }