Esempio n. 1
0
        public void AddOportunidadeVendas(int idOOPR, string etvProjetistaResp, string medProjetista, string apsProjetista, int etvAmbiente, string descAmb)
        {
            try
            {
                oSalesOpportunities = checked((SAPbobsCOM.SalesOpportunities)conexao.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.oSalesOpportunities));

                if (oSalesOpportunities.GetByKey(idOOPR) == true)
                {
                    //Aba Fases Entrevista
                    if (etvProjetistaResp != "0")
                    {
                        oSalesOpportunities.UserFields.Fields.Item("U_FLX_FB_ETV_RESP").Value = Convert.ToInt32(etvProjetistaResp);
                    }

                    if (medProjetista != "0")
                    {
                        oSalesOpportunities.UserFields.Fields.Item("U_FLX_FB_MED_PROJT").Value = Convert.ToInt32(medProjetista);
                    }

                    //Abas Fase Apresentação
                    if (apsProjetista != "0")
                    {
                        oSalesOpportunities.UserFields.Fields.Item("U_FLX_FB_APS_PROJT").Value = Convert.ToInt32(apsProjetista);
                    }

                    for (int i = 0; i < oSalesOpportunities.Interests.Count; i++)
                    {
                        oSalesOpportunities.Interests.SetCurrentLine(i);
                        /*if (oSalesOpportunities.Interests.InterestId == etvAmbiente)
                        {
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ETV_DESCAMB").Value = descAmb;
                        }*/
                        if (oSalesOpportunities.Interests.RowNo == etvAmbiente)
                        {
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ETV_DESCAMB").Value = descAmb;
                        }
                    }

                    oSalesOpportunities.Update();
                }
            }
            catch (Exception ex)
            {
                SBO_Application.MessageBox(ex.Message, 1, "Ok", "", "");
            }
        }
Esempio n. 2
0
        public void AddAnexoMedicao(int idOOPR)
        {
            try
            {
                SAPbobsCOM.SalesOpportunities oSalesOpportunities = null;
                oSalesOpportunities = checked((SAPbobsCOM.SalesOpportunities)conexao.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.oSalesOpportunities));
                string medAnexoLevantamento = null;
                string elbIniPrev = null;
                string elbTermPrev = null;
                string elbIniRealizado = null;
                string elbTermRealizado = null;
                string elbArqCad = null;
                string elbArqPRJ = null;
                string elbArqJPG = null;
                int elbProjetista = 0;
                string elbDatRevisao = null;
                string apsDetalhamento = null;
                string apvAprovadoPor = null;
                string apvDataApv = null;
                string apvAnexoPdf = null;
                string apvPranchaImagem = null;
                string apvMemorialDescritivo = null;
                string verData = null;
                string verObs = null;
                string verVerificadoPor = null;
                string pedData = null;
                string pedUrl = null;
                string pedNumero = null;
                string pedOrdemCompra = null;
                string pedValor = null;
                string pedSolicitante = null;
                string pedPrazEntrega = null;
                string pedAnexo = null;
                string detIniPrev = null;
                string detTermPrev = null;
                string detIniRealzidado = null;
                string detTermRealizado = null;
                string detAnexo = null;
                int detProjetista = 0;
                string fabExpedicao = null;
                string fabConferente = null;
                string fabRecebimento = null;
                string montResponsavel = null;
                string montDescricao = null;
                string montVstInt1 = null;
                string montVstInt2 = null;
                string montVstInt3 = null;
                string etgDatEntrega = null;
                string etgLaudoEntrega = null;
                string etgResponsavel = null;
                string etgDatSolucao = null;
                bool etgResolvido = false;

                oNewItem = oForm.Items.Item("Med_Amb");
                oMatrix = ((SAPbouiCOM.Matrix)(oNewItem.Specific));

                oNewItem = oForm.Items.Item("Ela_Amb");
                SAPbouiCOM.Matrix matrixElaboracao;
                matrixElaboracao = ((SAPbouiCOM.Matrix)(oNewItem.Specific));

                oNewItem = oForm.Items.Item("Apr_Amb");
                SAPbouiCOM.Matrix matrixApresentacao;
                matrixApresentacao = ((SAPbouiCOM.Matrix)(oNewItem.Specific));

                oNewItem = oForm.Items.Item("Apv_Amb");
                SAPbouiCOM.Matrix matrixAprovacao;
                matrixAprovacao = ((SAPbouiCOM.Matrix)(oNewItem.Specific));

                oNewItem = oForm.Items.Item("Ver_Amb");
                SAPbouiCOM.Matrix matrixVerificacao;
                matrixVerificacao = ((SAPbouiCOM.Matrix)(oNewItem.Specific));

                oNewItem = oForm.Items.Item("Ped_Amb");
                SAPbouiCOM.Matrix matrixPedido;
                matrixPedido = ((SAPbouiCOM.Matrix)(oNewItem.Specific));

                oNewItem = oForm.Items.Item("Det_Amb");
                SAPbouiCOM.Matrix matrixDetalhamento;
                matrixDetalhamento = ((SAPbouiCOM.Matrix)(oNewItem.Specific));

                oNewItem = oForm.Items.Item("Fab_Amb");
                SAPbouiCOM.Matrix matrixFabrica;
                matrixFabrica = ((SAPbouiCOM.Matrix)(oNewItem.Specific));

                oNewItem = oForm.Items.Item("Mon_Amb");
                SAPbouiCOM.Matrix matrixMontagem;
                matrixMontagem = ((SAPbouiCOM.Matrix)(oNewItem.Specific));

                oNewItem = oForm.Items.Item("Etg_Amb");
                SAPbouiCOM.Matrix matrixEntrega;
                matrixEntrega = ((SAPbouiCOM.Matrix)(oNewItem.Specific));

                ArrayList idsAmbientes = ambiente.getIds();

                if (oSalesOpportunities.GetByKey(idOOPR) == true)
                {
                    for (int i = 0; i < oSalesOpportunities.Interests.Count; i++)
                    {
                        oSalesOpportunities.Interests.SetCurrentLine(i);
                        int id = Convert.ToInt32(idsAmbientes[i]);
                        if (oSalesOpportunities.Interests.RowNo == id)
                        {
                            //Instanciar a Grid de Ambientes
                            medAnexoLevantamento = ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Med_Amb_C1").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_MED_LEVANTA").Value = medAnexoLevantamento;

                            //Instanciar a Grid de Elaboração

                            elbDatRevisao = ((SAPbouiCOM.EditText)matrixElaboracao.Columns.Item("Ela_Amb_C1").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ELB_REVISAO").Value = elbDatRevisao;

                            SAPbouiCOM.ComboBox combo;
                            //oItem = oForm.Items.Item("Ela_Amb_C2");
                            combo = (SAPbouiCOM.ComboBox)matrixElaboracao.Columns.Item("Ela_Amb_C2").Cells.Item(i + 1).Specific;
                            if (combo.Value != "")
                            {
                                elbProjetista = Convert.ToInt32(((SAPbouiCOM.ComboBox)matrixElaboracao.Columns.Item("Ela_Amb_C2").Cells.Item(i + 1).Specific).Value);
                                oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ELB_PROJETI").Value = elbProjetista;
                            }

                            elbIniPrev = ((SAPbouiCOM.EditText)matrixElaboracao.Columns.Item("Ela_Amb_C3").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ELB_INICIOP").Value = elbIniPrev;

                            elbTermPrev = ((SAPbouiCOM.EditText)matrixElaboracao.Columns.Item("Ela_Amb_C4").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ELB_TERMINP").Value = elbTermPrev;

                            elbIniRealizado = ((SAPbouiCOM.EditText)matrixElaboracao.Columns.Item("Ela_Amb_C5").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ELB_INICIOR").Value = elbIniRealizado;

                            elbTermRealizado = ((SAPbouiCOM.EditText)matrixElaboracao.Columns.Item("Ela_Amb_C6").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ELB_TERMINR").Value = elbTermRealizado;

                            elbArqCad = ((SAPbouiCOM.EditText)matrixElaboracao.Columns.Item("Ela_Amb_C7").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ELB_ARQCAD").Value = elbArqCad;

                            elbArqPRJ = ((SAPbouiCOM.EditText)matrixElaboracao.Columns.Item("Ela_Amb_C8").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ELB_ARQPRJ").Value = elbArqPRJ;

                            elbArqJPG = ((SAPbouiCOM.EditText)matrixElaboracao.Columns.Item("Ela_Amb_C9").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ELB_ARQJPG").Value = elbArqJPG;

                            //Instanciar a Grid de Verificação
                            verData = ((SAPbouiCOM.EditText)matrixVerificacao.Columns.Item("Ver_Amb_C1").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_VRF_DATEVER").Value = verData;

                            verVerificadoPor = ((SAPbouiCOM.ComboBox)matrixVerificacao.Columns.Item("Ver_Amb_C2").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_VRF_VERIFPO").Value = Convert.ToInt32(verVerificadoPor);

                            verObs = ((SAPbouiCOM.EditText)matrixVerificacao.Columns.Item("Ver_Amb_C3").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_VRF_OBS").Value = verObs;

                            //Instanciar a Grid de Apresentação
                            apsDetalhamento = ((SAPbouiCOM.EditText)matrixApresentacao.Columns.Item("Apr_Amb_C1").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ANC_DETALHA").Value = apsDetalhamento;

                            //Instanciar a Grid de Aprovação
                            apvAprovadoPor = ((SAPbouiCOM.ComboBox)matrixAprovacao.Columns.Item("Apv_Amb_C1").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_APR_APROVAD").Value = Convert.ToInt32(apvAprovadoPor);

                            apvDataApv = ((SAPbouiCOM.EditText)matrixAprovacao.Columns.Item("Apv_Amb_C2").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_APR_DATAAPR").Value = apvDataApv;

                            apvAnexoPdf = ((SAPbouiCOM.EditText)matrixAprovacao.Columns.Item("Apv_Amb_C3").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_APR_PDFCLIE").Value = apvAnexoPdf;

                            apvPranchaImagem = ((SAPbouiCOM.EditText)matrixAprovacao.Columns.Item("Apv_Amb_C4").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_APR_PRANIMG").Value = apvPranchaImagem;

                            apvMemorialDescritivo = ((SAPbouiCOM.EditText)matrixAprovacao.Columns.Item("Apv_Amb_C5").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_APR_MEMDESC").Value = apvMemorialDescritivo;

                            //Instanciar a Grid de Pedidos
                            pedData = ((SAPbouiCOM.EditText)matrixPedido.Columns.Item("Ped_Amb_C1").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_PED_DATE").Value = pedData;

                            pedNumero = ((SAPbouiCOM.EditText)matrixPedido.Columns.Item("Ped_Amb_C2").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_PED_NPEDIDO").Value = pedNumero;

                            pedOrdemCompra = ((SAPbouiCOM.EditText)matrixPedido.Columns.Item("Ped_Amb_C3").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_PED_ORDENDE").Value = pedOrdemCompra;

                            pedValor = ((SAPbouiCOM.EditText)matrixPedido.Columns.Item("Ped_Amb_C4").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_PED_VALOR").Value = pedValor;

                            pedSolicitante = ((SAPbouiCOM.ComboBox)matrixPedido.Columns.Item("Ped_Amb_C5").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_PED_SOLICIT").Value = Convert.ToInt32(pedSolicitante);

                            pedPrazEntrega = ((SAPbouiCOM.EditText)matrixPedido.Columns.Item("Ped_Amb_C6").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_PED_PRAZOEN").Value = pedPrazEntrega;

                            pedAnexo = ((SAPbouiCOM.EditText)matrixPedido.Columns.Item("Ped_Amb_C7").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_PED_ANEXOPE").Value = pedAnexo;

                            pedUrl = ((SAPbouiCOM.EditText)matrixPedido.Columns.Item("Ped_Amb_C8").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_PED_URL").Value = pedUrl;

                            //Instanciar a Grid de Detalhamento

                            combo = (SAPbouiCOM.ComboBox)matrixDetalhamento.Columns.Item("Det_Amb_C2").Cells.Item(i + 1).Specific;
                            if (combo.Value != "")
                            {
                                detProjetista = Convert.ToInt32(((SAPbouiCOM.ComboBox)matrixDetalhamento.Columns.Item("Det_Amb_C2").Cells.Item(i + 1).Specific).Value);
                                oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_DET_PROJETI").Value = detProjetista;
                            }

                            detIniPrev = ((SAPbouiCOM.EditText)matrixDetalhamento.Columns.Item("Det_Amb_C3").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_DET_INICIOP").Value = detIniPrev;

                            detTermPrev = ((SAPbouiCOM.EditText)matrixDetalhamento.Columns.Item("Det_Amb_C4").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_DET_TERMINP").Value = detTermPrev;

                            detIniRealzidado = ((SAPbouiCOM.EditText)matrixDetalhamento.Columns.Item("Det_Amb_C5").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_DET_INICIRE").Value = detIniRealzidado;

                            detTermRealizado = ((SAPbouiCOM.EditText)matrixDetalhamento.Columns.Item("Det_Amb_C6").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_DET_TERMINO").Value = detTermRealizado;

                            detAnexo = ((SAPbouiCOM.EditText)matrixDetalhamento.Columns.Item("Det_Amb_C7").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_DET_PDF").Value = detAnexo;

                            //Instanciar a Grid de Fábrica
                            fabExpedicao = ((SAPbouiCOM.EditText)matrixFabrica.Columns.Item("Fab_Amb_C1").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_FAB_EXPEDIC").Value = fabExpedicao;

                            fabRecebimento = ((SAPbouiCOM.EditText)matrixFabrica.Columns.Item("Fab_Amb_C2").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_FAB_RECEBIM").Value = fabRecebimento;

                            fabConferente = ((SAPbouiCOM.ComboBox)matrixFabrica.Columns.Item("Fab_Amb_C3").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_FAB_CONFERE").Value = Convert.ToInt32(fabConferente);

                            //Instanciar a Grid de Montagem
                            montResponsavel = ((SAPbouiCOM.ComboBox)matrixMontagem.Columns.Item("Mon_Amb_C1").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_MTG_RESPONS").Value = Convert.ToInt32(montResponsavel);

                            montDescricao = ((SAPbouiCOM.EditText)matrixMontagem.Columns.Item("Mon_Amb_C2").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_MTG_DESCRIC").Value = montDescricao;

                            montVstInt1 = ((SAPbouiCOM.EditText)matrixMontagem.Columns.Item("Mon_Amb_C3").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_MTG_VSTINT1").Value = montVstInt1;

                            montVstInt2 = ((SAPbouiCOM.EditText)matrixMontagem.Columns.Item("Mon_Amb_C4").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_MTG_VSTINT2").Value = montVstInt2;

                            montVstInt3 = ((SAPbouiCOM.EditText)matrixMontagem.Columns.Item("Mon_Amb_C5").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_MTG_VSTINT3").Value = montVstInt3;

                            //Instanciar a Grid de Entrega
                            etgDatEntrega = ((SAPbouiCOM.EditText)matrixEntrega.Columns.Item("Etg_Amb_C1").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ENT_ENTREGA").Value = etgDatEntrega;

                            etgResponsavel = ((SAPbouiCOM.ComboBox)matrixEntrega.Columns.Item("Etg_Amb_C2").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ENT_RESPONS").Value = Convert.ToInt32(etgResponsavel);

                            etgLaudoEntrega = ((SAPbouiCOM.EditText)matrixEntrega.Columns.Item("Etg_Amb_C3").Cells.Item(i + 1).Specific).Value;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ENT_LAUDO").Value = etgLaudoEntrega;

                            etgDatSolucao = ((SAPbouiCOM.EditText)matrixEntrega.Columns.Item("Etg_Amb_C4").Cells.Item(i + 1).Specific).String;
                            oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ENT_DATASOL").Value = etgDatSolucao;

                            etgResolvido = ((SAPbouiCOM.CheckBox)matrixEntrega.Columns.Item("Etg_Amb_C5").Cells.Item(i + 1).Specific).Checked;
                            if (etgResolvido)
                            {
                                oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ENT_RESOLVI").Value = 1;
                            }
                            else
                            {
                                oSalesOpportunities.Interests.UserFields.Fields.Item("U_FLX_FB_ENT_RESOLVI").Value = 0;
                            }

                            oSalesOpportunities.Update();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SBO_Application.MessageBox(ex.Message, 1, "Ok", "", "");
            }
        }