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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_comprov_Gift ");

            /// USER [ execute ]

            ArrayList lstContent = new ArrayList();

            ApplicationUtil util = new ApplicationUtil();

            LOG_VendaCartaoGift lvc  = new LOG_VendaCartaoGift(this);
            T_Empresa           emp  = new T_Empresa(this);
            T_Cartao            cart = new T_Cartao(this);
            T_Proprietario      prot = new T_Proprietario(this);

            lvc.ExclusiveAccess();

            if (!lvc.selectIdentity(input_id_gift))
            {
                return(false);
            }

            if (!emp.selectIdentity(lvc.get_fk_empresa()))
            {
                return(false);
            }

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

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

            if (input_tg_reimp == Context.TRUE)
            {
                lstContent.Add("Reimpressão de comprovante de venda giftcard");
                lstContent.Add("");

                DateTime tm = Convert.ToDateTime(lvc.get_dt_compra());

                string data = "Porto Alegre, " + tm.ToLongDateString() + " - " + tm.ToLongTimeString();

                lstContent.Add(data.PadLeft(80, ' '));
            }
            else
            {
                string data = "Porto Alegre, " + DateTime.Now.ToLongDateString() + " - " + DateTime.Now.ToLongTimeString();

                lstContent.Add(data.PadLeft(80, ' '));
            }

            lstContent.Add("");
            lstContent.Add(emp.get_st_social());
            lstContent.Add("GIFTCARD LINDÓIA");

            string num_cart = cart.get_st_empresa() + "." + cart.get_st_matricula() + ".";

            num_cart += util.calculaCodigoAcesso(cart.get_st_empresa(),
                                                 cart.get_st_matricula(),
                                                 cart.get_st_venctoCartao());

            num_cart += ".";
            num_cart += cart.get_st_venctoCartao().PadLeft(4, '0');

            lstContent.Add("Número do cartão: " + num_cart);

            string cod_trans = var_util.DESCript(cart.get_st_matricula() +
                                                 DateTime.Now.Second.ToString().PadLeft(2, '0'),
                                                 "66666666");

            lvc.set_st_codImpresso(cod_trans);

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

            lstContent.Add("Cod. Transação: " + cod_trans);
            lstContent.Add("Cpf do comprador: " + prot.get_st_cpf());
            lstContent.Add("--------------------------------------------");
            lstContent.Add("Valor da carga: R$ " + new money().formatToMoney(lvc.get_vr_carga()));
            lstContent.Add("--------------------------------------------");

            LOG_VendaProdutoGift lvp = new LOG_VendaProdutoGift(this);

            long extras       = 0;
            long total_extras = 0;

            if (lvp.select_fk_venda(input_id_gift))
            {
                extras = lvp.RowCount();
            }

            lstContent.Add("Extras: " + extras.ToString());

            while (lvp.fetch())
            {
                total_extras += lvp.get_int_vr_valor();

                lstContent.Add("-" +
                               lvp.get_st_produto().PadRight(25, ' ') +
                               " R$ " +
                               new money().formatToMoney(lvp.get_vr_valor()));
            }

            lstContent.Add("Total Extras: R$ " + new money().formatToMoney(total_extras.ToString()));

            total_extras += lvc.get_int_vr_carga();

            lstContent.Add("Valor Total: R$ " + new money().formatToMoney(total_extras.ToString()));

            string formPag = "dinheiro";

            if (lvc.get_tg_tipoPag() == TipoPagamento.Cheque)
            {
                formPag = "Cheque (" + lvc.get_st_cheque() + ")";
            }
            else if (lvc.get_tg_tipoPag() == TipoPagamento.Cartao)
            {
                formPag = "Cartão (" + lvc.get_nu_nsuCartao() + ")";
            }

            lstContent.Add("Forma de pagamento: " + formPag);
            lstContent.Add("");
            lstContent.Add("RECEBI O CARTAO GIFTCARD LINDOIA, COMPROMETO-ME A ORIENTAR O");
            lstContent.Add("PRESENTEADO QUANTO AO SEU USO E GUARDA.");
            lstContent.Add("");
            lstContent.Add("_________________________________");
            lstContent.Add(prot.get_st_nome());
            lstContent.Add("");
            lstContent.Add("**Caso o pagamento tenha sido efetuado em cheque, somente estará liberado o uso");
            lstContent.Add("do cartão após a compensação do mesmo");

            for (int t = 0; t < lstContent.Count; ++t)
            {
                DataPortable port = new DataPortable();
                port.setValue("linha", lstContent[t].ToString());
                output_array_generic_lst.Add(port);
            }

            {
                DataPortable port = new DataPortable();
                port.setValue("linha", "");
                output_array_generic_lst.Add(port);
            }


            {
                DataPortable port = new DataPortable();
                port.setValue("linha", "---------------------------------------------------------------");
                output_array_generic_lst.Add(port);
            }


            {
                DataPortable port = new DataPortable();
                port.setValue("linha", "");
                output_array_generic_lst.Add(port);
            }


            for (int t = 0; t < lstContent.Count; ++t)
            {
                DataPortable port = new DataPortable();
                port.setValue("linha", lstContent[t].ToString());
                output_array_generic_lst.Add(port);
            }

            /// USER [ execute ] END

            Registry("execute done fetch_comprov_Gift ");

            return(true);
        }
Exemplo n.º 4
0
 public void copy(ref LOG_VendaProdutoGift cpy)
 {
     fk_vendaCartao = cpy.fk_vendaCartao;
     st_produto     = cpy.st_produto;
     vr_valor       = cpy.vr_valor;
 }
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_rel_fechCaixa ");

            /// USER [ execute ]

            T_Empresa emp = new T_Empresa(this);

            if (!emp.select_rows_empresa(input_st_empresa))
            {
                PublishError("Empresa não disponível");
                return(false);
            }

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

            output_st_nome_empresa = emp.get_st_fantasia();

            T_Quiosque qui = new T_Quiosque(this);

            if (!qui.select_fk_empresa(emp.get_identity()))
            {
                PublishError("Nenhum quiosque disponível");
                return(false);
            }

            while (qui.fetch())
            {
                DadosQuiosque dq = new DadosQuiosque();

                dq.set_st_nome(qui.get_st_nome());

                output_array_generic_lstQuiosques.Add(dq);
            }

            T_Usuario usrQuiosque = new T_Usuario(this);

            if (!usrQuiosque.select_rows_empresa(input_st_empresa))
            {
                PublishError("Nenhum vendedor disponível");
                return(false);
            }

            StringBuilder sb_content = new StringBuilder();

            T_Cartao cart = new T_Cartao(this);

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

            while (usrQuiosque.fetch())
            {
                if (usrQuiosque.get_tg_nivel() != TipoUsuario.VendedorGift &&
                    usrQuiosque.get_tg_nivel() != TipoUsuario.AdminGift)
                {
                    continue;
                }

                if (!lvc.select_rows_vendedor(usrQuiosque.get_identity(),
                                              input_dt_ini,
                                              input_dt_fim))
                {
                    continue;
                }

                qui.selectIdentity(usrQuiosque.get_fk_quiosque());

                while (lvc.fetch())
                {
                    if (!cart.selectIdentity(lvc.get_fk_cartao()))
                    {
                        return(false);
                    }

                    DadosFechCaixa rel_line = new DadosFechCaixa();

                    rel_line.set_st_quiosque(qui.get_st_nome());
                    rel_line.set_st_vendedor(usrQuiosque.get_st_nome());

                    rel_line.set_st_cartao(cart.get_st_empresa() + "." +
                                           cart.get_st_matricula() + "." +
                                           cart.get_st_titularidade());

                    rel_line.set_vr_credito(lvc.get_vr_carga());

                    long tot_prods = 0;
                    long tot       = lvc.get_int_vr_carga();

                    if (lvp.select_fk_venda(lvc.get_identity()))
                    {
                        // primeira sempre é carga ou recarga
                        if (lvp.fetch())
                        {
                            rel_line.set_vr_tarifa(lvp.get_vr_valor());
                        }

                        while (lvp.fetch())
                        {
                            tot_prods += lvp.get_int_vr_valor();
                        }
                    }

                    tot += tot_prods;

                    rel_line.set_vr_prods(tot_prods.ToString());
                    rel_line.set_st_extra(lvc.get_st_cheque());
                    rel_line.set_tg_pagto(lvc.get_tg_tipoPag());
                    rel_line.set_dt_venda(lvc.get_dt_compra());

                    if (cart.get_tg_status() == CartaoStatus.Bloqueado)
                    {
                        if (cart.get_tg_motivoBloqueio() == MotivoBloqueio.CANCELAMENTO)
                        {
                            rel_line.set_st_extra("Cancelado");
                            rel_line.set_tg_pagto("4");
                        }
                    }

                    rel_line.set_vr_total(tot.ToString());

                    // index em memoria, retrieve depois
                    {
                        DataPortable port = rel_line;

                        sb_content.Append(MemorySave(ref port));
                        sb_content.Append(",");
                    }
                }
            }

            // indexa todos os items
            {
                string list_ids = sb_content.ToString().TrimEnd(',');

                if (list_ids == "")
                {
                    PublishNote("Nenhum registro encontrado");
                    return(false);
                }

                DataPortable dp = new DataPortable();

                dp.setValue("ids", list_ids);

                // ## Guarda indexador de grupo

                output_st_csv_contents = MemorySave(ref dp);
            }

            /// USER [ execute ] END

            Registry("execute done fetch_rel_fechCaixa ");

            return(true);
        }