private void cmbBranch_SelectedIndexChanged(object sender, EventArgs e) { if (cmbBranch.SelectedIndex > 0) { chkDocMonth.Items.Clear(); chkVillage.Items.Clear(); chkProducts.Items.Clear(); strChkDoc = ""; strChkProd = ""; strChkVill = ""; objServiceDB = new ServiceDB(); dsAll = objServiceDB.GetInvocieInfoforService(cmbBranch.SelectedValue.ToString(), "", "", "", 102); foreach (DataRow dr in dsAll.Tables[0].Rows) { chkDocMonth.Items.Add(dr["TNA_DOC_MONTH"].ToString()); } foreach (DataRow drV in dsAll.Tables[1].Rows) { chkVillage.Items.Add(drV["CM_VILLAGE"].ToString()); } foreach (DataRow drP in dsAll.Tables[2].Rows) { chkProducts.Items.Add(drP["pm_product_name"].ToString()); } objServiceDB = null; } }
private void ActivityServiceUpdate_Load(object sender, EventArgs e) { btnUpdate.Visible = false; DataSet dsFinYear = new DataSet(); DataTable dtfinYear = new DataTable(); DataTable dtBranch = new DataTable(); gvProductDetails.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9, System.Drawing.FontStyle.Regular); objHRInfo = new HRInfo(); if (sCompany.Length > 0) { dtBranch = objHRInfo.GetAllBranchList(sCompany, "BR", "").Tables[0]; } else { dtBranch = objHRInfo.GetAllBranchList(CommonData.CompanyCode, "BR", "").Tables[0]; } UtilityLibrary.PopulateControl(cmbBranch, dtBranch.DefaultView, 1, 0, "--PLEASE SELECT--", 0); objHRInfo = null; objServiceDB = new ServiceDB(); dsEmployee = objServiceDB.GetInvocieInfoforService("", "", "", "", 103); objServiceDB = null; objSQLdb = new SQLDB(); dsFinYear = objSQLdb.ExecuteDataSet("SELECT DISTINCT FY_FIN_YEAR FROM FIN_YEAR"); dtfinYear = dsFinYear.Tables[0]; cmbFinYear.DataSource = null; if (dtfinYear.Rows.Count > 0) { cmbFinYear.DataSource = dtfinYear; cmbFinYear.DisplayMember = "FY_FIN_YEAR"; cmbFinYear.ValueMember = "FY_FIN_YEAR"; cmbFinYear.SelectedIndex = 0; cmbFinYear.SelectedValue = CommonData.FinancialYear; if (sFinYear.Length > 0) { cmbFinYear.SelectedValue = sFinYear; } } btnUpdate.Enabled = false; btnClear.Enabled = false; btnAddReplDetails.Visible = false; btnAddCountingDetails.Visible = false; if (sBranCode.Length > 0) { cmbBranch.SelectedValue = sBranCode.Split('@')[0]; } else { if (CommonData.BranchType == "BR") { cmbBranch.SelectedValue = CommonData.BranchCode; } else { cmbBranch.SelectedIndex = 0; } } if (strTrnNo.Length > 0) { GetAllInvoicdeData(strTrnNo, ""); txtOrderNo_Validated(null, null); } }
private void FillActivityDetail(string OrderNo, string InvNo) { objServiceDB = new ServiceDB(); int intRow = 1; dgvActivity.Rows.Clear(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); if (txtInvoiceNo.Text != "") { try { ds = objServiceDB.GetInvocieInfoforService(cmbBranch.SelectedValue.ToString(), cmbFinYear.Text, OrderNo, InvNo, 104); dt = ds.Tables[1]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["ActivityId"].ToString().Length > 0) { DataGridViewRow tempRow = new DataGridViewRow(); DataGridViewCell cellActSlNo = new DataGridViewTextBoxCell(); cellActSlNo.Value = (i + 1).ToString(); tempRow.Cells.Add(cellActSlNo); DataGridViewCell cellActivityID = new DataGridViewTextBoxCell(); cellActivityID.Value = dt.Rows[i]["ActivityId"]; tempRow.Cells.Add(cellActivityID); DataGridViewCell cellMainProductID = new DataGridViewTextBoxCell(); cellMainProductID.Value = dt.Rows[i]["ProdId"]; tempRow.Cells.Add(cellMainProductID); DataGridViewCell cellProdName = new DataGridViewTextBoxCell(); cellProdName.Value = dt.Rows[i]["ProductName"].ToString(); tempRow.Cells.Add(cellProdName); DataGridViewCell cellInvQty = new DataGridViewTextBoxCell(); cellInvQty.Value = dt.Rows[i]["Qty"].ToString(); tempRow.Cells.Add(cellInvQty); DataGridViewCell cellTargetDate = new DataGridViewTextBoxCell(); if (dt.Rows[i]["TargetDate"].ToString() != "") { cellTargetDate.Value = Convert.ToDateTime(dt.Rows[i]["TargetDate"].ToString()).ToString("dd/MMM/yyyy"); } else { cellTargetDate.Value = ""; } tempRow.Cells.Add(cellTargetDate); DataGridViewCell cellCreatedDate = new DataGridViewTextBoxCell(); if (dt.Rows[i]["CreatedDate"].ToString() != "") { cellCreatedDate.Value = Convert.ToDateTime(dt.Rows[i]["CreatedDate"].ToString()).ToString("dd/MMM/yyyy"); } else { cellCreatedDate.Value = ""; } tempRow.Cells.Add(cellCreatedDate); DataGridViewCell cellApprovedBy = new DataGridViewTextBoxCell(); cellApprovedBy.Value = dt.Rows[i]["ApprovedBy"].ToString(); tempRow.Cells.Add(cellApprovedBy); DataGridViewCell cellApprovedName = new DataGridViewTextBoxCell(); cellApprovedName.Value = dt.Rows[i]["ApprovedName"].ToString(); tempRow.Cells.Add(cellApprovedName); DataGridViewCell cellActivityName = new DataGridViewTextBoxCell(); cellActivityName.Value = dt.Rows[i]["ActivityName"].ToString(); tempRow.Cells.Add(cellActivityName); DataGridViewCell cellActualQty = new DataGridViewTextBoxCell(); cellActualQty.Value = dt.Rows[i]["ActualQty"].ToString(); tempRow.Cells.Add(cellActualQty); DataGridViewCell cellProductID = new DataGridViewTextBoxCell(); cellProductID.Value = dt.Rows[i]["InvoiceNumber"]; tempRow.Cells.Add(cellProductID); DataGridViewCell cellEcode = new DataGridViewTextBoxCell(); cellEcode.Value = dt.Rows[i]["EmpName"].ToString(); tempRow.Cells.Add(cellEcode); DataGridViewCell cellDessc = new DataGridViewTextBoxCell(); if (dt.Rows[i]["ActualDate"].ToString() != "") { cellDessc.Value = Convert.ToDateTime(dt.Rows[i]["ActualDate"]).ToString("dd/MMM/yyyy"); } else { cellDessc.Value = ""; } tempRow.Cells.Add(cellDessc); DataGridViewCell cellActQty = new DataGridViewTextBoxCell(); cellActQty.Value = dt.Rows[i]["ActivityQty"].ToString(); tempRow.Cells.Add(cellActQty); DataGridViewCell cellActivityMode = new DataGridViewTextBoxCell(); cellActivityMode.Value = dt.Rows[i]["ActivityMode"].ToString(); tempRow.Cells.Add(cellActivityMode); DataGridViewCell cellCropName = new DataGridViewTextBoxCell(); cellCropName.Value = dt.Rows[i]["CropName"].ToString(); tempRow.Cells.Add(cellCropName); DataGridViewCell cellCropAcres = new DataGridViewTextBoxCell(); cellCropAcres.Value = dt.Rows[i]["CropAcres"].ToString(); tempRow.Cells.Add(cellCropAcres); DataGridViewCell cellFarmerOpinion = new DataGridViewTextBoxCell(); cellFarmerOpinion.Value = dt.Rows[i]["FarmerOpinion"].ToString(); tempRow.Cells.Add(cellFarmerOpinion); DataGridViewCell cellAoSuggestion = new DataGridViewTextBoxCell(); cellAoSuggestion.Value = dt.Rows[i]["AoSuggestion"].ToString(); tempRow.Cells.Add(cellAoSuggestion); DataGridViewCell cellRemarks = new DataGridViewTextBoxCell(); cellRemarks.Value = dt.Rows[i]["Remarks"].ToString(); tempRow.Cells.Add(cellRemarks); intRow = intRow + 1; dgvActivity.Rows.Add(tempRow); } } } else { dgvActivity.Rows.Clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { } } }
private void FillProductDetails(string OrderNo, string InvNo) { objServiceDB = new ServiceDB(); int intRow = 1; gvProductDetails.Rows.Clear(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); try { ds = objServiceDB.GetInvocieInfoforService(cmbBranch.SelectedValue.ToString(), cmbFinYear.Text, OrderNo, InvNo, 104); dt = ds.Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["ProductId"].ToString().Length > 0) { DataGridViewRow tempRow = new DataGridViewRow(); DataGridViewCell cellSLNO = new DataGridViewTextBoxCell(); cellSLNO.Value = intRow; tempRow.Cells.Add(cellSLNO); DataGridViewCell cellMainProductID = new DataGridViewTextBoxCell(); cellMainProductID.Value = dt.Rows[i]["ProductId"]; tempRow.Cells.Add(cellMainProductID); DataGridViewCell cellMainProduct = new DataGridViewTextBoxCell(); cellMainProduct.Value = dt.Rows[i]["ProductName"]; tempRow.Cells.Add(cellMainProduct); DataGridViewCell cellDessc = new DataGridViewTextBoxCell(); cellDessc.Value = dt.Rows[i]["CategoryName"]; tempRow.Cells.Add(cellDessc); DataGridViewCell cellPoints = new DataGridViewTextBoxCell(); if (dt.Rows[i]["Qty"].ToString() != "") { cellPoints.Value = Convert.ToDouble(dt.Rows[i]["Qty"]).ToString("f"); } else { cellPoints.Value = "0.00"; } tempRow.Cells.Add(cellPoints); intRow = intRow + 1; gvProductDetails.Rows.Add(tempRow); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { objServiceDB = null; dt = null; } }
public void GetAllInvoicdeData(string OrderNo, string InvNo) { objServiceDB = new ServiceDB(); DataSet dvFil = new DataSet(); DataSet ds = new DataSet(); try { dvFil = objServiceDB.GetInvocieInfoforService(cmbBranch.SelectedValue.ToString(), cmbFinYear.Text, OrderNo, InvNo, 101); if (dvFil.Tables[0].Rows.Count > 0) { btnAddReplDetails.Visible = false; btnUpdate.Enabled = true; btnClear.Enabled = true; btnAddCountingDetails.Visible = false; txtInvoiceNo.Text = dvFil.Tables[0].Rows[0]["InvNo"].ToString(); txtOrderNo.Text = dvFil.Tables[0].Rows[0]["OrderNo"].ToString(); txtDocMonth.Text = dvFil.Tables[0].Rows[0]["DocMonth"].ToString(); txtCampName.Text = dvFil.Tables[0].Rows[0]["CampName"].ToString(); txtVillage.Text = dvFil.Tables[0].Rows[0]["Village"].ToString(); txtSrEname.Text = dvFil.Tables[0].Rows[0]["SRName"].ToString(); txtMandal.Text = dvFil.Tables[0].Rows[0]["Mandal"].ToString(); txtDistrict.Text = dvFil.Tables[0].Rows[0]["District"].ToString(); txtState.Text = dvFil.Tables[0].Rows[0]["State"].ToString(); txtPin.Text = dvFil.Tables[0].Rows[0]["Pin"].ToString(); txtHouseNo.Text = dvFil.Tables[0].Rows[0]["HouseNo"].ToString(); txtLandMark.Text = dvFil.Tables[0].Rows[0]["LandMark"].ToString(); txtMobileNo.Text = dvFil.Tables[0].Rows[0]["MobileNO"].ToString(); txtLanLineNo.Text = dvFil.Tables[0].Rows[0]["LandLineNo"].ToString(); txtCustomerName.Text = dvFil.Tables[0].Rows[0]["FarmerName"].ToString(); txtRelationName.Text = dvFil.Tables[0].Rows[0]["ForgName"].ToString(); cbRelation.Text = dvFil.Tables[0].Rows[0]["fatherOrHus"].ToString(); FillActivityDetail(OrderNo, InvNo); //FillProductDetails(OrderNo, InvNo); CheckingForNewReplacement(); CheckingForAddAnotherCountingDetails(); } else { txtVillage.Text = ""; txtMandal.Text = ""; txtDistrict.Text = ""; txtState.Text = ""; txtPin.Text = ""; txtHouseNo.Text = ""; txtLandMark.Text = ""; txtMobileNo.Text = ""; txtLanLineNo.Text = ""; txtCustomerName.Text = ""; txtRelationName.Text = ""; cbRelation.SelectedIndex = 0; dgvActivity.Rows.Clear(); gvProductDetails.Rows.Clear(); btnUpdate.Enabled = false; btnClear.Enabled = false; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { dvFil = null; objServiceDB = null; } }