Exemplo n.º 1
0
 private void buscaOrcCompleto()
 {
     if ((bsOrcamento.Current as TRegistro_Orcamento) != null)
     {
         (bsOrcamento.Current as TRegistro_Orcamento).lOrcProjeto =
             TCN_OrcProjeto.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                                   (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                                   (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                                   string.Empty,
                                   string.Empty,
                                   null);
         (bsOrcamento.Current as TRegistro_Orcamento).lOrcProjeto.ForEach(p =>
         {
             p.lFicha =
                 TCN_FichaTec.Buscar(p.Cd_empresa,
                                     p.Id_orcamentostr,
                                     p.Nr_versaostr,
                                     p.Id_projetostr,
                                     p.Id_registrostr,
                                     string.Empty,
                                     null);
         });
         //Buscar Despesas
         (bsOrcamento.Current as TRegistro_Orcamento).lDespesas =
             TCN_Despesas.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                                 (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                                 (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                                 string.Empty,
                                 string.Empty,
                                 null);
         //Buscar Tarefas
         (bsOrcamento.Current as TRegistro_Orcamento).lTarefas =
             TCN_Tarefas.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                                (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                                (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                                null);
         //Buscar mao obra
         (bsOrcamento.Current as TRegistro_Orcamento).lMaoObra =
             TCN_CadMaoObra.Busca(
                 (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                 (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                 (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                 string.Empty,
                 null);
         //Buscar encargos
         (bsOrcamento.Current as TRegistro_Orcamento).lOEncargo =
             TCN_OrcamentoEncargo.Buscar(
                 string.Empty,
                 (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                 (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                 (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                 null);
     }
 }
Exemplo n.º 2
0
        private void bsOrcamento_PositionChanged(object sender, EventArgs e)
        {
            if (bsOrcamento.Current != null)
            { //Buscar Atividades
                (bsOrcamento.Current as TRegistro_Orcamento).lOrcProjeto =
                    TCN_OrcProjeto.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                                          (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                                          (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                                          string.Empty,
                                          string.Empty,
                                          null);
                //Buscar Despesas
                (bsOrcamento.Current as TRegistro_Orcamento).lDespesas =
                    TCN_Despesas.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                                        (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                                        (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                                        string.Empty,
                                        string.Empty,
                                        null);
                //Buscar Tarefas
                (bsOrcamento.Current as TRegistro_Orcamento).lTarefas =
                    TCN_Tarefas.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                                       (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                                       (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                                       null);
                //Buscar mao obra
                (bsOrcamento.Current as TRegistro_Orcamento).lMaoObra =
                    TCN_CadMaoObra.Busca(
                        (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                        (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                        (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                        string.Empty,
                        null);
                (bsOrcamento.Current as TRegistro_Orcamento).lOEncargo =
                    TCN_OrcamentoEncargo.Buscar(string.Empty,
                                                (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                                                (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                                                (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr, null);
                calculaEncargos();



                bsOrcamento.ResetCurrentItem();
                bsAtividade_PositionChanged(this, new EventArgs());
            }
        }
Exemplo n.º 3
0
        public static string Excluir(TRegistro_Orcamento val, BancoDados.TObjetoBanco banco)
        {
            bool             st_transacao = false;
            TCD_CadFatDireto qtb_orc      = new TCD_CadFatDireto();

            try
            {
                if (banco == null)
                {
                    st_transacao = qtb_orc.CriarBanco_Dados(true);
                }
                else
                {
                    qtb_orc.Banco_Dados = banco;
                }
                //Excluir despesas
                val.lDespesas.ForEach(p => TCN_Despesas.Excluir(p, qtb_orc.Banco_Dados));
                val.lDespesasDel.ForEach(p => TCN_Despesas.Excluir(p, qtb_orc.Banco_Dados));
                //Excluir Projetos
                val.lOrcProjeto.ForEach(p => TCN_OrcProjeto.Excluir(p, qtb_orc.Banco_Dados));
                val.lOrcProjetoDel.ForEach(p => TCN_OrcProjeto.Excluir(p, qtb_orc.Banco_Dados));
                //Excluir Orcamento
                // qtb_orc.Excluir(val);
                if (st_transacao)
                {
                    qtb_orc.Banco_Dados.Commit_Tran();
                }
                return("OK");
            }
            catch (Exception ex)
            {
                if (st_transacao)
                {
                    qtb_orc.Banco_Dados.RollBack_Tran();
                }
                throw new Exception("Erro excluir orçamento: " + ex.Message.Trim());
            }
            finally
            {
                if (st_transacao)
                {
                    qtb_orc.deletarBanco_Dados();
                }
            }
        }
Exemplo n.º 4
0
 private void bsOrcamento_PositionChanged(object sender, EventArgs e)
 {
     if (bsOrcamento.Current != null)
     {
         (bsOrcamento.Current as TRegistro_Orcamento).lOrcProjeto =
             TCN_OrcProjeto.Buscar(vCd_Empresa, vId_Orcamento, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, string.Empty, string.Empty, null);
         (bsOrcamento.Current as TRegistro_Orcamento).lDespesas =
             TCN_Despesas.Buscar(vCd_Empresa, vId_Orcamento, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, string.Empty, string.Empty, null);
         (bsOrcamento.Current as TRegistro_Orcamento).lMaoObra =
             TCN_CadMaoObra.Busca(vId_Orcamento, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, vCd_Empresa, string.Empty, null);
         (bsOrcamento.Current as TRegistro_Orcamento).lOEncargo =
             TCN_OrcamentoEncargo.Buscar(string.Empty, vCd_Empresa, (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, vId_Orcamento, null);
         bsOrcamento.ResetCurrentItem();
         bsAtividade.ResetCurrentItem();
         bsAtividade_PositionChanged(this, new EventArgs());
         bsAtividade.ResetCurrentItem();
         edit_tot_orcamento_cont.Value = decimal.Add(edit_custo_orcamento.Value, decimal.Multiply(edit_custo_orcamento.Value, decimal.Divide((bsOrcamento.Current as TRegistro_Orcamento).Pc_margemcont, 100)));
         tot_comissao.Value            = decimal.Multiply((bsOrcamento.Current as TRegistro_Orcamento).total_orcamento, decimal.Divide((bsOrcamento.Current as TRegistro_Orcamento).Pc_comissao, 100));
         total_comi = tot_comissao.Value;
     }
 }
Exemplo n.º 5
0
        private void bsOrcamento_PositionChanged(object sender, EventArgs e)
        {
            if (bsOrcamento.Current != null)
            {
                if ((bsOrcamento.Current as TRegistro_Orcamento).lOrcProjeto.Count <= 0)
                {
                    //Buscar Atividades
                    (bsOrcamento.Current as TRegistro_Orcamento).lOrcProjeto =
                        TCN_OrcProjeto.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                                              (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                                              (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                                              string.Empty,
                                              string.Empty,
                                              null);
                }
                (bsOrcamento.Current as TRegistro_Orcamento).lRequisitos =
                    TCN_RequisitoORc.Buscar(string.Empty, (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa, (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                                            (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr, null);


                (bsOrcamento.Current as TRegistro_Orcamento).lOrcProjeto.ForEach(p =>
                {
                    p.lFicha = TCN_FichaTec.Buscar(p.Cd_empresa,
                                                   p.Id_orcamentostr,
                                                   (p).Nr_versaostr,
                                                   p.Id_projetostr,
                                                   p.Id_registrostr,
                                                   "",
                                                   null);



                    p.lFicha.ForEach(o => {
                        o.quantidade_agregar = o.Quantidade;
                    });
                });

                if ((bsOrcamento.Current as TRegistro_Orcamento).lDespesas.Count <= 0)
                {
                    //Buscar Despesas
                    (bsOrcamento.Current as TRegistro_Orcamento).lDespesas =
                        TCN_Despesas.Buscar((bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                                            (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                                            (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                                            string.Empty,
                                            string.Empty,
                                            null);
                }
                if ((bsOrcamento.Current as TRegistro_Orcamento).lMaoObra.Count <= 0)
                {
                    //Buscar mao obra
                    (bsOrcamento.Current as TRegistro_Orcamento).lMaoObra =
                        CamadaNegocio.Empreendimento.Cadastro.TCN_CadMaoObra.Busca(
                            (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                            (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                            (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                            string.Empty,
                            null);
                }
                if ((bsOrcamento.Current as TRegistro_Orcamento).lOEncargo.Count <= 0)
                {
                    //Buscar encargos
                    (bsOrcamento.Current as TRegistro_Orcamento).lOEncargo =
                        CamadaNegocio.Empreendimento.Cadastro.TCN_OrcamentoEncargo.Buscar(
                            string.Empty,
                            (bsOrcamento.Current as TRegistro_Orcamento).Cd_empresa,
                            (bsOrcamento.Current as TRegistro_Orcamento).Nr_versaostr,
                            (bsOrcamento.Current as TRegistro_Orcamento).Id_orcamentostr,
                            null);
                }
                bsOrcamento.ResetCurrentItem();
                bsProjeto_PositionChanged(this, new EventArgs());
                bsProjeto.ResetCurrentItem();
            }
        }