protected void RepDetailsConfirm_ItemDataBound(object sender, RepeaterItemEventArgs e) { TextBox txtFright = null; TextBox txttax = null; Label lbltotalamt = null; Label lbltotalAmtget = null; txtFright = (TextBox)e.Item.FindControl("txtfrieght"); txttax = (TextBox)e.Item.FindControl("txttax"); lbltotalamt = (Label)e.Item.FindControl("lbltotalamt"); lbltotalAmtJS = (Label)e.Item.FindControl("lbltotalAmtJS"); Label SubConfirmID = (Label)e.Item.FindControl("SubConfirmID"); GridView grdView = (GridView)e.Item.FindControl("grdapproval"); if (ViewState["staticDS"] != null) { stDS = (DataSet)ViewState["staticDS"]; } else { stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "confirmed", Convert.ToInt32(strFY)); ViewState["staticDS"] = stDS; } DataView dv = new DataView(stDS.Tables[1]); dv.RowFilter = "SubConfirmID = " + SubConfirmID.Text.Trim(); grdView.DataSource = dv; grdView.DataBind(); int ID = Convert.ToInt32(stDS.Tables[2].Rows[0]["CustID"]); lblempname1.InnerHtml = Convert.ToString(stDS.Tables[2].Rows[0]["FirstName"]) + " " + Convert.ToString(stDS.Tables[2].Rows[0]["LastName"]) + " "; lblcustname.InnerHtml = " " + Convert.ToString(stDS.Tables[2].Rows[0]["CustDetails"]); ViewState["cname"] = Convert.ToString(stDS.Tables[2].Rows[0]["CustDetails"]); lblEmail.Text = Convert.ToString(stDS.Tables[2].Rows[0]["Email"]); lblMobNo.Text = Convert.ToString(stDS.Tables[2].Rows[0]["mobNo"]); ((TextBox)e.Item.FindControl("txtdateabc")).Text = DateTime.Now.ToString("dd/MM/yyyy"); txtfrieght.Text = "0"; txttax.Text = "0"; ((Label)e.Item.FindControl("LblRemark")).Text = stDS.Tables[2].Rows[0]["Remark"].ToString(); ((Label)e.Item.FindControl("lblCustId1")).Text = stDS.Tables[2].Rows[0]["CustId"].ToString(); //Updated By Rupesh 17/10/2014 ((TextBox)e.Item.FindControl("txtbundles")).Text = stDS.Tables[1].Rows[0]["Bundles"].ToString(); // DataSet ds7 = G_GetPass.CustEMail_LocalEntry(ID); ViewState["SEmailid"] = Convert.ToString(ds7.Tables[0].Rows[0]["SEmailID"]); lbltotalamt.Text = tamount.Text.ToString(); if (stDS.Tables[2].Rows.Count > 0) { ((TextBox)e.Item.FindControl("lbltransporter")).Text = stDS.Tables[2].Rows[0]["Transporter"].ToString(); } lbltotalAmtJS.Text = tamount.Text.ToString(); txtfrieght.Attributes.Add("onkeyup", "sumCharges('" + txtfrieght.ClientID + "','" + txttax.ClientID + "','" + lbltotalAmtJS.ClientID + "','" + lbltotalamt.ClientID + "')"); txttax.Attributes.Add("onkeyup", "sumCharges('" + txtfrieght.ClientID + "','" + txttax.ClientID + "','" + lbltotalAmtJS.ClientID + "','" + lbltotalamt.ClientID + "')"); }
protected void btnget_Click(object sender, EventArgs e) { stDS = new DataSet(); docno.InnerHtml = txtDocno.Text.Trim(); stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "Edit", Convert.ToInt32(strFY)); RepDetailsConfirm.DataSource = stDS.Tables[0]; RepDetailsConfirm.DataBind(); lblmessage.InnerHtml = ""; //pnldetails.Visible = true; // updategenerate.Update(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["ChetanaCompanyName"] != "" || Session["ChetanaCompanyName"] != null) { if (Session["FY"] != "" || Session["FY"] != null) { strChetanaCompanyName = Session["ChetanaCompanyName"].ToString(); strFY = Session["FY"].ToString(); } else { Session.Clear(); } } if (!Page.IsPostBack) { ViewState["cname"] = null; SMSSend.Text = "NO"; if (ConfigurationManager.AppSettings["SMS_INV_SEND"] != null) { SMSSend.Text = ConfigurationManager.AppSettings["SMS_INV_SEND"].ToString(); } Session["saved"] = null; docno.InnerHtml = "Not Selected"; if (Request.QueryString["c"] != null) { //Rptrpending.DataSource = DCMaster.Get_ApprovedDocNo(Convert.ToInt32(strFY)); DataView dv = new DataView(DCMaster.Get_ApprovedDocNo(Convert.ToInt32(strFY)).Tables[0]); dv.RowFilter = "CustomerId = " + Request.QueryString["c"].ToString(); Rptrpending.DataSource = dv.ToTable(); Rptrpending.DataBind(); if (Request.QueryString["d"] != null) { try { stDS = new DataSet(); docno.InnerHtml = Request.QueryString["d"].ToString().Trim(); stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(Request.QueryString["d"].ToString()), "confirmed", Convert.ToInt32(strFY)); ViewState["staticDS"] = stDS; RepDetailsConfirm.DataSource = stDS.Tables[0]; RepDetailsConfirm.DataBind(); lblmessage.InnerHtml = ""; } catch (Exception ex) { } } } } }
protected void btnget_Click(object sender, EventArgs e) { stDS = new DataSet(); docno.InnerHtml = txtDocno.Text.Trim(); stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "confirmed", Convert.ToInt32(strFY)); ViewState["staticDS"] = stDS; RepDetailsConfirm.DataSource = stDS.Tables[0]; RepDetailsConfirm.DataBind(); lblmessage.InnerHtml = ""; }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["d"] != null && Request.QueryString["sd"] != null) { DataSet ds = new DataSet(); ds = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(Request.QueryString["d"].ToString().Trim()), "approved"); DataView dv = new DataView(ds.Tables[1]); dv.RowFilter = "SubConfirmID =" + Request.QueryString["sd"].ToString().Trim(); // DocumentNo.InnerHtml = ds.Tables[1].Rows[0]["DocumentNo"].ToString(); orderno.InnerHtml = ds.Tables[2].Rows[0]["OrderNo"].ToString(); Todaydate.InnerHtml = DateTime.Now.ToString("dd/MM/yyyy"); Subconfirmid.InnerHtml = Request.QueryString["sd"].ToString(); custname.InnerHtml = ds.Tables[2].Rows[0]["CustName"].ToString() + ","; custadd.InnerHtml = ds.Tables[2].Rows[0]["Address"].ToString().Replace(",", ",<br/>") + " </br> " + ds.Tables[2].Rows[0]["City"].ToString() + ", " + ds.Tables[2].Rows[0]["State1"].ToString(); spnaddress.InnerHtml = ds.Tables[2].Rows[0]["Zip"].ToString(); lblpersonincharge.InnerHtml = ds.Tables[2].Rows[0]["PIncharge"].ToString(); // lbldate.InnerHtml = ds.Tables[2].Rows[0]["PIncharge"].ToString() ; LBLBUNDLES.InnerHtml = ds.Tables[1].Rows[0]["Bundles"].ToString(); lbltransporter.InnerHtml = ds.Tables[1].Rows[0]["Transporter"].ToString(); lrno.InnerHtml = ds.Tables[1].Rows[0]["LRNo"].ToString(); grdapproval.DataSource = dv; grdapproval.DataBind(); DataView dv1 = new DataView(ds.Tables[3]); dv1.RowFilter = "SubConfirmID = " + Request.QueryString["sd"].ToString().Trim(); if (dv1.Count > 0) { lblfreight.InnerHtml = dv1[0].Row["Freight"].ToString(); lbltax.InnerHtml = dv1[0].Row["Tax"].ToString(); decimal frt = Convert.ToDecimal(dv1[0].Row["Freight"].ToString()); decimal tx = Convert.ToDecimal(dv1[0].Row["Tax"].ToString()); tamt = frt + tx + totalamount; Lbltotalamt.InnerHtml = tamt.ToString(); } else { lblfreight.InnerHtml = "0"; lbltax.InnerHtml = "0"; Lbltotalamt.InnerHtml = totalamount.ToString(); } DataSet ds1 = new DataSet(); ds1 = ActualInvoiceDetails.GetConvertion_fromnumber(tamt); lblrupees.InnerHtml = ds1.Tables[0].Rows[0][0].ToString() + " Only"; } }
protected void grdapproval_RowDeleting(object sender, GridViewDeleteEventArgs e) { // Repeater objrep = ((Repeater)this.FindControl("RepDetailsConfirm")); // RepeaterCommandEventArgs s = (RepeaterCommandEventArgs)(e); // decimal subdoc = Convert.ToDecimal((s.CommandArgument.ToString().Trim())); GridView objgrid1 = (GridView)(sender); ActualInvoiceDetails _objinvoice = new ActualInvoiceDetails(); invoiceId = Convert.ToInt32(((Label)objgrid1.Rows[e.RowIndex].FindControl("lblgenerateinvoiceid")).Text); try { if (invoiceId != 0) { _objinvoice.GanerateinvoiceId = invoiceId; _objinvoice.IsActive = false; _objinvoice.IsDeleted = true; _objinvoice.SubDocId = Convert.ToDecimal(((Label)objgrid1.Parent.FindControl("SubConfirmID")).Text); decimal amt1 = Convert.ToDecimal(((Label)objgrid1.Rows[e.RowIndex].FindControl("lblamt")).Text); decimal amount1 = Convert.ToDecimal(((Label)objgrid1.Parent.FindControl("lblallTotalamt")).Text); decimal tamount1 = amount1 - amt1; _objinvoice.TotalAmount = tamount1; _objinvoice.FinancialYearFrom = strFY.ToString(); if (objgrid1.Rows.Count == 1) { _objinvoice.flag = "DeleteInvoice" + "!" + Session["UserName"].ToString(); } else { _objinvoice.flag = "invoice"; } _objinvoice.DeleteActual_InvoiceDetails(1); } stDS = new DataSet(); docno.InnerHtml = txtDocno.Text.Trim(); stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "Edit", Convert.ToInt32(strFY)); RepDetailsConfirm.DataSource = stDS.Tables[0]; RepDetailsConfirm.DataBind(); } catch { } }
protected void btnget_Click(object sender, EventArgs e) { stDS = new DataSet(); docno.InnerHtml = txtDocno.Text.Trim(); stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "confirmed", Convert.ToInt32(strFY)); ViewState["staticDS"] = stDS; RepDetailsConfirm.DataSource = stDS.Tables[0]; RepDetailsConfirm.DataBind(); lblmessage.InnerHtml = ""; // ((TextBox)((Button)(sender)).Parent.FindControl("txtfrieght")).Text = "0"; // ((TextBox)((Button)(sender)).Parent.FindControl("txttax")).Text = "0"; // ((Label)((Button)(sender)).Parent.FindControl("lbltotalamt")).Text = tamount.ToString(); // ((TextBox)RepDetailsConfirm.FindControl("txtfrieght")).Text = "0"; // RepDetailsConfirm.F //(Label)e.Row.Parent.Parent.Parent.FindControl("lbltotalAmtget"); }
protected void img01_Click(object sender, ImageClickEventArgs e) { ImageButton img = (ImageButton)(sender); if (img.CommandName.ToLower() == "p") { grdconfirm.DataSource = DCDetails.Idv_Get_DCDetails_By_DocNo(Convert.ToInt32(img.CommandArgument.Trim()), "helpdesk", Convert.ToInt32(0)).Tables[1]; grdconfirm.DataBind(); ModalPopUpDocNum.Show(); UpdatePanel7.Update(); } else { stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(img.CommandArgument.Trim()), "helpdesk", Convert.ToInt32(0)); RepDetailsApprove.DataSource = stDS.Tables[0]; RepDetailsApprove.DataBind(); ModalPopupExtender1.Show(); UpdatePanel8.Update(); } }
protected void btnget_Click(object sender, EventArgs e) { stDS = new DataSet(); pnlDetails.Visible = true; docno.InnerHtml = txtDocno.Text.Trim(); stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "approved", Convert.ToInt32(strFY)); RepDetailsApprove.DataSource = stDS.Tables[0]; RepDetailsApprove.DataBind(); // ((Label)((Button)(sender)).Parent.FindControl("lblfright")).Text = (stDS.Tables[1].Rows[0]["Freight"]).ToString(); // ((Label)((Button)(sender)).Parent.FindControl("lbltax")).Text = (stDS.Tables[1].Rows[0]["Tax"]).ToString(); // ((Label)((Button)(sender)).Parent.FindControl("lbltotalamt")).Text = (stDS.Tables[1].Rows[0]["TotalAmount"]).ToString(); string jv = ""; if (RepDetailsApprove.Items.Count <= 0) { jv = "document.getElementById('ctl00_ContentPlaceHolder1_uc_Print_Invoice1_btnapproval').style.display='none';"; } else { jv = "document.getElementById('ctl00_ContentPlaceHolder1_uc_Print_Invoice1_btnapproval').style.display='block';"; } ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "a", jv, true); }
protected void RepDetailsConfirm_ItemCommand(object source, RepeaterCommandEventArgs e) { { bool Auth = DCMaster.Get_DocumentNum_Authentication(Convert.ToInt32(txtDocno.Text), Convert.ToInt32(strFY)); if (Auth) { MessageBox("Document no is not available"); txtDocno.Focus(); } else { // DCConfirmQtyDetails _objDCConfirmQtyDetails = new DCConfirmQtyDetails(); // DCMaster _objDCMaster = new DCMaster(); DCConfirmQtyDetails _objDCFT = new DCConfirmQtyDetails(); // ActualInvoiceDetails _objactualinvoice = new ActualInvoiceDetails(); Other_Z.ActualInvoice_Details.ActualInvoice_DetailsProp _objactualinvoice = new Other_Z.ActualInvoice_Details.ActualInvoice_DetailsProp(); Other_Z.ActualInvoice_Details ObjBal = new Other_Z.ActualInvoice_Details(); try { #region ActulInvoice Repeater objrep = (Repeater)this.FindControl("RepDetailsConfirm"); GridView objgrid = (GridView)objrep.Items[e.Item.ItemIndex].FindControl("grdapproval"); foreach (GridViewRow row in objgrid.Rows) { _objactualinvoice.GanerateinvoiceId = Convert.ToInt32(((Label)row.FindControl("lblgenerateinvoiceid")).Text); _objactualinvoice.DocumentNo = Convert.ToInt32(txtDocno.Text); _objactualinvoice.SubDocId = Convert.ToDecimal(e.CommandArgument.ToString().Trim()); _objactualinvoice.BookCode = ((Label)row.FindControl("lblbookC")).Text; _objactualinvoice.BookName = ((Label)row.FindControl("lblbookN")).Text; _objactualinvoice.Standard = ((Label)row.FindControl("lblStandard")).Text; _objactualinvoice.Medium = ((Label)row.FindControl("lblMedium")).Text; _objactualinvoice.Rate = Convert.ToDecimal(((TextBox)row.FindControl("txtrate")).Text); _objactualinvoice.Quantity = Convert.ToInt32(((TextBox)row.FindControl("lblqunty")).Text); _objactualinvoice.Discount = Convert.ToDecimal(((TextBox)row.FindControl("txtdiscount")).Text); _objactualinvoice.Amount = Convert.ToInt32(((Label)row.FindControl("lblAqty")).Text) * (Convert.ToDecimal(((TextBox)row.FindControl("txtrate")).Text) - (Convert.ToDecimal(((TextBox)row.FindControl("txtrate")).Text) * Convert.ToDecimal(((TextBox)row.FindControl("txtdiscount")).Text) / 100)); // _objactualinvoice.Amount = Convert.ToDecimal(((Label)row.FindControl("lblamt")).Text); _objactualinvoice.Freight = Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text); _objactualinvoice.Tax = Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text); _objactualinvoice.Transporter = (((TextBox)e.Item.FindControl("lbltransporter")).Text); _objactualinvoice.LRNo = (((TextBox)e.Item.FindControl("txtlrno")).Text); // _objactualinvoice.TotalAmount = Convert.ToDecimal(((Label)e.Item.FindControl("lbltotalAmtget")).Text); // Finalamount = Convert.ToDecimal(((Label)row.FindControl("lblTotalAmt")).Text); _objactualinvoice.TotalAmount = Convert.ToDecimal(getTotalValues(objgrid).ToString()) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text); _objactualinvoice.Bundles = (((TextBox)e.Item.FindControl("txtbundles")).Text); _objactualinvoice.CreatedBy = Convert.ToString(Session["UserName"]); _objactualinvoice.FinancialYearFrom = strFY; _objactualinvoice.HSNCode = ((Label)row.FindControl("lblHsnCode")).Text; _objactualinvoice.GSTPer = Convert.ToDecimal(((Label)row.FindControl("lblGstPer")).Text); _objactualinvoice.Typ = e.CommandName == "GSTInvoice" ? "G" : "N"; _objactualinvoice.GSTAmt = Convert.ToDecimal(_objactualinvoice.Amount * _objactualinvoice.GSTPer / 100); TextBox txtIdate1 = ((TextBox)e.Item.FindControl("txtdateabc")); TextBox txtLrdate1 = ((TextBox)e.Item.FindControl("txtlrdate")); _objactualinvoice.IsActive = true; _objactualinvoice.IsDeleted = false; string date1; string lrdate; if (txtIdate1.Text == "") { date1 = "1/1/2001"; } else { date1 = txtIdate1.Text.Split('/')[1] + "/" + txtIdate1.Text.Split('/')[0] + "/" + txtIdate1.Text.Split('/')[2]; } if (txtLrdate1.Text == "") { lrdate = "1/1/2001"; } else { lrdate = txtLrdate1.Text.Split('/')[1] + "/" + txtLrdate1.Text.Split('/')[0] + "/" + txtLrdate1.Text.Split('/')[2]; } _objactualinvoice.InvoiceDate = Convert.ToDateTime(date1); _objactualinvoice.LRDate = Convert.ToDateTime(lrdate); _objactualinvoice.Remark1 = ""; _objactualinvoice.Remark2 = ""; _objactualinvoice.Remark3 = ""; // _objactualinvoice.SaveActual_InvoiceDetails(1); ObjBal.SaveActualInvoiceDetails(_objactualinvoice); // (TextBox)e.Item.FindControl("txtfrieght"); } #endregion #region InvoiceCreate decimal subconfirmdoc = Convert.ToDecimal(e.CommandArgument.ToString().Trim()); // Save Freight and tax Details frieght = Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text); tax = Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text); temp = tamount + frieght + tax; // totalamount = tamount; _objDCFT.Auto_ID = Convert.ToInt32(((Label)e.Item.FindControl("Lblautoid")).Text); _objDCFT.DocumentNo = Convert.ToInt32(txtDocno.Text); _objDCFT.SubDocNo = subconfirmdoc; _objDCFT.Freight = Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text); _objDCFT.Tax = Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text); _objDCFT.TotalAmount = Convert.ToDecimal(((Label)e.Item.FindControl("lblallTotalamt")).Text); _objDCFT.LRNo = (((TextBox)e.Item.FindControl("txtlrno")).Text); TextBox txtIdate = ((TextBox)e.Item.FindControl("txtdateabc")); string date; if (txtIdate.Text == "") { date = "1/1/2001"; } else { date = txtIdate.Text.Split('/')[1] + "/" + txtIdate.Text.Split('/')[0] + "/" + txtIdate.Text.Split('/')[2]; } _objDCFT.InvoiceDate = Convert.ToDateTime(date); _objDCFT.AvailableQty = Convert.ToInt32(strFY); _objDCFT.Save_FrightTax_Details(1); // _objDCConfirmQtyDetails.SaveConfirmDetails(); stDS = new DataSet(); docno.InnerHtml = txtDocno.Text.Trim(); // stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "confirmed",Convert.ToInt32(strFY)); // RepDetailsConfirm.DataSource = stDS.Tables[0]; // RepDetailsConfirm.DataBind(); #endregion MessageBox("Invoice Updated successfully " + subconfirmdoc); lblmessage.InnerHtml = "Last updated Invoice no. : " + subconfirmdoc; stDS = new DataSet(); docno.InnerHtml = txtDocno.Text.Trim(); stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "Edit", Convert.ToInt32(strFY)); RepDetailsConfirm.DataSource = stDS.Tables[0]; RepDetailsConfirm.DataBind(); } catch (Exception ex) { MessageBox(ex.Message.ToString()); } } } }
protected void RepDetailsConfirm_ItemCommand(object source, RepeaterCommandEventArgs e) { if (Session["saved"] == null) { Session["saved"] = "s"; } if (Session["saved"].ToString() != e.CommandArgument.ToString().Trim()) { //if (e.CommandName == "AddToCart") { bool Auth = DCMaster.Get_DocumentNum_Authentication(Convert.ToInt32(txtDocno.Text), Convert.ToInt32(strFY)); if (Auth) { MessageBox("Document no is not available"); txtDocno.Focus(); } else { DCConfirmQtyDetails _objDCConfirmQtyDetails = new DCConfirmQtyDetails(); DCMaster _objDCMaster = new DCMaster(); DCConfirmQtyDetails _objDCFT = new DCConfirmQtyDetails(); ActualInvoiceDetails _objactualinvoice = new ActualInvoiceDetails(); try { #region ActulInvoice Repeater objrep = (Repeater)this.FindControl("RepDetailsConfirm"); GridView objgrid = (GridView)objrep.Items[e.Item.ItemIndex].FindControl("grdapproval"); foreach (GridViewRow row in objgrid.Rows) { _objactualinvoice.DocumentNo = Convert.ToInt32(txtDocno.Text); _objactualinvoice.SubDocId = Convert.ToDecimal(e.CommandArgument.ToString().Trim()); _objactualinvoice.BookCode = ((Label)row.FindControl("lblbookC")).Text; _objactualinvoice.BookName = ((Label)row.FindControl("lblbookN")).Text; _objactualinvoice.Standard = ((Label)row.FindControl("lblStandard")).Text; _objactualinvoice.Medium = ((Label)row.FindControl("lblMedium")).Text; _objactualinvoice.Rate = Convert.ToDecimal(((TextBox)row.FindControl("txtrate")).Text); _objactualinvoice.Quantity = Convert.ToInt32(((Label)row.FindControl("lblAqty")).Text); _objactualinvoice.Discount = Convert.ToDecimal(((TextBox)row.FindControl("txtdiscount")).Text); _objactualinvoice.Amount = Convert.ToInt32(((Label)row.FindControl("lblAqty")).Text) * (Convert.ToDecimal(((TextBox)row.FindControl("txtrate")).Text) - (Convert.ToDecimal(((TextBox)row.FindControl("txtrate")).Text) * Convert.ToDecimal(((TextBox)row.FindControl("txtdiscount")).Text) / 100)); _objactualinvoice.Freight = Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text); _objactualinvoice.Tax = Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text); _objactualinvoice.Transporter = (((TextBox)e.Item.FindControl("lbltransporter")).Text); _objactualinvoice.LRNo = (((TextBox)e.Item.FindControl("txtlrno")).Text); _objactualinvoice.TotalAmount = Convert.ToDecimal(getTotalValues(objgrid).ToString()) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text); _objactualinvoice.Bundles = (((TextBox)e.Item.FindControl("txtbundles")).Text); _objactualinvoice.CreatedBy = Convert.ToString(Session["UserName"]); _objactualinvoice.FinancialYearFrom = strFY; TextBox txtIdate1 = ((TextBox)e.Item.FindControl("txtdateabc")); TextBox txtLrdate1 = ((TextBox)e.Item.FindControl("txtlrdate")); _objactualinvoice.IsActive = true; _objactualinvoice.IsDeleted = false; string date1; string lrdate; if (txtIdate1.Text == "") { date1 = "1/1/2001"; } else { date1 = txtIdate1.Text.Split('/')[2] + "/" + txtIdate1.Text.Split('/')[1] + "/" + txtIdate1.Text.Split('/')[0]; } if (txtLrdate1.Text == "") { lrdate = "1/1/2001"; } else { lrdate = txtLrdate1.Text.Split('/')[2] + "/" + txtLrdate1.Text.Split('/')[1] + "/" + txtLrdate1.Text.Split('/')[0]; } _objactualinvoice.InvoiceDate = Convert.ToDateTime(date1); _objactualinvoice.LRDate = Convert.ToDateTime(lrdate); _objactualinvoice.Remark1 = ""; _objactualinvoice.Remark2 = ""; _objactualinvoice.Remark3 = ""; _objactualinvoice.SaveActual_InvoiceDetails(1); // (TextBox)e.Item.FindControl("txtfrieght"); } #endregion #region InvoiceCreate decimal subconfirmdoc = Convert.ToDecimal(e.CommandArgument.ToString().Trim()); _objDCConfirmQtyDetails.IsCreateInvoice = true; _objDCConfirmQtyDetails.CreatedInvoiceBy = Convert.ToString(Session["UserName"]); _objDCConfirmQtyDetails.SubDocNo = subconfirmdoc; // For financial year _objDCConfirmQtyDetails.AvailableQty = Convert.ToInt32(strFY); _objDCMaster.DocNo = Convert.ToInt32(txtDocno.Text); // Save Freight and tax Details frieght = Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text); tax = Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text); temp = Convert.ToDecimal(tamount.Text) + frieght + tax; totalamount = Convert.ToDecimal(tamount.Text); _objDCFT.DocumentNo = Convert.ToInt32(txtDocno.Text); _objDCFT.SubDocNo = subconfirmdoc; _objDCFT.Freight = Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text); _objDCFT.Tax = Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text); decimal TotalAmt = Convert.ToDecimal(getTotalValues(objgrid).ToString()) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text); _objDCFT.TotalAmount = Convert.ToDecimal(getTotalValues(objgrid).ToString()) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text); _objDCFT.LRNo = (((TextBox)e.Item.FindControl("txtlrno")).Text); TextBox txtIdate = ((TextBox)e.Item.FindControl("txtdateabc")); string date; if (txtIdate.Text == "") { date = "1/1/2001"; } else { date = txtIdate.Text.Split('/')[2] + "/" + txtIdate.Text.Split('/')[1] + "/" + txtIdate.Text.Split('/')[0]; } _objDCFT.InvoiceDate = Convert.ToDateTime(date); _objDCFT.AvailableQty = Convert.ToInt32(strFY); _objDCFT.Save_FrightTax_Details(1); _objDCConfirmQtyDetails.SaveConfirmDetails(1); stDS = new DataSet(); docno.InnerHtml = txtDocno.Text.Trim(); // stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "confirmed", Convert.ToInt32(strFY)); //if (ViewState["staticDS"] != null) //{ // stDS = (DataSet)ViewState["staticDS"]; //} //else //{ stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "confirmed", Convert.ToInt32(strFY)); //} RepDetailsConfirm.DataSource = stDS.Tables[0]; RepDetailsConfirm.DataBind(); #endregion MessageBox("Invoice created successfully " + subconfirmdoc); lblmessage.InnerHtml = "Last confirm doc no. : " + subconfirmdoc; if (Rptrpending.Items.Count == 1) { Rptrpending.DataSource = DCMaster.Get_ApprovedDocNo(Convert.ToInt32(strFY)); Rptrpending.DataBind(); //updateapprove.Update(); } if (RepDetailsConfirm.Items.Count == 0) { Rptrpending.DataSource = DCMaster.Get_ApprovedDocNo(Convert.ToInt32(strFY)); Rptrpending.DataBind(); upDocNo.Update(); docno.InnerHtml = ""; lblcustname.InnerHtml = ""; lblempname1.InnerHtml = ""; //updateapprove.Update(); } if (SMSSend.Text.ToUpper() == "YES") { sendMsg(lblMobNo.Text.Trim(), subconfirmdoc.ToString(), string.Format("{0:0.00}", TotalAmt).ToString(), (((TextBox)e.Item.FindControl("lbltransporter")).Text), (((TextBox)e.Item.FindControl("txtlrno")).Text), (((TextBox)e.Item.FindControl("txtbundles")).Text), txtIdate.Text.Trim()); //sendZoalMsg(((Label)e.Item.FindControl("lblCustId1")).Text, lblcustname.InnerHtml.Trim(), lblMobNo.Text.Trim(), subconfirmdoc.ToString(), string.Format("{0:0.00}", TotalAmt).ToString(), // (((TextBox)e.Item.FindControl("lbltransporter")).Text), // (((TextBox)e.Item.FindControl("txtlrno")).Text), // (((TextBox)e.Item.FindControl("txtbundles")).Text), // txtIdate.Text.Trim()); } //lblempname1.InnerHtml = ""; //lblcustname.InnerHtml = ""; // docno.InnerHtml = "" ; } catch (SqlException ex) { Response.Write(ex.Message.ToString()); } catch (Exception ex1) { Response.Write(ex1.Message.ToString()); } } } } ViewState["staticDS"] = null; Session["saved"] = e.CommandArgument.ToString().Trim(); updategenerate.Update(); }