Beispiel #1
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute exec_cancelaChequeGift ");

            /// USER [ execute ]

            T_ChequesGift chq = new T_ChequesGift(this);

            chq.ExclusiveAccess();

            if (!chq.select_rows_ident(input_st_ident))
            {
                PublishError("Cheque não disponível");
                return(false);
            }

            if (!chq.fetch())
            {
                return(false);
            }

            if (chq.get_tg_compensado() != Context.FALSE &&              // aguardando
                chq.get_tg_compensado() != Context.TRUE)                 // compensado
            {
                PublishError("Cheque previamente cancelado");
                return(false);
            }
            else if (chq.get_tg_compensado() == Context.TRUE)                 // compensado
            {
                PublishError("Não é possível cancelar cheque compensado");
                return(false);
            }

            chq.set_tg_compensado("2");

            if (!chq.synchronize_T_ChequesGift())
            {
                return(false);
            }

            PublishNote("Cheque " + input_st_ident + " cancelado");

            /// USER [ execute ] END

            Registry("execute done exec_cancelaChequeGift ");

            return(true);
        }
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_consultaCartaoGift ");

            /// USER [ execute ]

            T_Cartao cart = new T_Cartao(this);

            if (!cart.select_rows_empresa_matricula(input_st_empresa.PadLeft(6, '0'),
                                                    input_st_matricula.PadLeft(6, '0')))
            {
                PublishError("Cartão não disponível");
                return(false);
            }

            if (!cart.fetch())
            {
                return(false);
            }

            if (cart.get_tg_status() == CartaoStatus.Bloqueado)
            {
                if (cart.get_tg_motivoBloqueio() == MotivoBloqueio.CANCELAMENTO)
                {
                    output_st_sit = "Cartão cancelado";
                }
                else
                {
                    output_st_sit = "Cartão bloqueado";
                }
            }
            else
            {
                output_st_sit = "Cartão habilitado";
            }

            T_Proprietario prot = new T_Proprietario(this);

            if (!prot.selectIdentity(cart.get_fk_dadosProprietario()))
            {
                PublishError("Cartão não disponível");
                return(false);
            }

            output_st_nome = prot.get_st_nome();
            output_vr_disp = cart.get_vr_limiteTotal();

            LOG_VendaCartaoGift  lvc = new LOG_VendaCartaoGift(this);
            LOG_VendaProdutoGift lvp = new LOG_VendaProdutoGift(this);

            if (lvc.select_fk_cart(cart.get_identity()))
            {
                while (lvc.fetch())
                {
                    DadosConsultaGift dcg     = new DadosConsultaGift();
                    DadosComprovGift  comprov = new DadosComprovGift();

                    comprov.set_id_venda(lvc.get_identity());
                    comprov.set_dt_venda(lvc.get_dt_compra());

                    if (lvc.get_tg_adesao() == Context.TRUE)
                    {
                        dcg.set_st_nome("Primeira Carga de Cartão");
                        comprov.set_st_tipo("CARGA");
                    }
                    else
                    {
                        dcg.set_st_nome("Recarga de Cartão");
                        comprov.set_st_tipo("RECARGA");
                    }

                    comprov.set_vr_valor(lvc.get_vr_carga());
                    dcg.set_vr_valor(lvc.get_vr_carga());

                    output_array_generic_lstProd.Add(dcg);
                    output_array_generic_lstComprov.Add(comprov);

                    if (lvp.select_fk_venda(lvc.get_identity()))
                    {
                        while (lvp.fetch())
                        {
                            DadosConsultaGift in_dcg = new DadosConsultaGift();

                            in_dcg.set_st_nome(lvp.get_st_produto());
                            in_dcg.set_vr_valor(lvp.get_vr_valor());

                            output_array_generic_lstProd.Add(in_dcg);
                        }
                    }
                }
            }

            T_ChequesGift cg = new T_ChequesGift(this);

            if (cg.select_rows_cart_comp(cart.get_identity(), Context.FALSE))
            {
                while (cg.fetch())
                {
                    DadosConsultaGift in_dcg = new DadosConsultaGift();

                    in_dcg.set_st_nome(cg.get_st_identificador());
                    in_dcg.set_dt_data(cg.get_dt_efetiva());
                    in_dcg.set_vr_valor(cg.get_vr_valor());

                    output_array_generic_lstCred.Add(in_dcg);
                }
            }

            /// USER [ execute ] END

            Registry("execute done fetch_consultaCartaoGift ");

            return(true);
        }
Beispiel #3
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_chequeGift ");

            /// USER [ execute ]

            T_ChequesGift chq = new T_ChequesGift(this);

            if (!chq.select_rows_ident(input_st_ident))
            {
                PublishError("Cheque não disponível");
                return(false);
            }

            if (!chq.fetch())
            {
                return(false);
            }

            T_Cartao cart = new T_Cartao(this);

            if (!cart.selectIdentity(chq.get_fk_cartao()))
            {
                return(false);
            }

            T_Proprietario prot = new T_Proprietario(this);

            if (!prot.selectIdentity(cart.get_fk_dadosProprietario()))
            {
                return(false);
            }

            output_st_dados += "Nome: " + prot.get_st_nome() + "@";
            output_st_dados += "CPF: " + prot.get_st_cpf() + "@";
            output_st_dados += "Valor do cheque: R$ " + new money().formatToMoney(chq.get_vr_valor()) + "@@";
            output_st_dados += "Situação: ";

            if (chq.get_tg_compensado() == Context.FALSE)
            {
                output_st_dados += "Aguardando confirmação de depósito";
            }
            else if (chq.get_tg_compensado() == Context.TRUE)
            {
                output_st_dados += "Depósito confirmado";
            }
            else             // 2
            {
                output_st_dados += "Cheque cancelado";
            }

            /// USER [ execute ] END

            Registry("execute done fetch_chequeGift ");

            return(true);
        }