예제 #1
0
 public void copy(ref T_ChequesGift cpy)
 {
     st_identificador = cpy.st_identificador;
     fk_cartao        = cpy.fk_cartao;
     dt_efetiva       = cpy.dt_efetiva;
     tg_compensado    = cpy.tg_compensado;
     vr_valor         = cpy.vr_valor;
 }
예제 #2
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);
        }
예제 #4
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute ins_cartaoGift ");

            /// USER [ execute ]

            input_st_matricula = input_st_matricula.PadLeft(6, '0');

            T_Empresa emp = new T_Empresa(this);

            if (!emp.select_rows_empresa(input_st_empresa))
            {
                return(false);
            }

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

            T_Cartao cart = new T_Cartao(this);

            if (input_tg_tipoPag != TipoPagamento.Cheque)
            {
                cart.ExclusiveAccess();
            }

            if (!cart.select_rows_empresa_matricula(input_st_empresa,
                                                    input_st_matricula))
            {
                return(false);
            }

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

            LOG_VendaCartaoGift lvc = new LOG_VendaCartaoGift(this);

            lvc.set_fk_vendedor(user.get_identity());
            lvc.set_fk_empresa(emp.get_identity());
            lvc.set_fk_cartao(cart.get_identity());
            lvc.set_tg_tipoPag(input_tg_tipoPag);
            lvc.set_dt_compra(GetDataBaseTime());
            lvc.set_tg_tipoCartao(input_tg_tipoCartao);

            if (input_tg_tipoPag == TipoPagamento.Cheque)
            {
                lvc.set_st_cheque(input_st_cheque);

                T_ChequesGift chq_gift = new T_ChequesGift(this);

                chq_gift.set_st_identificador(input_st_cheque);
                chq_gift.set_fk_cartao(cart.get_identity());
                chq_gift.set_dt_efetiva(GetDataBaseTime());
                chq_gift.set_tg_compensado(Context.FALSE);

                if (!chq_gift.create_T_ChequesGift())
                {
                    return(false);
                }
            }
            else
            {
                if (input_tg_tipoPag == TipoPagamento.Cartao)
                {
                    lvc.set_nu_nsuCartao(input_st_cheque);
                }

                cart.set_vr_limiteTotal(cart.get_int_vr_limiteTotal() +
                                        Convert.ToInt64(input_vr_carga));

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

                cart.ReleaseExclusive();
            }

            lvc.set_vr_carga(input_vr_carga);
            lvc.set_tg_adesao(Context.TRUE);

            if (!lvc.create_LOG_VendaCartaoGift())
            {
                return(false);
            }

            output_id_giftCard = lvc.get_identity();

            LOG_VendaProdutoGift lvpg = new LOG_VendaProdutoGift(this);

            for (int t = 0; t < input_array_generic_prod.Count; ++t)
            {
                DadosProdutoGift dpg = new DadosProdutoGift(input_array_generic_prod[t] as DataPortable);

                lvpg.set_fk_vendaCartao(lvc.get_identity());
                lvpg.set_st_produto(dpg.get_st_nome());
                lvpg.set_vr_valor(dpg.get_vr_valor());

                if (!lvpg.create_LOG_VendaProdutoGift())
                {
                    return(false);
                }
            }

            /// USER [ execute ] END

            Registry("execute done ins_cartaoGift ");

            return(true);
        }
예제 #5
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);
        }