protected override String DoIt()
        {
            VAdvantage.Model.X_C_Lead lead = new VAdvantage.Model.X_C_Lead(GetCtx(), _C_Lead_ID, Get_TrxName());
            //  lead.GetRef_BPartner_ID()))
            int ExCustomer = lead.GetC_BPartner_ID();
            int Pospect    = lead.GetRef_BPartner_ID();



            if (ExCustomer != 0)
            {
                VAdvantage.Model.X_C_Project opp = new VAdvantage.Model.X_C_Project(GetCtx(), 0, Get_TrxName());
                opp.SetAD_Client_ID(lead.GetAD_Client_ID());
                opp.SetAD_Org_ID(lead.GetAD_Org_ID());
                opp.SetC_Lead_ID(lead.GetC_Lead_ID());
                opp.SetC_BPartner_ID(lead.GetC_BPartner_ID());

                // Addde by Bharat on 19 Feb 2018 to set Ref Partner/Prospect
                if (opp.Get_ColumnIndex("Ref_BPartner_ID") > 0)
                {
                    opp.SetRef_BPartner_ID(lead.GetC_BPartner_ID());
                }
                opp.SetSalesRep_ID(lead.GetSalesRep_ID());
                opp.SetDateContract(DateTime.Today);
                opp.SetC_Campaign_ID(lead.GetC_Campaign_ID());
                //opp.SetR_Source_ID (lead.GetR_Source_ID());
                // opp.SetOpportunityStatus("N");
                opp.SetAD_User_ID(lead.GetAD_User_ID());
                VAdvantage.Model.X_C_BPartner bp = new VAdvantage.Model.X_C_BPartner(GetCtx(), ExCustomer, Get_TrxName());
                //VAdvantage.Model.X_C_BPartner_Location loc=new VAdvantage.Model.X_C_BPartner_Location (GetCtx(),ExCustomer,Get_TrxName());

                opp.SetName(bp.GetName());;
                opp.SetC_BPartner_Location_ID(lead.GetC_BPartner_Location_ID());
                opp.SetIsOpportunity(true);
                /*Vivek*/
                opp.SetC_EnquiryRdate(lead.GetC_EnquiryRdate());
                if (lead.GetC_ProposalDdate() != null)
                {
                    opp.SetC_ProposalDdate(Convert.ToDateTime(lead.GetC_ProposalDdate()).ToLocalTime());
                }
                else
                {
                    opp.SetC_ProposalDdate(lead.GetC_ProposalDdate());
                }
                if (opp.Save())
                {
                    lead.SetC_Project_ID(opp.GetC_Project_ID());
                    lead.Save();
                    return(Msg.GetMsg(GetCtx(), "OpprtunityGenerateDone"));
                }
                else
                {
                    return(Msg.GetMsg(GetCtx(), "OpprtunityGenerateNotDone"));
                }
            }
            if (Pospect != 0)
            {
                VAdvantage.Model.X_C_Project opp = new VAdvantage.Model.X_C_Project(GetCtx(), 0, Get_TrxName());
                opp.SetAD_Client_ID(lead.GetAD_Client_ID());
                opp.SetAD_Org_ID(lead.GetAD_Org_ID());
                opp.SetC_Lead_ID(lead.GetC_Lead_ID());
                opp.SetC_BPartnerSR_ID(lead.GetRef_BPartner_ID());
                // Addde by Bharat on 19 Feb 2018 to set Ref Partner/Prospect
                if (opp.Get_ColumnIndex("Ref_BPartner_ID") > 0)
                {
                    opp.SetRef_BPartner_ID(lead.GetRef_BPartner_ID());
                }
                opp.SetSalesRep_ID(lead.GetSalesRep_ID());
                opp.SetDateContract(DateTime.Today);
                opp.SetC_Campaign_ID(lead.GetC_Campaign_ID());
                // opp.SetR_Source_ID (lead.GetR_Source_ID());
                //opp.SetOpportunityStatus ("N");
                // opp.SetAD_Client_ID(GetAD_Client_ID());
                opp.SetAD_User_ID(lead.GetAD_User_ID());
                VAdvantage.Model.X_C_BPartner bp = new VAdvantage.Model.X_C_BPartner(GetCtx(), Pospect, Get_TrxName());
                //X_C_BPartner_Location loc = new X_C_BPartner_Location(GetCtx(), Pospect, Get_TrxName());

                opp.SetName(bp.GetName());
                opp.SetC_BPartner_Location_ID(lead.GetC_BPartner_Location_ID());
                opp.SetIsOpportunity(true);
                /*Vivek*/
                opp.SetC_EnquiryRdate(lead.GetC_EnquiryRdate());
                if (lead.GetC_ProposalDdate() != null)
                {
                    opp.SetC_ProposalDdate(Convert.ToDateTime(lead.GetC_ProposalDdate()).ToLocalTime());
                }
                else
                {
                    opp.SetC_ProposalDdate(lead.GetC_ProposalDdate());
                }
                if (opp.Save())
                {
                    lead.SetC_Project_ID(opp.GetC_Project_ID());
                    lead.Save();
                    return(Msg.GetMsg(GetCtx(), "OpprtunityGenerateDone"));
                }
                else
                {
                    return(Msg.GetMsg(GetCtx(), "OpprtunityGenerateNotDone"));
                }
            }
            if (ExCustomer == 0 && Pospect == 0)
            {
                //CallProcess(_C_Lead_ID);
                if (lead.GetBPName() == null)
                {
                    return(Msg.GetMsg(GetCtx(), "Company Name, Prospect or Bpartner is Mandatory to fill"));
                }
                callprospect();
                return(DoIt());
            }

            return(Msg.GetMsg(GetCtx(), "OpprtunityGenerateNotDone"));
        }