public DesconsiderarNota(string nota,Boolean abrir)
        {
            Nota = nota;
            InitializeComponent();
            lbl_nota.Content = "Nota Fiscal:" + nota + "";
            label.Content = "Abaixo o motivo da desconsideração desta nota.";
            Banco.expedicao_notas banco = Banco.expedicao_notas.Obter("nota='" + nota + "'")[0];
            txt_motivo.Text = banco.Motivo;

            btn_salvar.IsEnabled = false;
            btn_salvar.Visibility = Visibility.Collapsed;
        }
 private void btn_salvar_Click(object sender, RoutedEventArgs e)
 {
     if (moti())
     {
         Banco.expedicao_notas novo = new Banco.expedicao_notas();
         novo.Nota = Nota;
         novo.Motivo = txt_motivo.Text;
         novo.Expedida = false;
         if (novo.Inserir() != -1)
         {
             MsgBox.Show.Info("Cadastrado com sucesso!");
             Sessao.FecharPrograma(this);
         }
         else
         {
             MsgBox.Show.Error("Erro ao cadastrar.");
         }
     }
 }
        private void procurar()
        {
            label12.Content = "";
            label13.Content = "";
            label14.Content = "";
            label15.Content = "";
            label16.Content = "";
            label17.Content = "";
            label18.Content = "";
            label19.Content = "";
            label20.Content = "";
            label21.Content = "";
            try
            {
                Select.SelectDinamico(this, "SELECT *,(SELECT nome FROM produtos p where p.id=e.idprodutos) produto,(SELECT c.estado FROM romaneio r, centrodistribuicao c where r.idcd=c.id and r.id=e.idromaneio) origem FROM expedicao e where e.nota='" + txt_nota.Text + "'");


                string destino = label15.Content + "";
                string origem  = label16.Content + "";

                mapa1.SetarDestino(origem, destino);
            }
            catch {
                try
                {
                    Banco.expedicao_notas nota = Banco.expedicao_notas.Obter("nota='" + txt_nota.Text + "'")[0];
                    if (nota != null)
                    {
                        MsgBox.Show.Error("Essa nota foi desconsiderada para expedição.");
                        Sessao.AbrirPrograma(new Programas.Expedicao.DesconsiderarNota(txt_nota.Text, true), this);
                    }
                    else
                    {
                        MsgBox.Show.Error("Nota não foi encontrada.");
                    }
                }
                catch { MsgBox.Show.Error("Nota não foi encontrada."); }
            }
        }