@@ -572,6 +572,126 @@ private void BtnCancComprovanteEntrega_Click(object sender, RoutedEventArgs e)
572
572
}
573
573
}
574
574
575
+ private void BtnConciliacaoFinanceira_Click ( object sender , RoutedEventArgs e )
576
+ {
577
+ const string titulo = "Conciliação Financeira NFe" ;
578
+
579
+ try
580
+ {
581
+ #region Conciliação Financeira NFe
582
+
583
+ var idlote = Funcoes . InpuBox ( this , titulo , "Identificador de controle do Lote de envio:" , "1" ) ;
584
+ if ( string . IsNullOrEmpty ( idlote ) ) throw new Exception ( "A Id do Lote deve ser informada!" ) ;
585
+
586
+ var sequenciaEvento = Funcoes . InpuBox ( this , titulo , "Número sequencial do evento:" , "1" ) ;
587
+ if ( string . IsNullOrEmpty ( sequenciaEvento ) )
588
+ throw new Exception ( "O número sequencial deve ser informado!" ) ;
589
+
590
+ var chave = Funcoes . InpuBox ( this , titulo , "Chave da NFe:" , "35240311656919000154550750000008281647961399" ) ;
591
+ if ( string . IsNullOrEmpty ( chave ) ) throw new Exception ( "A Chave deve ser informada!" ) ;
592
+ if ( chave . Length != 44 ) throw new Exception ( "Chave deve conter 44 caracteres!" ) ;
593
+
594
+ var meioPagamento = Funcoes . InpuBox ( this , titulo , "Meio de Pagamento:" , "17" ) ;
595
+ if ( string . IsNullOrEmpty ( meioPagamento ) ) throw new Exception ( "Código do Meio de pagamento deve ser informado!" ) ;
596
+
597
+ var dhPagamentoStr = Funcoes . InpuBox ( this , titulo , "Data de Pagamento:" , DateTime . Now . ToString ( "dd/MM/yyyy" ) ) ;
598
+ if ( string . IsNullOrEmpty ( dhPagamentoStr ) ) throw new Exception ( "A data de pagamento deve ser informada!" ) ;
599
+
600
+ if ( ! DateTime . TryParse ( dhPagamentoStr , out DateTime dhPagamento ) )
601
+ throw new Exception ( "Data inválida!" ) ;
602
+
603
+ decimal ? valorPagamento = null ;
604
+ var valorPagamentoStr = Funcoes . InpuBox ( this , titulo , "Valor do Pagamento:" , "1" ) ;
605
+ if ( string . IsNullOrEmpty ( valorPagamentoStr ) ) throw new Exception ( "Valor do pagamento deve ser informado!" ) ;
606
+ if ( ! string . IsNullOrEmpty ( valorPagamentoStr ) ) valorPagamento = Convert . ToDecimal ( valorPagamentoStr ) ;
607
+
608
+
609
+ var servicoNFe = new ServicosNFe ( _configuracoes . CfgServico ) ;
610
+ var cpfcnpj = string . IsNullOrEmpty ( _configuracoes . Emitente . CNPJ )
611
+ ? _configuracoes . Emitente . CPF
612
+ : _configuracoes . Emitente . CNPJ ;
613
+
614
+ var _pagamento = new Classes . Servicos . Evento . detPagEvento ( )
615
+ {
616
+ tPag = ( FormaPagamento ) Convert . ToInt32 ( meioPagamento ) ,
617
+ dPag = dhPagamento ,
618
+ vPag = valorPagamento . GetValueOrDefault ( )
619
+ } ;
620
+ var retornoConciliacao = servicoNFe . RecepcaoEventoConciliacaoFinanceira ( Convert . ToInt32 ( idlote ) ,
621
+ Convert . ToInt16 ( sequenciaEvento ) , cpfcnpj , chave , new List < Classes . Servicos . Evento . detPagEvento > ( ) { _pagamento } , DFe . Classes . Entidades . Estado . SP ) ;
622
+
623
+ TrataRetorno ( retornoConciliacao ) ;
624
+
625
+ #endregion
626
+ }
627
+ catch ( ComunicacaoException ex )
628
+ {
629
+ Funcoes . Mensagem ( ex . Message , "Erro" , MessageBoxButton . OK ) ;
630
+ }
631
+ catch ( ValidacaoSchemaException ex )
632
+ {
633
+ Funcoes . Mensagem ( ex . Message , "Erro" , MessageBoxButton . OK ) ;
634
+ }
635
+ catch ( Exception ex )
636
+ {
637
+ if ( ! string . IsNullOrEmpty ( ex . Message ) )
638
+ Funcoes . Mensagem ( ex . Message , "Erro" , MessageBoxButton . OK ) ;
639
+ }
640
+ }
641
+
642
+ private void BtnCancConciliacaoFinanceira_Click ( object sender , RoutedEventArgs e )
643
+ {
644
+ const string titulo = "Cancelar Conciliação Financeira NFe" ;
645
+
646
+ try
647
+ {
648
+ #region Cancelar Conciliação Financeira NFe
649
+
650
+ var idlote = Funcoes . InpuBox ( this , titulo , "Identificador de controle do Lote de envio:" , "1" ) ;
651
+ if ( string . IsNullOrEmpty ( idlote ) ) throw new Exception ( "A Id do Lote deve ser informada!" ) ;
652
+
653
+ var sequenciaEvento = Funcoes . InpuBox ( this , titulo , "Número sequencial do evento:" , "1" ) ;
654
+ if ( string . IsNullOrEmpty ( sequenciaEvento ) )
655
+ throw new Exception ( "O número sequencial deve ser informado!" ) ;
656
+
657
+ var chave = Funcoes . InpuBox ( this , titulo , "Chave da NFe:" , "35240311656919000154550750000008281647961399" ) ;
658
+ if ( string . IsNullOrEmpty ( chave ) ) throw new Exception ( "A Chave deve ser informada!" ) ;
659
+ if ( chave . Length != 44 ) throw new Exception ( "Chave deve conter 44 caracteres!" ) ;
660
+
661
+ var nProtEvento = Funcoes . InpuBox ( this , titulo , "Nº Prot Evento:" ) ;
662
+
663
+ if ( string . IsNullOrEmpty ( nProtEvento ) )
664
+ throw new Exception ( "O nº Prot Evento deve ser informado!" ) ;
665
+
666
+
667
+
668
+ var servicoNFe = new ServicosNFe ( _configuracoes . CfgServico ) ;
669
+ var cpfcnpj = string . IsNullOrEmpty ( _configuracoes . Emitente . CNPJ )
670
+ ? _configuracoes . Emitente . CPF
671
+ : _configuracoes . Emitente . CNPJ ;
672
+
673
+ var retornoConciliacao = servicoNFe . RecepcaoEventoCancConciliacaoFinanceira ( Convert . ToInt32 ( idlote ) ,
674
+ Convert . ToInt16 ( sequenciaEvento ) , cpfcnpj , chave , nProtEvento ) ;
675
+
676
+ TrataRetorno ( retornoConciliacao ) ;
677
+
678
+ #endregion
679
+ }
680
+ catch ( ComunicacaoException ex )
681
+ {
682
+ Funcoes . Mensagem ( ex . Message , "Erro" , MessageBoxButton . OK ) ;
683
+ }
684
+ catch ( ValidacaoSchemaException ex )
685
+ {
686
+ Funcoes . Mensagem ( ex . Message , "Erro" , MessageBoxButton . OK ) ;
687
+ }
688
+ catch ( Exception ex )
689
+ {
690
+ if ( ! string . IsNullOrEmpty ( ex . Message ) )
691
+ Funcoes . Mensagem ( ex . Message , "Erro" , MessageBoxButton . OK ) ;
692
+ }
693
+ }
694
+
575
695
private void BtnConsultaXml_Click ( object sender , RoutedEventArgs e )
576
696
{
577
697
try
0 commit comments