private void FillEmployeeData()
 {
     objServiceDB = new ServiceDB();
     ds           = objServiceDB.GetECodesforService(BranchCode, DeptCode);
     UtilityLibrary.PopulateControl(cmbEmployee, ds.Tables[0].DefaultView, 1, 0, "-- Please Select --", 0);
     objServiceDB = null;
 }
        private void AddReplacementDetails_Load(object sender, EventArgs e)
        {
            objServiceDB = new ServiceDB();

            string    strCmd = "";
            DataTable dt     = new DataTable();

            ds = objServiceDB.GetECodesforService(BranchCode, DeptCode);
            FillCompanyData();
            cbCompany.Enabled        = false;
            cmbBranch.Enabled        = false;
            txtProdName.ReadOnly     = true;
            cmbFinYear.Enabled       = false;
            txtActivityName.ReadOnly = true;
            txtActualQty.ReadOnly    = true;
            txtInvNo.ReadOnly        = true;
            dtpActivityDate.Value    = DateTime.Today;

            objServiceDB = null;
            UtilityLibrary.PopulateControl(cmbBranch, ds.Tables[1].DefaultView, 1, 0, "-- Please Select --", 0);

            objSQLdb = new SQLDB();
            if (dtActDetl.Rows.Count > 0)
            {
                objSQLdb = new SQLDB();
                strCmd   = "SELECT TNA_COMPANY_CODE " +
                           ",TNA_BRANCH_CODE, TNA_QTY " +
                           ",TNA_ORDER_NUMBER,TNA_INVOICE_NUMBER " +
                           ",(TNA_QTY-sum(TNA_ACTIVITY_QTY)) as Qty  " +
                           " FROM SERVICES_TNA " +
                           " WHERE TNA_COMPANY_CODE='" + CommonData.CompanyCode +
                           "' AND TNA_BRANCH_CODE='" + dtActDetl.Rows[0]["BranCode"].ToString() +
                           "' AND TNA_INVOICE_NUMBER=" + dtActDetl.Rows[0]["InvNo"].ToString() +
                           " AND TNA_ATTEND_BY_ECODE IS not null " +
                           " and TNA_PRODUCT_ID='TKPRYL0000' and TNA_ACTIVITY_ID IN ('13','18','19') " +
                           " GROUP BY TNA_COMPANY_CODE,TNA_BRANCH_CODE,TNA_QTY,TNA_ORDER_NUMBER,TNA_INVOICE_NUMBER";
                dt = objSQLdb.ExecuteDataSet(strCmd).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    txtActualQty.Text = dt.Rows[0]["Qty"].ToString();
                }
                else
                {
                    txtActualQty.Text = dtActDetl.Rows[0]["Qty"].ToString();
                }

                cmbBranch.SelectedValue = dtActDetl.Rows[0]["BranCode"].ToString();
                cmbBranch_SelectedIndexChanged(null, null);
                txtInvNo.Text        = dtActDetl.Rows[0]["InvNo"].ToString();
                txtProdName.Text     = dtActDetl.Rows[0]["ProdName"].ToString();
                txtActivityName.Text = ActivityName;
                cmbFinYear.Text      = dtActDetl.Rows[0]["FinYear"].ToString();
            }
        }
        public void GetECodeData(string BranchCode)
        {
            objServiceDB = new ServiceDB();

            DataSet dsData = objServiceDB.GetECodesforService(BranchCode, DeptCode);

            objServiceDB = null;
            UtilityLibrary.PopulateControl(cmbEmployee, dsData.Tables[0].DefaultView, 1, 0, "-- Please select --", 0);
            //if (sCheckVal == "1")
            //{
            //    if (sEcode != "")
            //        cmbEmployee.SelectedValue = sEcode.Split('-')[0].ToString();
            //}
        }
        private void frmTechnicalServiceDetails_Load(object sender, EventArgs e)
        {
            cbActivityMode.SelectedIndex = 0;
            dtpActivityDate.Value        = DateTime.Today;
            objServiceDB = new ServiceDB();
            ds           = objServiceDB.GetECodesforService(BranchCode, DeptCode);

            try
            {
                EcodeSearch();
                FillEmployeeData();
                objSQLdb = new SQLDB();

                strCmd = "exec Get_ServiceActivityDetails '" + CommonData.CompanyCode + "','" + BranchCode + "','" + FinYear + "','" + InvoiceNo + "','" + sOrderNo + "'," + sActivityID + ",'" + sProductId + "'";
                dt     = objSQLdb.ExecuteDataSet(strCmd).Tables[0];

                if (dt.Rows[0]["AttendedEcode"].ToString() != "")
                {
                    sEcode = dt.Rows[0]["AttendedEcode"].ToString();
                }
                txtServiceSearch.Text = sEcode;
                if (sEcode.Length > 1)
                {
                    txtServiceSearch_KeyUp(null, null);
                }
                if (sEcode != "")
                {
                    cmbEmployee.SelectedValue = sEcode;
                }
                txtOrderNo.Text      = sOrderNo;
                txtInvNo.Text        = InvoiceNo;
                txtProdName.Text     = dt.Rows[0]["ProductName"].ToString();
                txtProdName.Tag      = dt.Rows[0]["ProductId"].ToString();
                txtActivityName.Text = dt.Rows[0]["ActivityName"].ToString();
                txtInvQty.Text       = dt.Rows[0]["Qty"].ToString();

                if (sActDate.Length != 0)
                {
                    txtServiceSearch.ReadOnly = true;
                    cmbEmployee.Enabled       = false;
                    dtpActivityDate.Enabled   = false;
                    dtpActivityDate.Value     = Convert.ToDateTime(sActDate);
                }
                else
                {
                    txtServiceSearch.ReadOnly = false;
                    cmbEmployee.Enabled       = true;
                    dtpActivityDate.Enabled   = true;
                }
                if (dt.Rows[0]["ActualDate"].ToString() != "")
                {
                    dtpActivityDate.Value = Convert.ToDateTime(dt.Rows[0]["ActualDate"].ToString());
                }

                txtIrrigationSuggestion.Text = dt.Rows[0]["Suggestion_For_Irrigation"].ToString();
                txtManuringSuggestion.Text   = dt.Rows[0]["Suggestion_For_manuring"].ToString();
                txtObservDisease.Text        = dt.Rows[0]["Observ_Disease"].ToString();
                txtObservIrrigation.Text     = dt.Rows[0]["Observ_Irrigation"].ToString();
                txtObservManuring.Text       = dt.Rows[0]["Observ_Manuring"].ToString();
                txtObservPrunining.Text      = dt.Rows[0]["Observ_Pruning"].ToString();
                txtObservWeeding.Text        = dt.Rows[0]["Observ_Weeding"].ToString();
                txtPruningSuggestion.Text    = dt.Rows[0]["Suggestion_For_Pruning"].ToString();
                txtWeedingSuggeston.Text     = dt.Rows[0]["Suggestion_For_Weeding"].ToString();
                txtSugForDiseases.Text       = dt.Rows[0]["Suggestion_For_Diseases"].ToString();
                txtPlantAge.Text             = dt.Rows[0]["PlantAge"].ToString();
                txtPlantHeight.Text          = dt.Rows[0]["PlantHeight"].ToString();
                txtPlantWidth.Text           = dt.Rows[0]["PlantWidth"].ToString();
                txtRemarks.Text = dt.Rows[0]["FarmerRemarks"].ToString();
                if (dt.Rows[0]["ActivityMode"].ToString() != "")
                {
                    cbActivityMode.Text = dt.Rows[0]["ActivityMode"].ToString();
                }
                else
                {
                    cbActivityMode.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void ECodeSearch_Load(object sender, EventArgs e)
        {
            objServiceDB = new ServiceDB();
            ds           = objServiceDB.GetECodesforService(BranchCode, DeptCode);

            txtMessage.Visible  = false;
            lblMsg.Visible      = false;
            lblLangType.Visible = false;
            cbLanguages.Visible = false;
            txtMessage.Text     = "";

            FillCropDetails();
            txtProdName.ReadOnly     = true;
            txtOrderNo.ReadOnly      = true;
            txtActivityName.ReadOnly = true;
            txtInvQty.ReadOnly       = true;
            txtInvNo.ReadOnly        = true;
            dtpActivityDate.Value    = DateTime.Today;

            objServiceDB = null;

            cbActivityMode.SelectedIndex = 0;
            txtServiceSearch_Validated(null, null);

            dtpActivityDate.Value  = DateTime.Today;
            txtEcodeSearch.Visible = false;
            txtEName.Visible       = false;
            lblApprBy.Visible      = false;

            if (sCheckVal == "1")
            {
                try
                {
                    FillEmployeeData();
                    EcodeSearch();

                    objSQLdb = new SQLDB();

                    strCmd = "exec Get_ServiceActivityDetails '','" + BranchCode + "','" + FinYear + "','" + InvoiceNo + "','" + sOrderNo + "'," + sActivityID + ",'" + sProductId + "'";
                    dt     = objSQLdb.ExecuteDataSet(strCmd).Tables[0];

                    sMobileNo = dt.Rows[0]["PhoneNo"].ToString();

                    if (dt.Rows[0]["AttendedEcode"].ToString() != "")
                    {
                        sEcode = dt.Rows[0]["AttendedEcode"].ToString();
                    }
                    txtServiceSearch.Text = sEcode;
                    if (sEcode.Length > 1)
                    {
                        txtServiceSearch_KeyUp(null, null);
                    }
                    if (sEcode != "")
                    {
                        cmbEmployee.SelectedValue = sEcode;
                    }
                    if (dt.Rows[0]["ActivityMode"].ToString() != "")
                    {
                        cbActivityMode.Text = dt.Rows[0]["ActivityMode"].ToString();
                    }
                    else
                    {
                        cbActivityMode.SelectedIndex = 0;
                    }

                    if (dt.Rows[0]["CropName"].ToString() != "")
                    {
                        cbCrops.Text = dt.Rows[0]["CropName"].ToString();
                    }
                    else
                    {
                        cbCrops.SelectedIndex = 0;
                    }

                    txtRemarks.Text       = dt.Rows[0]["FarmerRemarks"].ToString();
                    txtOrderNo.Text       = sOrderNo;
                    txtInvNo.Text         = InvoiceNo;
                    txtProdName.Text      = dt.Rows[0]["ProductName"].ToString();
                    txtProdName.Tag       = dt.Rows[0]["ProductId"].ToString();
                    txtActivityName.Text  = dt.Rows[0]["ActivityName"].ToString();
                    txtInvQty.Text        = dt.Rows[0]["Qty"].ToString();
                    txtCropAcres.Text     = dt.Rows[0]["CropAcres"].ToString();
                    txtFarmerOpinion.Text = dt.Rows[0]["FarmerOpinion"].ToString();
                    txtAOSuggestion.Text  = dt.Rows[0]["AoSuggestion"].ToString();
                    if (dt.Rows[0]["ActualQty"].ToString().Equals("0.00"))
                    {
                        txtActualQty.ReadOnly = false;
                    }
                    else
                    {
                        txtActualQty.ReadOnly = true;
                    }
                    txtActualQty.Text = dt.Rows[0]["ActualQty"].ToString();
                    txtQty.Text       = dt.Rows[0]["ActivityQty"].ToString();

                    if (sActDate.Length != 0)
                    {
                        txtServiceSearch.ReadOnly = true;
                        cmbEmployee.Enabled       = false;
                        dtpActivityDate.Enabled   = false;
                        dtpActivityDate.Value     = Convert.ToDateTime(sActDate);
                    }
                    else
                    {
                        txtServiceSearch.ReadOnly = false;
                        cmbEmployee.Enabled       = true;
                        dtpActivityDate.Enabled   = true;
                    }
                    if (dt.Rows[0]["ActualDate"].ToString() != "")
                    {
                        dtpActivityDate.Value = Convert.ToDateTime(dt.Rows[0]["ActualDate"].ToString());
                    }


                    if (dt.Rows[0]["ReplApprovedName"].ToString() != "")
                    {
                        lblApprBy.Visible      = true;
                        txtEcodeSearch.Visible = true;
                        txtEName.Visible       = true;
                        txtEcodeSearch.Text    = dt.Rows[0]["ReplApprBy"].ToString();
                        txtEName.Text          = dt.Rows[0]["ReplApprovedName"].ToString();
                    }
                    if (dt.Rows[0]["ActivityName"].ToString() == "COUNTING")
                    {
                        lblQty.Text = "Recommended Qty";
                    }
                    else if (dt.Rows[0]["ActivityName"].ToString().Substring(0, 5) == "REPLA")
                    {
                        lblQty.Text = "Replaced Qty";
                    }
                    else if (dt.Rows[0]["ActivityName"].ToString() == "PRE PLANTING")
                    {
                        lblQty.Text = "Actual Qty";
                    }
                    else
                    {
                        lblQty.Text = "Actual Qty";
                    }
                    //if (txtActivityName.Text.Substring(0, 3) == "REP")
                    //{
                    //    txtMessage.Visible = true;
                    //    lblMsg.Visible = true;
                    //    lblLangType.Visible = true;
                    //    cbLanguages.Visible = true;
                    //    cbLanguages.SelectedIndex = 0;
                    //}
                    //else
                    //{
                    //    txtMessage.Visible = false;
                    //    lblMsg.Visible = false;
                    //    lblLangType.Visible = false;
                    //    cbLanguages.Visible = false;
                    //}
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Beispiel #6
0
        private void CustomerAddressUpdate_Load(object sender, EventArgs e)
        {
            FillCompanyData();
            objServiceDB = new ServiceDB();
            ds           = objServiceDB.GetECodesforService("", "0");
            UtilityLibrary.PopulateControl(cmbBranch, ds.Tables[1].DefaultView, 1, 0, "-- Please Select --", 0);
            FillFinYear();
            strFormerid        = "";
            txtCustomerid.Text = "";

            if (dtCustDetails.Rows.Count > 0)
            {
                cbCompany.SelectedValue  = dtCustDetails.Rows[0]["CompCode"].ToString();
                cmbBranch.SelectedValue  = dtCustDetails.Rows[0]["branch_code"].ToString();
                cmbFinYear.SelectedValue = dtCustDetails.Rows[0]["fin_year"].ToString();
                txtInvNo.Text            = dtCustDetails.Rows[0]["invoice_number"].ToString();
                txtOrderNo.Text          = dtCustDetails.Rows[0]["order_number"].ToString();
                dtpInvoiceDate.Value     = Convert.ToDateTime(dtCustDetails.Rows[0]["invoice_date"].ToString());
                txtDocMonth.Text         = dtCustDetails.Rows[0]["document_month"].ToString();
                txtVillage.Text          = dtCustDetails.Rows[0]["cm_village"].ToString();
                txtMandal.Text           = dtCustDetails.Rows[0]["cm_mandal"].ToString();
                txtDistrict.Text         = dtCustDetails.Rows[0]["cm_district"].ToString();
                txtState.Text            = dtCustDetails.Rows[0]["CM_STATE"].ToString();
                txtPin.Text          = dtCustDetails.Rows[0]["cm_pin"].ToString();
                txtCustomerName.Text = dtCustDetails.Rows[0]["cm_farmer_name"].ToString();
                txtHouseNo.Text      = dtCustDetails.Rows[0]["cm_house_no"].ToString();
                txtLandMark.Text     = dtCustDetails.Rows[0]["cm_landmark"].ToString();
                txtRelationName.Text = dtCustDetails.Rows[0]["cm_forg_name"].ToString();
                txtMobileNo.Text     = dtCustDetails.Rows[0]["cm_mobile_number"].ToString();
                txtLanLineNo.Text    = dtCustDetails.Rows[0]["cm_land_line_no"].ToString();

                if (dtCustDetails.Rows[0]["cm_marriage_date"].ToString() != "")
                {
                    if (dtCustDetails.Rows[0]["cm_marriage_date"].ToString().Substring(0, 10) + "" == "01/01/1900" || dtCustDetails.Rows[0]["cm_marriage_date"].ToString().Substring(0, 10) + "" == "01-01-1900")
                    {
                        dtpMarrageDate.Value = Convert.ToDateTime(Convert.ToDateTime(CommonData.CurrentDate).ToString("dd/MM/yyy"));
                    }
                    else
                    {
                        dtpMarrageDate.Value = Convert.ToDateTime(Convert.ToDateTime(dtCustDetails.Rows[0]["cm_marriage_date"] + "").ToString("dd/MM/yyy"));
                    }
                }

                if (dtCustDetails.Rows[0]["cm_dob"].ToString() != "")
                {
                    if (dtCustDetails.Rows[0]["cm_dob"].ToString().Substring(0, 10) + "" == "01/01/1900" || dtCustDetails.Rows[0]["cm_dob"].ToString().Substring(0, 10) + "" == "01-01-1900")
                    {
                        dtpDateOfBirth.Value = Convert.ToDateTime(Convert.ToDateTime(CommonData.CurrentDate).ToString("dd/MM/yyy"));
                    }
                    else
                    {
                        dtpDateOfBirth.Value = Convert.ToDateTime(Convert.ToDateTime(dtCustDetails.Rows[0]["cm_dob"] + "").ToString("dd/MM/yyy"));
                    }
                }

                txtAge.Text = dtCustDetails.Rows[0]["cm_age"].ToString();
                // cbCustomer.SelectedValue = dtCustDetails.Rows[0]["farmer_ID"].ToString();
                cbRelation.Text    = dtCustDetails.Rows[0]["cm_so_fo"].ToString();
                strFormerid        = dtCustDetails.Rows[0]["farmer_ID"].ToString();
                txtCustomerid.Text = strFormerid;
            }
        }