public void BindPanel() { RdBValue = RdlView.SelectedValue.ToString(); if (RdBValue == "Customer") { BindCustomer(); Pnlcust.Visible = true; // pnlDetails.Visible = false; Rptrpending.Visible = true; // Panel1.Visible = false; upDocNo.Update(); RepDetailsConfirm.DataBind(); Rptrpending.DataBind(); } if (RdBValue == "All") { Pnlcust.Visible = false; // pnlDetails.Visible = false; // Panel1.Visible = true; Rptrpending.Visible = true; Rptrpending.DataSource = DCDetails.Get_DC_Completed_IsApproved(Convert.ToInt32(strFY)); Rptrpending.DataBind(); upDocNo.Update(); RepDetailsConfirm.DataBind(); } }
protected void btnget_Click(object sender, EventArgs e) { pnlDetails.Visible = true; stDS = new DataSet(); docno.InnerHtml = txtDocno.Text.Trim(); stDS = SpecimanDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "approved"); ViewState["staticDS"] = stDS; RepDetailsConfirm.DataSource = stDS.Tables[0]; RepDetailsConfirm.DataBind(); }
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 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 = SpecimanDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "confirmed"); RepDetailsConfirm.DataSource = stDS.Tables[0]; RepDetailsConfirm.DataBind(); if (txtFisrt != null) { txtFisrt.Focus(); } // lblfright.Visible = true; // txtfrieght.Visible = true; // lbltax.Visible = true; // txttax.Visible = true; //string jv = ""; //if (RepDetailsConfirm.Items.Count <= 0) //{ // jv = "document.getElementById('ctl00_ContentPlaceHolder1_uc_ConfirmedDC1_btnapproval').style.display='none';"; //} //else //{ // jv = "document.getElementById('ctl00_ContentPlaceHolder1_uc_ConfirmedDC1_btnapproval').style.display='block';"; //} //ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "a", jv, true); //ds = SpecimanDetails.Idv_Get_SpecimenDetails_By_DocNo(Convert.ToInt32(txtDocno.Text), "confirmed"); //DataTable dt = ds.Tables[0]; //if (dt.Rows.Count != 0) //{ // btnapproval.Enabled = true; //} //else //{ // bool Auth = Specimen.Get_DocumentNum_Authentication(Convert.ToInt32(txtDocno.Text)); // if (Auth) // { // MessageBox("Document no is not available"); // txtDocno.Focus(); // } // else // { // } //} }
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 RepDetailsConfirm_ItemCommand(object source, RepeaterCommandEventArgs e) { CourierDetails _objCD = new CourierDetails(); try { DataSet DS = new DataSet(); Repeater objrep = (Repeater)this.FindControl("RepDetailsConfirm"); GridView objgrid = (GridView)objrep.Items[e.Item.ItemIndex].FindControl("grdCD"); foreach (GridViewRow row in objgrid.Rows) { _objCD.SCMasterAutoId = float.Parse(((Label)row.FindControl("lblSCMasterAutoId")).Text); _objCD.DocumentNo = float.Parse(((Label)row.FindControl("lblDocumentNo")).Text); _objCD.InvoiceNo = float.Parse(((Label)row.FindControl("lblInvoiceNo")).Text); _objCD.POD = Convert.ToInt32(((TextBox)row.FindControl("txtPODId")).Text); _objCD.CreatedBy = Convert.ToString(Session["UserName"]); if (txtCourierId.Text.ToString() != "") { _objCD.UpdatePODNo(_objCD.SCMasterAutoId, _objCD.DocumentNo, _objCD.InvoiceNo, "CourierId", _objCD.POD, Convert.ToInt32(strFY)); DS = CourierDetails.UpdatePOD(float.Parse(txtCourierId.Text), "CourierId", Convert.ToInt32(strFY)); } else if (txtInvoiceNoGet.Text.ToString() != "") { _objCD.UpdatePODNo(_objCD.SCMasterAutoId, _objCD.DocumentNo, _objCD.InvoiceNo, "Invoice", _objCD.POD, Convert.ToInt32(strFY)); DS = CourierDetails.UpdatePOD(float.Parse(txtInvoiceNoGet.Text), "Invoice", Convert.ToInt32(strFY)); } else if (txtDocNoGet.Text.ToString() != "") { _objCD.UpdatePODNo(_objCD.SCMasterAutoId, _objCD.DocumentNo, _objCD.InvoiceNo, "DocNo", _objCD.POD, Convert.ToInt32(strFY)); DS = CourierDetails.UpdatePOD(float.Parse(txtDocNoGet.Text), "DocNo", Convert.ToInt32(strFY)); } } RepDetailsConfirm.DataSource = DS.Tables[1]; RepDetailsConfirm.DataBind(); } catch (Exception ex) { MessageBox(ex.Message.ToString()); } }
protected void btnget_Click(object sender, EventArgs e) { ViewState["DocNo"] = ViewState["DocNo"] + "," + txtDocNoGet.Text + ","; DataSet Ds = new DataSet(); if (txtCourierId.Text.ToString() != "") { Ds = CourierDetails.UpdatePOD(float.Parse(txtCourierId.Text), "CourierId", Convert.ToInt32(strFY)); } else if (txtInvoiceNoGet.Text.ToString() != "") { Ds = CourierDetails.UpdatePOD(float.Parse(txtInvoiceNoGet.Text), "Invoice", Convert.ToInt32(strFY)); } else if (txtDocNoGet.Text.ToString() != "") { Ds = CourierDetails.UpdatePOD(float.Parse(txtDocNoGet.Text), "DocNo", Convert.ToInt32(strFY)); } RepDetailsConfirm.DataSource = Ds.Tables[1]; RepDetailsConfirm.DataBind(); }
protected void btnget_Click(object sender, EventArgs e) { ViewState["DocNo"] = ViewState["DocNo"] + "," + txtDocNoGet.Text + ","; DataSet DS = new DataSet(); if (txtCourierId.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtCourierId.Text), "", "", "", "", "CourierId", Convert.ToInt32(strFY)); } else if (txtInvoiceNoGet.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtInvoiceNoGet.Text), "", "", "", "", "Invoice", Convert.ToInt32(strFY)); } else if (txtDocNoGet.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtDocNoGet.Text), "", "", "", "", "DocNo", Convert.ToInt32(strFY)); } else if (txtGeneralCourierID.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtGeneralCourierID.Text), "", "", "", "", "GeneralCourierID", Convert.ToInt32(strFY)); } else if (ddlBranch.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "Others")) { if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others"))) { DS = ObjDal.GetUpdatePOD(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)); } else { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)); } } else if ((ddlCourier.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "Others")) { if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others"))) { DS = ObjDal.GetUpdatePOD(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)); } else { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)); } } else if (ddlBranchI.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "InvoiceNo")) { if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo")) { DS = ObjDal.GetUpdatePOD(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)); } else { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)); } } else if ((ddlCourierI.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "InvoiceNo")) { if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo")) { DS = ObjDal.GetUpdatePOD(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)); } { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)); } } else if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo")) { DS = ObjDal.GetUpdatePOD(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "Date", Convert.ToInt32(strFY)); } else if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others"))) { DS = ObjDal.GetUpdatePOD(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralDate", Convert.ToInt32(strFY)); } try { RepDetailsConfirm.DataSource = DS.Tables[1]; RepDetailsConfirm.DataBind(); } catch (Exception ex) { throw; } //txtCourierId.Text = ""; //txtInvoiceNoGet.Text = ""; //txtDocNoGet.Text = ""; //ddlBranchI.SelectedValue = "0"; //ddlCourierI.SelectedValue = "0"; //txtFrom.Text = ""; //txtTo.Text = ""; //txtGeneralCourierID.Text = ""; //ddlBranch.SelectedValue = "0"; //ddlCourier.SelectedValue = "0"; //txtFromGeneral.Text = ""; //txtToGeneral.Text = ""; }
protected void RepDetailsConfirm_ItemCommand(object source, RepeaterCommandEventArgs e) { int Val = 0; if (e.CommandName == "update") { try { DataSet DS = new DataSet(); Repeater objrep = (Repeater)this.FindControl("RepDetailsConfirm"); GridView objgrid = (GridView)objrep.Items[e.Item.ItemIndex].FindControl("grdCD"); if (rdLevel1.SelectedValue == "InvoiceNo") { objgrid = (GridView)objrep.Items[e.Item.ItemIndex].FindControl("grdCD"); } else if (rdLevel1.SelectedValue == "Others") { objgrid = (GridView)objrep.Items[e.Item.ItemIndex].FindControl("gdGeneral"); } XmlDocument doc = new XmlDocument(); XmlNode node = doc.CreateElement("r"); XmlNode nd = doc.CreateElement("I"); if (rdLevel1.SelectedValue == "InvoiceNo") { #region Invoice No Update Loop foreach (GridViewRow row in objgrid.Rows) { CheckBox checkpod = (CheckBox)row.FindControl("chkIsActive"); XmlNode elem = doc.CreateElement("T"); if (checkpod.Checked) { Val = 1; if (Txtpod.Text != "") { nd = doc.CreateElement("d"); nd.InnerText = Convert.ToInt32(Txtpod.Text).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("f"); nd.InnerText = Convert.ToInt32(Session["FY"]).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("u"); nd.InnerText = Convert.ToString(Session["UserName"]).ToString(); elem.AppendChild(nd); node.AppendChild(elem); nd = doc.CreateElement("a"); nd.InnerText = float.Parse(((Label)row.FindControl("lblSCMasterAutoId")).Text).ToString(); elem.AppendChild(nd); } else { string no = ((TextBox)row.FindControl("txtPODId")).Text == "" ? "0" : ((TextBox)row.FindControl("txtPODId")).Text; if (no != "") { nd = doc.CreateElement("d"); nd.InnerText = Convert.ToInt32(no).ToString();//Convert.ToInt32(((TextBox)row.FindControl("txtPODId")).Text).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("f"); nd.InnerText = Convert.ToInt32(Session["FY"]).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("u"); nd.InnerText = Convert.ToString(Session["UserName"]).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("a"); nd.InnerText = float.Parse(((Label)row.FindControl("lblSCMasterAutoId")).Text).ToString(); elem.AppendChild(nd); node.AppendChild(elem); } } } } #endregion } else if (rdLevel1.SelectedValue == "Others") { foreach (GridViewRow row in objgrid.Rows) { XmlNode elem = doc.CreateElement("T"); CheckBox checkpod = (CheckBox)row.FindControl("chkIsActive1"); if (checkpod.Checked) { Val = 1; if (Txtpod1.Text != "") { nd = doc.CreateElement("d"); nd.InnerText = Convert.ToInt32(Txtpod1.Text).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("f"); nd.InnerText = Convert.ToInt32(Session["FY"]).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("u"); nd.InnerText = Convert.ToString(Session["UserName"]).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("a"); nd.InnerText = float.Parse(((Label)row.FindControl("lblUNIQ")).Text).ToString(); elem.AppendChild(nd); node.AppendChild(elem); } else { string nos = ((TextBox)row.FindControl("txtPODIdG")).Text == "" ? "0" : ((TextBox)row.FindControl("txtPODIdG")).Text; if (nos != "") { nd = doc.CreateElement("d"); nd.InnerText = Convert.ToInt32(nos).ToString(); //Convert.ToInt32(((TextBox)row.FindControl("txtPODIdG")).Text).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("f"); nd.InnerText = Convert.ToInt32(Session["FY"]).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("u"); nd.InnerText = Convert.ToString(Session["UserName"]).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("a"); nd.InnerText = float.Parse(((Label)row.FindControl("lblUNIQ")).Text).ToString(); elem.AppendChild(nd); node.AppendChild(elem); } } } } } if (Val == 1) { ObjProp.XMLData = node.OuterXml.ToString(); ObjDal.Idv_Chetana_UpdatePODNo("", "", "", "Update", ObjProp.XMLData, "", 0); } else { MessageBox("Please Seleted Is Active Box"); return; } #region Get data After Update if (txtCourierId.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtCourierId.Text), "", "", "", "", "CourierId", Convert.ToInt32(strFY)); } else if (txtInvoiceNoGet.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtInvoiceNoGet.Text), "", "", "", "", "Invoice", Convert.ToInt32(strFY)); } else if (txtDocNoGet.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtDocNoGet.Text), "", "", "", "", "DocNo", Convert.ToInt32(strFY)); } else if (txtGeneralCourierID.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtGeneralCourierID.Text), "", "", "", "", "GeneralCourierID", Convert.ToInt32(strFY)); } else if (ddlBranch.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "Others")) { if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others"))) { DS = ObjDal.GetUpdatePOD(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)); } else { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)); } } else if ((ddlCourier.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "Others")) { if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others"))) { DS = ObjDal.GetUpdatePOD(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)); } else { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)); } } else if (ddlBranchI.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "InvoiceNo")) { if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo")) { DS = ObjDal.GetUpdatePOD(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)); } else { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)); } } else if ((ddlCourierI.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "InvoiceNo")) { if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo")) { DS = ObjDal.GetUpdatePOD(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)); } else { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)); } } else if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo")) { DS = ObjDal.GetUpdatePOD(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "Date", Convert.ToInt32(strFY)); } else if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others"))) { DS = ObjDal.GetUpdatePOD(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralDate", Convert.ToInt32(strFY)); } #endregion if (DS.Tables[0].Rows[0]["PODId"].ToString() != "") { MessageBox("POD updated successfully"); } RepDetailsConfirm.DataSource = DS.Tables[1]; RepDetailsConfirm.DataBind(); Txtpod.Text = ""; Txtpod1.Text = ""; } catch (Exception ex) { MessageBox(ex.Message.ToString()); } } #region Delete Record if (e.CommandName == "delete") { try { DataSet DS = new DataSet(); Repeater objrep = (Repeater)this.FindControl("RepDetailsConfirm"); GridView objgrid = (GridView)objrep.Items[e.Item.ItemIndex].FindControl("grdCD"); if (rdLevel1.SelectedValue == "InvoiceNo") { objgrid = (GridView)objrep.Items[e.Item.ItemIndex].FindControl("grdCD"); } else if (rdLevel1.SelectedValue == "Others") { objgrid = (GridView)objrep.Items[e.Item.ItemIndex].FindControl("gdGeneral"); } XmlDocument doc = new XmlDocument(); XmlNode node = doc.CreateElement("r"); XmlNode nd = doc.CreateElement("I"); ObjProp.UpDateBy = Convert.ToString(Session["UserName"]); if (rdLevel1.SelectedValue == "InvoiceNo") { foreach (GridViewRow row in objgrid.Rows) { XmlNode elem = doc.CreateElement("T"); CheckBox checkpod = (CheckBox)row.FindControl("chkIsActive"); if (checkpod.Checked) { Val = 1; nd = doc.CreateElement("us"); nd.InnerText = Convert.ToString(Session["UserName"]).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("ai"); nd.InnerText = float.Parse(((Label)row.FindControl("lblSCMasterAutoId")).Text).ToString(); elem.AppendChild(nd); node.AppendChild(elem); } } } else if (rdLevel1.SelectedValue == "Others") { ObjProp.IsActive = Convert.ToBoolean(false); ObjProp.UpDateBy = Convert.ToString(Session["UserName"]); foreach (GridViewRow row in objgrid.Rows) { XmlNode elem = doc.CreateElement("T"); CheckBox checkpod = (CheckBox)row.FindControl("chkIsActive1"); if (checkpod.Checked) { Val = 1; nd = doc.CreateElement("us"); nd.InnerText = Convert.ToString(Session["UserName"]).ToString(); elem.AppendChild(nd); nd = doc.CreateElement("ai"); nd.InnerText = float.Parse(((Label)row.FindControl("lblUNIQ")).Text).ToString(); elem.AppendChild(nd); node.AppendChild(elem); } } } if (Val == 1) { ObjProp.XMLData = node.OuterXml.ToString(); ObjDal.Idv_Chetana_UpdatePODNo("", "", "", "", ObjProp.XMLData, "", 0); } else { MessageBox("Please Select Is Active Box"); return; } #region After Delete Get data if (txtCourierId.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtCourierId.Text), "", "", "", "", "CourierId", Convert.ToInt32(strFY)); } else if (txtInvoiceNoGet.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtInvoiceNoGet.Text), "", "", "", "", "Invoice", Convert.ToInt32(strFY)); } else if (txtDocNoGet.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtDocNoGet.Text), "", "", "", "", "DocNo", Convert.ToInt32(strFY)); } else if (txtGeneralCourierID.Text.ToString() != "") { DS = ObjDal.GetUpdatePOD(float.Parse(txtGeneralCourierID.Text), "", "", "", "", "GeneralCourierID", Convert.ToInt32(strFY)); } else if (ddlBranch.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "Others")) { if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others"))) { DS = ObjDal.GetUpdatePOD(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)); } else { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)); } } else if ((ddlCourier.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "Others")) { if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others"))) { DS = ObjDal.GetUpdatePOD(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)); } else { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)); } } else if (ddlBranchI.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "InvoiceNo")) { if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo")) { DS = ObjDal.GetUpdatePOD(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)); } else { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)); } } else if ((ddlCourierI.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "InvoiceNo")) { if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo")) { DS = ObjDal.GetUpdatePOD(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)); } else { DS = ObjDal.GetUpdatePOD(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)); } } else if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo")) { DS = ObjDal.GetUpdatePOD(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "Date", Convert.ToInt32(strFY)); } else if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others"))) { DS = ObjDal.GetUpdatePOD(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralDate", Convert.ToInt32(strFY)); } #endregion //if (DS.Tables[0].Rows[0]["PODId"].ToString() != "") // if (DS.Tables[0].Rows[0] > "0".ToString()) MessageBox("Record Deleted successfully"); RepDetailsConfirm.DataSource = DS.Tables[1]; RepDetailsConfirm.DataBind(); Txtpod.Text = ""; Txtpod1.Text = ""; } catch (Exception ex) { MessageBox(ex.Message.ToString()); } } #endregion }
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(); }
protected void RepDetailsConfirm_ItemCommand(object source, RepeaterCommandEventArgs e) { bool Auth = Specimen.Get_DocumentNum_Authentication(Convert.ToInt32(txtDocno.Text)); if (Auth) { MessageBox("Document no is not available"); txtDocno.Focus(); } else { SpecimenConfirmQtyDetails _objSpecimenConfirmQtyDetails = new SpecimenConfirmQtyDetails(); Specimen _objspecimen = new Specimen(); SpecimenConfirmQtyDetails _objSpecimenFT = new SpecimenConfirmQtyDetails(); try { decimal subconfirmdoc = Convert.ToDecimal(e.CommandArgument.ToString().Trim()); _objSpecimenConfirmQtyDetails.IsCreateInvoice = true; _objSpecimenConfirmQtyDetails.CreatedInvoiceBy = "admin"; _objSpecimenConfirmQtyDetails.SubDocNo = Convert.ToDecimal(e.CommandArgument.ToString().Trim()); _objspecimen.DocNo = Convert.ToInt32(txtDocno.Text); _objSpecimenConfirmQtyDetails.Transporter = ((TextBox)e.Item.FindControl("txtTransporter")).Text; _objSpecimenConfirmQtyDetails.LrNo = ((TextBox)e.Item.FindControl("txtlrno")).Text; _objSpecimenConfirmQtyDetails.Bundles = ((TextBox)e.Item.FindControl("txtbundles")).Text; TextBox txtdateabc = (TextBox)e.Item.FindControl("txtdateabc"); string date1; if (txtdateabc.Text == "") { date1 = "01/01/2001"; } else { date1 = txtdateabc.Text.Split('/')[1] + "/" + txtdateabc.Text.Split('/')[0] + "/" + txtdateabc.Text.Split('/')[2]; } _objSpecimenConfirmQtyDetails.InvoiceDate = Convert.ToDateTime(date1); _objSpecimenConfirmQtyDetails.SaveConfirmDetails(); Cleardata(); stDS = new DataSet(); docno.InnerHtml = txtDocno.Text.Trim(); stDS = SpecimanDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "confirmed"); RepDetailsConfirm.DataSource = stDS.Tables[0]; RepDetailsConfirm.DataBind(); MessageBox("DC approved successfully for document no. " + subconfirmdoc); docno.InnerHtml = "Last confirm doc no. : " + subconfirmdoc; if (Rptrpending.Items.Count == 1) { Rptrpending.DataSource = Specimen.Get_ApprovedDocNo(); Rptrpending.DataBind(); //updateapprove.Update(); } if (RepDetailsConfirm.Items.Count == 0) { Rptrpending.DataSource = Specimen.Get_ApprovedDocNo(); Rptrpending.DataBind(); upDocNo.Update(); docno.InnerHtml = ""; //lblcustname.InnerHtml = ""; lblempname1.InnerHtml = ""; //updateapprove.Update(); } updateapprove.Update(); } catch (Exception ex) { MessageBox(ex.Message.ToString()); } } }