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); } }
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()); } }
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; } }
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(); } }