Ejemplo n.º 1
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                ctrl_TxtDtIni.AcquireTextBox(i_Form.TxtDtIni, this, event_val_TxtDtIni, dateTextController.FORMAT_DDMMYYYY);
                ctrl_TxtDtFim.AcquireTextBox(i_Form.TxtDtFim, this, event_val_TxtDtFim, dateTextController.FORMAT_DDMMYYYY);

                ctrl_TxtDtIni.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtDtFim.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                ctrl_TxtDtIni.SetTextBoxText("01" +
                                             DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                             DateTime.Now.Year.ToString().PadLeft(4, '0'));


                ctrl_TxtDtFim.SetTextBoxText("15" +
                                             DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                             DateTime.Now.Year.ToString().PadLeft(4, '0'));


                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtIni -

            case event_val_TxtDtIni:
            {
                //InitEventCode event_val_TxtDtIni

                switch (arg as string)
                {
                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtIni.BackColor     = Color.White;
                    ctrl_TxtDtIni.IsUserValidated = true;
                    ctrl_TxtDtIni.CleanError();
                    break;
                }

                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDtIni.BackColor     = colorInvalid;
                    ctrl_TxtDtIni.IsUserValidated = false;
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtFim -

            case event_val_TxtDtFim:
            {
                //InitEventCode event_val_TxtDtFim

                switch (arg as string)
                {
                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtFim.BackColor     = Color.White;
                    ctrl_TxtDtFim.IsUserValidated = true;
                    ctrl_TxtDtFim.CleanError();
                    break;
                }

                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDtFim.BackColor     = colorInvalid;
                    ctrl_TxtDtFim.IsUserValidated = false;
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                bool bOk = true;

                if (!ctrl_TxtDtFim.IsUserValidated)
                {
                    ctrl_TxtDtFim.SetErrorMessage("Informe o dia final");
                    bOk = false;
                }

                if (!ctrl_TxtDtIni.IsUserValidated)
                {
                    ctrl_TxtDtIni.SetErrorMessage("Informe o dia inicial");
                    bOk = false;
                }

                if (i_Form.CboRelat.SelectedIndex == -1)
                {
                    MessageBox.Show("Informe a opção de cobrança", "Aviso");
                    bOk = false;
                }

                if (!bOk)
                {
                    return(false);
                }

                i_Form.BtnConfirmar.Enabled = false;

                if (i_Form.CboRelat.SelectedIndex == 0)
                {
                    #region - pendentes com detalhe -

                    // ##############################
                    // # SETUP LISTS ################
                    // ##############################

                    ArrayList lstHeader     = new ArrayList();
                    ArrayList lstContent    = new ArrayList();
                    ArrayList lstTableSizes = new ArrayList();
                    ArrayList lstFooter     = new ArrayList();
                    ArrayList lstMessages   = new ArrayList();
                    ArrayList lstFilters    = new ArrayList();

                    // ##############################
                    // # CUSTOMIZE
                    // ##############################

                    string output_st_total                 = "";
                    string output_st_total_desconto        = "";
                    string output_st_csv_subtotal          = "";
                    string output_st_csv_subtotal_desconto = "";
                    string output_st_content_block         = "";
                    string output_st_emp_loj_block         = "";

                    string output_CartaoAtiv = "";
                    string output_Extras     = "";
                    string output_FixoTrans  = "";
                    string output_Percent    = "";
                    string output_TBM        = "";

                    i_Form.Visible = false;

                    dlgStatus stat = new dlgStatus("Relatório");

                    stat.LblActivity.Text = "Processando relatório no servidor";
                    stat.Show();
                    Application.DoEvents();

                    if (!var_exchange.fetch_rel_6_fat(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()),
                                                      var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddDays(1)),
                                                      ref header,
                                                      ref output_st_total,
                                                      ref output_st_total_desconto,
                                                      ref output_st_csv_subtotal,
                                                      ref output_st_csv_subtotal_desconto,
                                                      ref output_st_content_block,
                                                      ref output_st_emp_loj_block,
                                                      ref output_CartaoAtiv,
                                                      ref output_Extras,
                                                      ref output_FixoTrans,
                                                      ref output_Percent,
                                                      ref output_TBM))
                    {
                        stat.Close();
                        return(false);
                    }

                    stat.LblActivity.Text = "Buscando detalhes de faturamento";
                    Application.DoEvents();

                    // index de todos os itens de cobrança
                    Hashtable hsh_Memory = new Hashtable();

                    while (output_st_content_block != "")
                    {
                        ArrayList tmp_memory = new ArrayList();

                        if (var_exchange.fetch_memory(output_st_content_block, "200",
                                                      ref output_st_content_block,
                                                      ref tmp_memory))
                        {
                            for (int t = 0; t < tmp_memory.Count; ++t)
                            {
                                Rel_FAT f_t = new Rel_FAT(tmp_memory [t] as DataPortable);

                                if (hsh_Memory [f_t.get_fk_fatura()] == null)
                                {
                                    hsh_Memory [f_t.get_fk_fatura()] = new ArrayList();
                                }

                                ArrayList tmp = hsh_Memory [f_t.get_fk_fatura()] as ArrayList;

                                tmp.Add(f_t);
                            }
                        }
                    }

                    // lista de todas as empresas e lojas
                    ArrayList full_memory_ent = new ArrayList();

                    stat.LblActivity.Text = "Buscando lista de lojas e empresas";
                    Application.DoEvents();

                    while (output_st_emp_loj_block != "")
                    {
                        ArrayList tmp_memory = new ArrayList();

                        if (var_exchange.fetch_memory(output_st_emp_loj_block, "200",
                                                      ref output_st_emp_loj_block,
                                                      ref tmp_memory))
                        {
                            for (int t = 0; t < tmp_memory.Count; ++t)
                            {
                                Entidade ent = new Entidade(tmp_memory[t] as DataPortable);

                                full_memory_ent.Add(ent);
                            }
                        }
                    }

                    stat.LblActivity.Text = "Gerando relatório para web";
                    Application.DoEvents();

                    stat.pgStatus.Maximum = full_memory_ent.Count;
                    stat.pgStatus.Minimum = 0;

                    money money_helper = new money();

                    // tradução do indice para texto
                    ArrayList desc = new TipoFatDesc().GetArray();

                    // Passa por todas as empresas e lojas
                    for (int g = 0; g < full_memory_ent.Count; ++g)
                    {
                        Entidade ent = full_memory_ent [g] as Entidade;

                        stat.pgStatus.Value = g + 1;

                        Application.DoEvents();

                        // Sub-título
                        lstMessages.Add(ent.get_st_nome());
                        lstTableSizes.Add(500);

                        ArrayList lst_sub_tbl_head = new ArrayList();

                        lst_sub_tbl_head.Add("Descrição de item faturado");
                        lst_sub_tbl_head.Add("Valor Cobrança R$");

                        lstHeader.Add(lst_sub_tbl_head);

                        // Lista de items
                        ArrayList my_cobranca = new ArrayList();

                        // Obtem index da memoria
                        ArrayList lstMemory = hsh_Memory [ent.get_fk_fatura()] as ArrayList;

                        if (lstMemory == null)
                        {
                            my_cobranca.Add(new ArrayList());
                        }
                        else
                        {
                            for (int t = 0; t < lstMemory.Count; ++t)
                            {
                                Rel_FAT f_t = lstMemory [t] as Rel_FAT;

                                // Lista de items para uma linha
                                ArrayList lst_sub_content = new ArrayList();

                                string st_desc = "";
                                string vr_cob  = "";

                                switch (f_t.get_tg_tipoFat())
                                {
                                case TipoFat.Extras:            st_desc = "Extra: " + f_t.get_st_extra();       break;

                                case TipoFat.TBM:                       st_desc = "Tarifa básica mensal";                       break;

                                case TipoFat.CartaoAtiv:        st_desc = "Tarifa por cartões ativos";          break;

                                case TipoFat.FixoTrans:         st_desc = "Valor sobre Transações";             break;

                                case TipoFat.Percent:           st_desc = "Percentual sobre Transações";        break;

                                default: break;
                                }

                                if (f_t.get_tg_desconto() == Context.TRUE)
                                {
                                    vr_cob = "-" + f_t.get_vr_cob();
                                }
                                else
                                {
                                    vr_cob = f_t.get_vr_cob();
                                }

                                lst_sub_content.Add(st_desc);
                                lst_sub_content.Add(money_helper.formatToMoney(vr_cob));

                                my_cobranca.Add(lst_sub_content);
                            }
                        }

                        lstContent.Add(my_cobranca);

                        ArrayList lst_sub_foot = new ArrayList();

                        var_util.indexCSV(output_st_csv_subtotal);
                        lst_sub_foot.Add("Sub-Total: R$ " + money_helper.formatToMoney(var_util.getCSV(g)));

                        var_util.indexCSV(output_st_csv_subtotal_desconto);
                        lst_sub_foot.Add("Sub-Total desconto: R$ " + money_helper.formatToMoney(var_util.getCSV(g)));

                        if (g == full_memory_ent.Count - 1)
                        {
                            lst_sub_foot.Add("");
                            lst_sub_foot.Add("Total de faturamento no período: R$ " + money_helper.formatToMoney(output_st_total));
                            lst_sub_foot.Add("Total em descontos no faturamento no período: R$ " + money_helper.formatToMoney(output_st_total_desconto));
                            lst_sub_foot.Add("");
                            lst_sub_foot.Add("Valor em cartões ativos: " + money_helper.formatToMoney(output_CartaoAtiv));
                            lst_sub_foot.Add("Valor em despesas extras: " + money_helper.formatToMoney(output_Extras));
                            lst_sub_foot.Add("Valor fixo por transações: " + money_helper.formatToMoney(output_FixoTrans));
                            lst_sub_foot.Add("Valor por percentual em transações: " + money_helper.formatToMoney(output_Percent));
                            lst_sub_foot.Add("Valor em mensalidades: " + money_helper.formatToMoney(output_TBM));
                        }

                        lstFooter.Add(lst_sub_foot);
                    }

                    stat.Close();

                    SyCrafReport rel = new SyCrafReport("Relatório de faturamento pendente",
                                                        "RFP",
                                                        "",
                                                        ctrl_TxtDtIni.getTextBoxValue(),
                                                        ctrl_TxtDtFim.getTextBoxValue(),
                                                        ref lstHeader,
                                                        ref lstContent,
                                                        ref lstTableSizes,
                                                        ref lstFooter,
                                                        ref lstMessages,
                                                        ref lstFilters);

                    #endregion
                }
                else
                {
                    #region - pagos -

                    // ##############################
                    // # SETUP LISTS ################
                    // ##############################

                    ArrayList lstHeader     = new ArrayList();
                    ArrayList lstContent    = new ArrayList();
                    ArrayList lstTableSizes = new ArrayList();
                    ArrayList lstFooter     = new ArrayList();
                    ArrayList lstMessages   = new ArrayList();
                    ArrayList lstFilters    = new ArrayList();

                    // ##############################
                    // # CUSTOMIZE
                    // ##############################

                    string output_st_total         = "";
                    string output_st_content_block = "";

                    int sel = i_Form.CboRelat.SelectedIndex;

                    string tg_type = "";
                    string st_rel  = "";

                    switch (sel)
                    {
                    case 1:         tg_type = TipoSitFat.EmCobrança;        st_rel = "Relatório de faturamento em cobrança";                                               break;

                    case 2:         tg_type = TipoSitFat.PagoDoc;           st_rel = "Relatório de faturamento pago com doc";                                              break;

                    case 3:         tg_type = TipoSitFat.PagoCC;            st_rel = "Relatório de faturamento pago em débito em conta";                   break;

                    case 4:         tg_type = TipoSitFat.BaixaCfeInst;      st_rel = "Relatório de faturamento baixado conforme instrução banco";  break;
                    }

                    dlgStatus stat = new dlgStatus("Relatório");

                    stat.LblActivity.Text = "Processando relatório no servidor";
                    stat.Show();
                    Application.DoEvents();

                    if (!var_exchange.fetch_relFat(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()),
                                                   var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddDays(1)),
                                                   tg_type,
                                                   ref header,
                                                   ref output_st_total,
                                                   ref output_st_content_block))
                    {
                        stat.Close();
                        i_Form.BtnConfirmar.Enabled = true;
                        return(false);
                    }

                    stat.LblActivity.Text = "Buscando detalhes de faturamento";
                    Application.DoEvents();

                    ArrayList full_memory = new ArrayList();

                    ArrayList sortMem = new ArrayList();

                    while (output_st_content_block != "")
                    {
                        ArrayList tmp_memory = new ArrayList();

                        if (var_exchange.fetch_memory(output_st_content_block, "500",
                                                      ref output_st_content_block,
                                                      ref tmp_memory))
                        {
                            for (int t = 0; t < tmp_memory.Count; ++t)
                            {
                                Rel_FatCompleto tmp = new Rel_FatCompleto(tmp_memory[t] as DataPortable);

                                sortMem.Add(tmp.get_st_nome());

                                full_memory.Add(tmp);
                            }
                        }
                    }

                    sortMem.Sort();

                    stat.LblActivity.Text = "Gerando relatório para web";
                    Application.DoEvents();

                    stat.pgStatus.Maximum = full_memory.Count;
                    stat.pgStatus.Minimum = 0;

                    money money_helper = new money();

                    ArrayList lst_sub_tbl_head = new ArrayList();

                    lst_sub_tbl_head.Add("Empresa/Loja");
                    lst_sub_tbl_head.Add("Cobrança R$");
                    lst_sub_tbl_head.Add("Vencimento");
                    lst_sub_tbl_head.Add("Cód. Banco");
                    lst_sub_tbl_head.Add("Mensagem");
                    lst_sub_tbl_head.Add("Data Baixa");

                    lstHeader.Add(lst_sub_tbl_head);

                    // Sub-título
                    lstMessages.Add("");
                    lstTableSizes.Add(800);

                    ArrayList lst_lines = new ArrayList();

                    for (int g = 0; g < sortMem.Count; ++g)
                    {
                        stat.pgStatus.Value = g + 1;
                        Application.DoEvents();

                        for (int u = 0; u < full_memory.Count; ++u)
                        {
                            Rel_FatCompleto rel = full_memory [u] as Rel_FatCompleto;

                            if (rel.get_st_nome() != sortMem[g].ToString())
                            {
                                continue;
                            }

                            // Lista de items para uma linha
                            ArrayList lst_sub_content = new ArrayList();

                            lst_sub_content.Add(rel.get_st_nome());
                            lst_sub_content.Add(money_helper.formatToMoney(rel.get_vr_cobranca()));
                            lst_sub_content.Add(var_util.getDDMMYYYY_format(rel.get_dt_vencimento()).Substring(0, 10));

                            if (rel.get_dt_baixa() == "")
                            {
                                lst_sub_content.Add("-");
                                lst_sub_content.Add("-");
                                lst_sub_content.Add("-");
                            }
                            else
                            {
                                lst_sub_content.Add(rel.get_cod_retBanco());
                                lst_sub_content.Add(rel.get_st_msgBanco());
                                lst_sub_content.Add(var_util.getDDMMYYYY_format(rel.get_dt_baixa()).Substring(0, 10));
                            }

                            lst_lines.Add(lst_sub_content);

                            if (g == full_memory.Count - 1)
                            {
                                ArrayList lst_sub_foot = new ArrayList();

                                lst_sub_foot.Add("Total contabilizado no período: R$ " +
                                                 money_helper.formatToMoney(output_st_total));

                                lstFooter.Add(lst_sub_foot);
                            }
                        }
                    }

                    lstContent.Add(lst_lines);

                    stat.Close();
                    Application.DoEvents();

                    SyCrafReport relat = new SyCrafReport(st_rel,
                                                          "RFD",
                                                          "Lista completa de empresas e lojas",
                                                          ctrl_TxtDtIni.getTextBoxValue(),
                                                          ctrl_TxtDtFim.getTextBoxValue(),
                                                          ref lstHeader,
                                                          ref lstContent,
                                                          ref lstTableSizes,
                                                          ref lstFooter,
                                                          ref lstMessages,
                                                          ref lstFilters);
                    #endregion
                }

                i_Form.BtnConfirmar.Enabled = true;

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

            case event_BtnConfirmarClick:
            {
                //InitEventCode event_BtnConfirmarClick
                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                if (header.get_tg_user_type() == TipoUsuario.Lojista)
                {
                    ArrayList lst = new ArrayList();

                    var_exchange.fetch_lojistaEmpresas(header.get_st_empresa(), ref header, ref lst);

                    for (int t = 0; t < lst.Count; ++t)
                    {
                        DadosEmpresa de = new DadosEmpresa(lst[t] as DataPortable);

                        i_Form.LstEmp.Items.Add(de.get_st_empresa() + " " + de.get_st_fantasia());
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                if (i_Form.LstEmp.SelectedIndex == -1)
                {
                    return(false);
                }

                string st_empresa = i_Form.LstEmp.SelectedItem.ToString();

                st_empresa = st_empresa.Substring(0, st_empresa.IndexOf(" "));

                // ##############################
                // # SETUP LISTS ################
                // ##############################

                ArrayList lstHeader     = new ArrayList();
                ArrayList lstContent    = new ArrayList();
                ArrayList lstTableSizes = new ArrayList();
                ArrayList lstFooter     = new ArrayList();
                ArrayList lstMessages   = new ArrayList();
                ArrayList lstFilters    = new ArrayList();

                // ##############################
                // # CUSTOMIZE
                // ##############################

                string st_csv_contents = "";

                dlgStatus stat = new dlgStatus("Relatório");

                stat.LblActivity.Text = "Processando relatório no servidor";
                stat.Show();
                Application.DoEvents();

                if (!var_exchange.fetch_rel_prevLojista(st_empresa,
                                                        ref header,
                                                        ref st_csv_contents))
                {
                    stat.Close();
                    return(false);
                }

                ArrayList full_memory = new ArrayList();

                stat.LblActivity.Text = "Buscando detalhes...";
                Application.DoEvents();

                while (st_csv_contents != "")
                {
                    ArrayList tmp_memory = new ArrayList();

                    if (var_exchange.fetch_memory(st_csv_contents, "400", ref st_csv_contents, ref tmp_memory))
                    {
                        for (int t = 0; t < tmp_memory.Count; ++t)
                        {
                            full_memory.Add(tmp_memory[t]);
                        }
                    }
                }

                money money_helper = new money();

                stat.LblActivity.Text = "Gerando relatório para web";
                Application.DoEvents();

                lstMessages.Add("Transações confirmadas para a loja: " + header.get_st_empresa());

                lstTableSizes.Add(650);

                ArrayList lst_sub_tbl_head = new ArrayList();

                lst_sub_tbl_head.Add("Cartão");
                lst_sub_tbl_head.Add("NSU");
                lst_sub_tbl_head.Add("Data e Hora");
                lst_sub_tbl_head.Add("Parcela");
                lst_sub_tbl_head.Add("Valor R$");
                lst_sub_tbl_head.Add("Valor Repasse R$");

                lstHeader.Add(lst_sub_tbl_head);

                long tot_repasse = 0;

                ArrayList my_line_container = new ArrayList();

                for (int t = 0; t < full_memory.Count; ++t)
                {
                    DadosRepasse dr = new DadosRepasse(full_memory[t] as DataPortable);

                    ArrayList lst_line_content = new ArrayList();

                    lst_line_content.Add(dr.get_st_cartao());
                    lst_line_content.Add(dr.get_st_nsu());
                    lst_line_content.Add(var_util.getDDMMYYYY_format(dr.get_dt_trans()));
                    lst_line_content.Add(dr.get_id_parcela());
                    lst_line_content.Add(money_helper.formatToMoney(dr.get_vr_total()));
                    lst_line_content.Add(money_helper.formatToMoney(dr.get_vr_repasse()));

                    tot_repasse += Convert.ToInt64(dr.get_vr_repasse());

                    my_line_container.Add(lst_line_content);
                }

                lstContent.Add(my_line_container);

                ArrayList lst_sub_foot = new ArrayList();

                lst_sub_foot.Add("Total de repasse: " + money_helper.formatToMoney(tot_repasse.ToString()));

                lstFooter.Add(lst_sub_foot);

                stat.Close();

                SyCrafReport rel = new SyCrafReport("Relatório de previsão de repasse ao lojista",
                                                    "RPR",
                                                    i_Form.LstEmp.SelectedItem.ToString(),
                                                    var_util.getDDMMYYYY_format(DateTime.Now.ToString()),
                                                    "",
                                                    ref lstHeader,
                                                    ref lstContent,
                                                    ref lstTableSizes,
                                                    ref lstFooter,
                                                    ref lstMessages,
                                                    ref lstFilters);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

            case event_BtnConfirmarClick:
            {
                //InitEventCode event_BtnConfirmarClick
                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
Ejemplo n.º 3
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                i_Form.TxtLoja.Text  = st_loja;
                i_Form.TxtValor.Text = "R$ " + new money().formatToMoney(vr_valor);

                ctrl_TxtIdent.AcquireTextBox(i_Form.TxtIdent, this, event_val_TxtIdent, 20);

                string banco = "";
                string ag    = "";
                string conta = "";

                var_exchange.fetch_convenioLojaGift(st_codLoja, ref header, ref banco, ref ag, ref conta);

                i_Form.TxtBanco.Text   = banco;
                i_Form.TxtAgencia.Text = ag;
                i_Form.TxtConta.Text   = conta;

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                if (!i_Form.rbCheque.Checked &&
                    !i_Form.rbDep.Checked &&
                    !i_Form.rbDinheiro.Checked)
                {
                    return(false);
                }

                if (i_Form.rbCheque.Checked &&
                    !ctrl_TxtIdent.IsUserValidated)
                {
                    MessageBox.Show("Preencha a identificação do cheque", "Aviso");
                    return(false);
                }

                string tg_opcao = "0";                         // dinheiro

                if (i_Form.rbCheque.Checked)
                {
                    tg_opcao = "1";
                }
                if (i_Form.rbDep.Checked)
                {
                    tg_opcao = "2";
                }

                vr_valor = vr_valor.Replace("R$", "");

                var_exchange.exec_repasseLoja(st_codLoja,
                                              tg_opcao,
                                              ctrl_TxtIdent.getTextBoxValue(),
                                              new money().getNumericValue(vr_valor).ToString(),
                                              ref header,
                                              ref lstParcelas,
                                              ref id_confRepasse);


                bool IsPrinted = false;

                while (!IsPrinted)
                {
                    PrintDocument pd      = new PrintDocument();
                    PrintDialog   pDialog = new PrintDialog();

                    pDialog.Document = pd;

                    PrintPreviewDialog prevDialog = new PrintPreviewDialog();
                    prevDialog.Document = pd;

                    pd.PrintPage += new PrintPageEventHandler(i_Form.Inven_Report);
                    prevDialog.ShowDialog();

                    if (pDialog.ShowDialog() == DialogResult.OK)
                    {
                        pd.Print();
                    }

                    if (MessageBox.Show("Imprimiiu corretamente?",
                                        "Aviso",
                                        MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Question,
                                        MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        IsPrinted = true;
                    }
                }

                i_Form.Close();

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtIdent -

            case event_val_TxtIdent:
            {
                //InitEventCode event_val_TxtIdent

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (i_Form.TxtIdent.Text.Length > 0)
                    {
                        i_Form.TxtIdent.BackColor     = Color.White;
                        ctrl_TxtIdent.IsUserValidated = true;
                        ctrl_TxtIdent.CleanError();
                    }
                    else
                    {
                        i_Form.TxtIdent.BackColor     = colorInvalid;
                        ctrl_TxtIdent.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Print -

            case event_Print:
            {
                //InitEventCode event_Print

                DadosRepRecibo drr = new DadosRepRecibo();

                ArrayList lstRec = new ArrayList();

                var_exchange.fetch_reciboRepasse(id_confRepasse,
                                                 ref header,
                                                 ref drr,
                                                 ref lstRec);

                PrintPageEventArgs e = arg as PrintPageEventArgs;

                Graphics g      = e.Graphics;
                int      n      = 0;
                Font     myFont = new Font("Courier New", 10);

                try
                {
                    g.DrawString("RECIBO DE CONFIRMAÇÃO DO REPASSE FINANCEIRO", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString(DateTime.Now.ToLongDateString().ToUpper(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("Nome da loja: " + drr.get_loja(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("CNPJ: " + drr.get_cnpj(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;

                    if (drr.get_pagto() == TipoPagamento.Dinheiro)
                    {
                        g.DrawString("Forma pagamento: dinheiro ", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    }
                    else if (drr.get_pagto() == TipoPagamento.Cheque)
                    {
                        g.DrawString("Forma pagamento: Cheque " + drr.get_st_extra(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    }
                    else
                    {
                        g.DrawString("Forma pagamento: Depósito " + drr.get_st_extra(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    }

                    string tipo_pag = "";

                    g.DrawString(tipo_pag, myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("Cartão            Data e Hora          NSU       Valor     Data Vencimento", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("------------------------------------------------------------------------------------", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;

                    for (int t = 0; t < lstRec.Count; ++t)
                    {
                        DadosRepasse port = new DadosRepasse(lstRec[t] as DataPortable);

                        string line = port.get_st_cartao().PadRight(18, ' ');

                        line += var_util.getDDMMYYYY_format(port.get_dt_trans()).PadRight(21, ' ');
                        line += port.get_st_nsu().PadRight(10, ' ');
                        line += new money().formatToMoney(port.get_vr_total()).PadRight(10, ' ');
                        line += var_util.getDDMMYYYY_format(port.get_dt_repasse()).PadRight(21, ' ');

                        g.DrawString(line, myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    }

                    g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("Valor das compras: R$ " + new money().formatToMoney(drr.get_vr_compras()), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("Taxa de administração: " + drr.get_tx_admin(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("Desconto: R$ " + drr.get_vr_desc(), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("Valor total do reembolso: " + new money().formatToMoney(drr.get_vr_tot_rep()), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("____________________________________________", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;
                    g.DrawString("Assinatura do responsável", myFont, Brushes.Black, 10, 10 + (n * 20)); ++n;

                    myFont.Dispose();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

            case event_BtnConfirmarClick:
            {
                //InitEventCode event_BtnConfirmarClick
                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
Ejemplo n.º 4
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                i_Form.Text += " " + st_cod_empresa.PadLeft(6, '0');

                i_Form.CboReport.SelectedIndex = 0;

                ctrl_TxtMes.AcquireTextBox(i_Form.TxtMes, this, event_val_TxtMes, 2);
                ctrl_TxtAno.AcquireTextBox(i_Form.TxtAno, this, event_val_TxtAno, 4);

                ctrl_TxtMes.SetTextBoxText(DateTime.Now.Month.ToString());
                ctrl_TxtAno.SetTextBoxText(DateTime.Now.Year.ToString());

                ArrayList lst = new ArrayList();

                string nome_emp = "";

                var_exchange.fetch_empresasAfiliadas(st_cod_empresa,
                                                     ref header,
                                                     ref nome_emp,
                                                     ref lst);

                for (int t = 0; t < lst.Count; ++t)
                {
                    DadosEmpresa de = new DadosEmpresa(lst [t] as DataPortable);

                    i_Form.CboAfiliada.Items.Add(de.get_st_empresa());
                }

                if (lst.Count == 0)
                {
                    i_Form.CboAfiliada.Items.Add("");
                }

                i_Form.CboAfiliada.SelectedIndex = 0;

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                if (!ctrl_TxtAno.IsUserValidated && !ctrl_TxtMes.IsUserValidated)
                {
                    return(false);
                }

                switch (i_Form.CboReport.SelectedIndex)
                {
                case 0: doEvent(event_PorEmpresa, null);     break;

                case 1: doEvent(event_PorCartao, null);      break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtMes -

            case event_val_TxtMes:
            {
                //InitEventCode event_val_TxtMes

                if (ctrl_TxtMes.getTextBoxValue() == "" ||
                    ctrl_TxtMes.getTextBoxValue_Long() > 12)
                {
                    i_Form.TxtMes.BackColor     = colorInvalid;
                    ctrl_TxtMes.IsUserValidated = false;
                }
                else
                {
                    i_Form.TxtMes.BackColor     = Color.White;
                    ctrl_TxtMes.IsUserValidated = true;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtAno -

            case event_val_TxtAno:
            {
                //InitEventCode event_val_TxtAno

                if (ctrl_TxtAno.getTextBoxValue().Length < 4)
                {
                    i_Form.TxtAno.BackColor     = colorInvalid;
                    ctrl_TxtAno.IsUserValidated = false;
                }
                else
                {
                    i_Form.TxtAno.BackColor     = Color.White;
                    ctrl_TxtAno.IsUserValidated = true;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_PorEmpresa -

            case event_PorEmpresa:
            {
                //InitEventCode event_PorEmpresa

                // ##############################
                // # SETUP LISTS ################
                // ##############################

                ArrayList lstHeader     = new ArrayList();
                ArrayList lstContent    = new ArrayList();
                ArrayList lstTableSizes = new ArrayList();
                ArrayList lstFooter     = new ArrayList();
                ArrayList lstMessages   = new ArrayList();
                ArrayList lstFilters    = new ArrayList();

                string st_empresa             = "";
                string st_csv_cartao          = "";
                string st_csv_loja            = "";
                string st_csv_loja_content    = "";
                string st_csv_subtotal_loja   = "";
                string st_csv_subtotal_cartao = "";
                string st_csv_cartao_content  = "";
                string st_total = "";

                dlgStatus stat = new dlgStatus("Relatório");

                stat.LblActivity.Text = "Processando relatório no servidor";
                stat.Show();
                Application.DoEvents();

                if (!var_exchange.fetch_rel_3_fech("0",
                                                   ctrl_TxtMes.getTextBoxValue(),
                                                   ctrl_TxtAno.getTextBoxValue(),
                                                   st_cod_empresa,
                                                   i_Form.CboAfiliada.SelectedItem.ToString(),
                                                   ref header,
                                                   ref st_empresa,
                                                   ref st_csv_cartao,
                                                   ref st_csv_loja,
                                                   ref st_csv_loja_content,
                                                   ref st_csv_subtotal_loja,
                                                   ref st_csv_subtotal_cartao,
                                                   ref st_csv_cartao_content,
                                                   ref st_total))
                {
                    stat.Close();
                    return(false);
                }

                money     money_helper = new money();
                Hashtable mem_Lojas    = new Hashtable();

                stat.LblActivity.Text = "Obtendo resultados";

                Application.DoEvents();

                #region Busca todos os registros de todos as lojas
                {
                    ArrayList full_memory = new ArrayList();

                    while (st_csv_loja_content != "")
                    {
                        ArrayList tmp_memory = new ArrayList();

                        if (var_exchange.fetch_memory(st_csv_loja_content, "400", ref st_csv_loja_content, ref tmp_memory))
                        {
                            for (int t = 0; t < tmp_memory.Count; ++t)
                            {
                                full_memory.Add(tmp_memory[t]);
                            }
                        }
                    }

                    for (int t = 0; t < full_memory.Count; ++t)
                    {
                        DadosFechamento df = new DadosFechamento(full_memory[t] as DataPortable);

                        string tmp_loja = df.get_st_loja();

                        if (mem_Lojas [tmp_loja] == null)
                        {
                            mem_Lojas [tmp_loja] = new ArrayList();
                        }

                        ArrayList memoryLoja = mem_Lojas [tmp_loja] as ArrayList;

                        memoryLoja.Add(df);
                    }
                }
                #endregion

                stat.LblActivity.Text = "Gerando relatório para web";

                Application.DoEvents();

                int tot_Lojas = var_util.indexCSV(st_csv_loja);

                long tot_repasse = 0;

                ApplicationUtil var_utilFooter = new ApplicationUtil();

                var_utilFooter.indexCSV(st_csv_subtotal_loja);

                for (int h = 0; h < tot_Lojas; ++h)
                {
                    string loja = var_util.getCSV(h);

                    ArrayList memLojaList = mem_Lojas [loja] as ArrayList;

                    ArrayList lstFooterSub  = new ArrayList();
                    ArrayList lstHeaderSub  = new ArrayList();
                    ArrayList lstContentSub = new ArrayList();

                    lstMessages.Add("Fechamento da loja: " + loja);

                    lstTableSizes.Add(650);

                    lstHeaderSub.Add("NSU");
                    lstHeaderSub.Add("Cartão");
                    lstHeaderSub.Add("Nome");
                    lstHeaderSub.Add("Data e Hora");
                    lstHeaderSub.Add("Valor R$");
                    lstHeaderSub.Add("Parcela");
                    lstHeaderSub.Add("Terminal");

                    long sub_repasse = 0;

                    if (memLojaList != null)
                    {
                        for (int t = 0; t < memLojaList.Count; ++t)
                        {
                            DadosFechamento df = new DadosFechamento(memLojaList[t] as DataPortable);

                            ArrayList lstLine = new ArrayList();

                            lstLine.Add(df.get_st_nsu().PadLeft(6, '0'));
                            lstLine.Add(df.get_st_cartao());
                            lstLine.Add(df.get_st_nome());
                            lstLine.Add(var_util.getDDMMYYYY_format(df.get_dt_trans()));
                            lstLine.Add(money_helper.formatToMoney(df.get_vr_valor()));
                            lstLine.Add(df.get_nu_parcela());
                            lstLine.Add(df.get_st_terminal());

                            sub_repasse += Convert.ToInt64(df.get_vr_repasse());

                            lstContentSub.Add(lstLine);
                        }
                    }

                    lstFooterSub.Add("Sub-Total: " + "R$ " + money_helper.formatToMoney(var_utilFooter.getCSV(h)));
                    lstFooterSub.Add("Sub-Total repasse: " + "R$ " + money_helper.setMoneyFormat(sub_repasse));

                    tot_repasse += sub_repasse;

                    lstHeader.Add(lstHeaderSub);
                    lstFooter.Add(lstFooterSub);
                    lstContent.Add(lstContentSub);

                    if (h == tot_Lojas - 1)
                    {
                        lstFooterSub.Add("");
                        lstFooterSub.Add("Total de vendas nas lojas: " + "R$ " + money_helper.formatToMoney(st_total));
                        lstFooterSub.Add("Total de repasse para lojas: " + "R$ " + money_helper.setMoneyFormat(tot_repasse));
                    }
                }

                stat.Close();

                SyCrafReport rel = new SyCrafReport("Relatório de Fechamento por loja",
                                                    "RFE",
                                                    st_empresa,
                                                    "Mês " + ctrl_TxtMes.getTextBoxValue(),
                                                    "Ano " + ctrl_TxtAno.getTextBoxValue(),
                                                    ref lstHeader,
                                                    ref lstContent,
                                                    ref lstTableSizes,
                                                    ref lstFooter,
                                                    ref lstMessages,
                                                    ref lstFilters);


                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_PorCartao -

            case event_PorCartao:
            {
                //InitEventCode event_PorCartao

                // ##############################
                // # SETUP LISTS ################
                // ##############################

                ArrayList lstHeader     = new ArrayList();
                ArrayList lstContent    = new ArrayList();
                ArrayList lstTableSizes = new ArrayList();
                ArrayList lstFooter     = new ArrayList();
                ArrayList lstMessages   = new ArrayList();
                ArrayList lstFilters    = new ArrayList();

                string st_empresa             = "";
                string st_csv_cartao          = "";
                string st_csv_loja            = "";
                string st_csv_loja_content    = "";
                string st_csv_subtotal_loja   = "";
                string st_csv_subtotal_cartao = "";
                string st_csv_cartao_content  = "";
                string st_total = "";

                dlgStatus stat = new dlgStatus("Relatório");

                stat.LblActivity.Text = "Processando relatório no servidor";
                stat.Show();
                Application.DoEvents();

                if (!var_exchange.fetch_rel_3_fech("1",
                                                   ctrl_TxtMes.getTextBoxValue(),
                                                   ctrl_TxtAno.getTextBoxValue(),
                                                   st_cod_empresa,
                                                   i_Form.CboAfiliada.SelectedItem.ToString(),
                                                   ref header,
                                                   ref st_empresa,
                                                   ref st_csv_cartao,
                                                   ref st_csv_loja,
                                                   ref st_csv_loja_content,
                                                   ref st_csv_subtotal_loja,
                                                   ref st_csv_subtotal_cartao,
                                                   ref st_csv_cartao_content,
                                                   ref st_total))
                {
                    stat.Close();
                    return(false);
                }

                money     money_helper = new money();
                Hashtable mem_Cartoes  = new Hashtable();

                stat.LblActivity.Text = "Obtendo resultados";

                Application.DoEvents();

                #region Busca todos os registros de todos os cartoes
                {
                    ArrayList full_memory = new ArrayList();

                    while (st_csv_cartao_content != "")
                    {
                        ArrayList tmp_memory = new ArrayList();

                        if (var_exchange.fetch_memory(st_csv_cartao_content, "400", ref st_csv_cartao_content, ref tmp_memory))
                        {
                            for (int t = 0; t < tmp_memory.Count; ++t)
                            {
                                full_memory.Add(tmp_memory[t]);
                            }
                        }
                    }

                    for (int t = 0; t < full_memory.Count; ++t)
                    {
                        DadosFechamento df = new DadosFechamento(full_memory[t] as DataPortable);

                        string tmp_cartao = df.get_st_cartao();

                        if (mem_Cartoes [tmp_cartao] == null)
                        {
                            mem_Cartoes [tmp_cartao] = new ArrayList();
                        }

                        ArrayList memoryCart = mem_Cartoes [tmp_cartao] as ArrayList;

                        memoryCart.Add(df);
                    }
                }

                #endregion

                stat.LblActivity.Text = "Gerando relatório para web";

                Application.DoEvents();

                int tot_Cartoes = var_util.indexCSV(st_csv_cartao);

                ApplicationUtil var_utilFooter = new ApplicationUtil();

                var_utilFooter.indexCSV(st_csv_subtotal_cartao);

                for (int h = 0; h < tot_Cartoes; ++h)
                {
                    string cart = var_util.getCSV(h);

                    ArrayList lstFooterSub  = new ArrayList();
                    ArrayList lstHeaderSub  = new ArrayList();
                    ArrayList lstContentSub = new ArrayList();

                    lstMessages.Add("Fechamento do cartão: " + cart);

                    lstTableSizes.Add(800);

                    lstHeaderSub.Add("NSU");
                    lstHeaderSub.Add("Loja");
                    lstHeaderSub.Add("Data e Hora");
                    lstHeaderSub.Add("Valor R$");
                    lstHeaderSub.Add("Parcela");

                    ArrayList memCartList = mem_Cartoes [cart] as ArrayList;

                    if (memCartList != null)
                    {
                        for (int t = 0; t < memCartList.Count; ++t)
                        {
                            DadosFechamento df = new DadosFechamento(memCartList[t] as DataPortable);

                            ArrayList lstLine = new ArrayList();

                            lstLine.Add(df.get_st_nsu().PadLeft(6, '0'));
                            lstLine.Add(df.get_st_loja());
                            lstLine.Add(var_util.getDDMMYYYY_format(df.get_dt_trans()));
                            lstLine.Add(money_helper.formatToMoney(df.get_vr_valor()));
                            lstLine.Add(df.get_nu_parcela());

                            lstContentSub.Add(lstLine);
                        }
                    }

                    lstFooterSub.Add("Sub-Total: R$ " + money_helper.formatToMoney(var_utilFooter.getCSV(h)));

                    lstHeader.Add(lstHeaderSub);
                    lstFooter.Add(lstFooterSub);
                    lstContent.Add(lstContentSub);

                    if (h == tot_Cartoes - 1)
                    {
                        lstFooterSub.Add("");
                        lstFooterSub.Add("Total: " + "R$ " + money_helper.formatToMoney(st_total));
                    }
                }

                stat.Close();

                SyCrafReport rel = new SyCrafReport("Relatório de Fechamento por cartões",
                                                    "RFE",
                                                    st_empresa,
                                                    "Mês : " + ctrl_TxtMes.getTextBoxValue(),
                                                    "Ano : " + ctrl_TxtAno.getTextBoxValue(),
                                                    ref lstHeader,
                                                    ref lstContent,
                                                    ref lstTableSizes,
                                                    ref lstFooter,
                                                    ref lstMessages,
                                                    ref lstFilters);


                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BDF -

            case event_BDF:
            {
                //InitEventCode event_BDF

                if (i_Form.CboReport.SelectedIndex != 1)
                {
                    MessageBox.Show("Geração somente para relatório de cartões", "Aviso");
                    return(false);
                }

                event_dlgDBF_Fechamento ev_call = new event_dlgDBF_Fechamento(var_util, var_exchange);

                ev_call.header = header;

                ev_call.mes            = ctrl_TxtMes.getTextBoxValue();
                ev_call.ano            = ctrl_TxtAno.getTextBoxValue();
                ev_call.st_cod_empresa = st_cod_empresa;

                ev_call.i_Form.ShowDialog();

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

            case event_BtnConfirmarClick:
            {
                //InitEventCode event_BtnConfirmarClick
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnDBFClick -

            case event_BtnDBFClick:
            {
                //InitEventCode event_BtnDBFClick
                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
Ejemplo n.º 5
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                ctrl_TxtLoja.AcquireTextBox(i_Form.TxtLoja, this, event_val_TxtLoja, 6);
                ctrl_TxtCNPJ.AcquireTextBox(i_Form.TxtCNPJ, this, event_val_TxtCNPJ);

                ctrl_TxtDtAbIni.AcquireTextBox(i_Form.TxtDtAbIni, this, event_val_TxtDtAbIni, dateTextController.FORMAT_DDMMYYYY);
                ctrl_TxtDtAbFim.AcquireTextBox(i_Form.TxtDtAbFim, this, event_val_TxtDtAbFim, dateTextController.FORMAT_DDMMYYYY);

                ctrl_TxtDtFechIni.AcquireTextBox(i_Form.TxtDtFechIni, this, event_val_TxtDtFechIni, dateTextController.FORMAT_DDMMYYYY);
                ctrl_TxtDtFechFim.AcquireTextBox(i_Form.TxtDtFechFim, this, event_val_TxtDtFechFim, dateTextController.FORMAT_DDMMYYYY);

                ctrl_TxtDtAbIni.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') +
                                               DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                               DateTime.Now.Year.ToString().PadLeft(2, '0'));

                ctrl_TxtDtAbFim.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') +
                                               DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                               DateTime.Now.Year.ToString().PadLeft(2, '0'));

                ArrayList lst = new ArrayList();

                var_exchange.fetch_conveyUsuarios(ref header, ref lst);

                i_Form.CboOpers.Items.Clear();
                i_Form.CboOpers.Items.Add("(Todos)");
                i_Form.CboResp.Items.Add("(Todos)");

                for (int t = 0; t < lst.Count; ++t)
                {
                    DadosUsuario us = new DadosUsuario(lst[t] as DataPortable);

                    i_Form.CboOpers.Items.Add(us.get_st_nome());
                    i_Form.CboResp.Items.Add(us.get_st_nome());
                }

                i_Form.CboOpers.SelectedIndex      = 0;
                i_Form.CboResp.SelectedIndex       = 0;
                i_Form.CboCateg.SelectedIndex      = 0;
                i_Form.CboPrioridade.SelectedIndex = 0;
                i_Form.CboSit.SelectedIndex        = 0;

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Procurar -

            case event_Procurar:
            {
                //InitEventCode event_Procurar

                string nu_categ      = (i_Form.CboCateg.SelectedIndex - 1).ToString();
                string nu_prioridade = (i_Form.CboPrioridade.SelectedIndex - 1).ToString();
                string st_operador   = "";
                string st_resp       = "";
                string tg_closed     = i_Form.CboSit.SelectedIndex.ToString();
                string dt_ini_ab     = "";
                string dt_fim_ab     = "";
                string dt_ini_fech   = "";
                string dt_fim_fech   = "";
                string tg_tecnico    = Context.FALSE;
                string st_loja       = "";

                if (i_Form.CboOpers.SelectedIndex > 0)
                {
                    st_operador = i_Form.CboOpers.SelectedItem.ToString();
                }

                if (i_Form.CboResp.SelectedIndex > 0)
                {
                    st_resp = i_Form.CboResp.SelectedItem.ToString();
                }

                if (ctrl_TxtLoja.IsUserValidated)
                {
                    st_loja = ctrl_TxtLoja.getTextBoxValue();
                }

                if (i_Form.ChkTecnico.Checked)
                {
                    tg_tecnico = Context.TRUE;
                }

                if (ctrl_TxtDtAbIni.IsUserValidated)
                {
                    dt_ini_ab = var_util.GetDataBaseTimeFormat(ctrl_TxtDtAbIni.getTextBoxValue_Date());
                }

                if (ctrl_TxtDtAbFim.IsUserValidated)
                {
                    dt_fim_ab = var_util.GetDataBaseTimeFormat(ctrl_TxtDtAbFim.getTextBoxValue_Date().AddDays(1));
                }

                if (ctrl_TxtDtFechIni.IsUserValidated)
                {
                    dt_ini_fech = var_util.GetDataBaseTimeFormat(ctrl_TxtDtFechIni.getTextBoxValue_Date());
                }

                if (ctrl_TxtDtFechFim.IsUserValidated)
                {
                    dt_fim_fech = var_util.GetDataBaseTimeFormat(ctrl_TxtDtFechFim.getTextBoxValue_Date().AddDays(1));
                }

                string st_block = "";

                var_exchange.fetch_chamados(nu_categ,
                                            nu_prioridade,
                                            st_operador,
                                            tg_closed,
                                            dt_ini_ab,
                                            dt_fim_ab,
                                            dt_ini_fech,
                                            dt_fim_fech,
                                            tg_tecnico,
                                            st_loja,
                                            st_resp,
                                            ref header,
                                            ref st_block);

                ArrayList full_memory = new ArrayList();

                while (st_block != "")
                {
                    ArrayList tmp_memory = new ArrayList();

                    if (var_exchange.fetch_memory(st_block, "400", ref st_block, ref tmp_memory))
                    {
                        for (int t = 0; t < tmp_memory.Count; ++t)
                        {
                            full_memory.Add(tmp_memory[t]);
                        }
                    }
                }

                i_Form.LstChamados.Items.Clear();

                for (int t = 0; t < full_memory.Count; ++t)
                {
                    DadosChamado dc = new DadosChamado(full_memory[t] as DataPortable);

                    string dt_ab   = var_util.getDDMMYYYY_format(dc.get_dt_ab());
                    string dt_fech = dc.get_dt_fech();

                    if (dt_fech.Length > 0)
                    {
                        dt_fech = var_util.getDDMMYYYY_format(dt_fech);
                    }

                    string [] full_row = new string [] { dt_ab,
                                                         dt_fech,
                                                         dc.get_st_oper() + " (" + dc.get_st_resp() + ")",
                                                         dc.get_st_motivo() };

                    i_Form.LstChamados.Items.Add(var_util.GetListViewItem(dc.get_id_chamado(), full_row));
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtLoja -

            case event_val_TxtLoja:
            {
                //InitEventCode event_val_TxtLoja

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (ctrl_TxtLoja.getTextBoxValue().Length > 0)
                    {
                        i_Form.TxtLoja.BackColor     = Color.White;
                        ctrl_TxtLoja.IsUserValidated = true;

                        if (ctrl_TxtLoja.GetEnterPressed())
                        {
                            DadosLoja dl = new DadosLoja();

                            var_exchange.fetch_dadosLoja("", ctrl_TxtLoja.getTextBoxValue(), ref header, ref dl);

                            i_Form.TxtNome.Text = dl.get_st_nome();
                            ctrl_TxtCNPJ.SetTextBoxText(dl.get_nu_CNPJ());
                        }
                    }
                    else
                    {
                        i_Form.TxtLoja.BackColor     = colorInvalid;
                        ctrl_TxtLoja.IsUserValidated = false;

                        if (ctrl_TxtLoja.GetEnterPressed())
                        {
                            event_dlgConsultaLoja ev_call = new event_dlgConsultaLoja(var_util, var_exchange);

                            ev_call.header = header;

                            ev_call.i_Form.Show();
                        }
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtAbIni -

            case event_val_TxtDtAbIni:
            {
                //InitEventCode event_val_TxtDtAbIni

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDtAbIni.BackColor     = colorInvalid;
                    ctrl_TxtDtAbIni.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtAbIni.BackColor     = Color.White;
                    ctrl_TxtDtAbIni.IsUserValidated = true;
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtAbFim -

            case event_val_TxtDtAbFim:
            {
                //InitEventCode event_val_TxtDtAbFim

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDtAbFim.BackColor     = colorInvalid;
                    ctrl_TxtDtAbFim.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtAbFim.BackColor     = Color.White;
                    ctrl_TxtDtAbFim.IsUserValidated = true;
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtFechIni -

            case event_val_TxtDtFechIni:
            {
                //InitEventCode event_val_TxtDtFechIni

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDtFechIni.BackColor     = colorInvalid;
                    ctrl_TxtDtFechIni.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtFechIni.BackColor     = Color.White;
                    ctrl_TxtDtFechIni.IsUserValidated = true;
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtFechFim -

            case event_val_TxtDtFechFim:
            {
                //InitEventCode event_val_TxtDtFechFim

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDtFechFim.BackColor     = colorInvalid;
                    ctrl_TxtDtFechFim.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtFechFim.BackColor     = Color.White;
                    ctrl_TxtDtFechFim.IsUserValidated = true;
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCNPJ -

            case event_val_TxtCNPJ:
            {
                //InitEventCode event_val_TxtCNPJ

                switch (arg as string)
                {
                case cnpjTextController.CNPJ_INCOMPLETE:
                case cnpjTextController.CNPJ_INVALID:
                {
                    i_Form.TxtCNPJ.BackColor     = colorInvalid;
                    ctrl_TxtCNPJ.IsUserValidated = false;

                    if (ctrl_TxtCNPJ.GetEnterPressed())
                    {
                        event_dlgConsultaLoja ev_call = new event_dlgConsultaLoja(var_util, var_exchange);

                        ev_call.header = header;

                        ev_call.i_Form.Show();
                    }

                    break;
                }

                case cnpjTextController.CNPJ_VALID:
                {
                    i_Form.TxtCNPJ.BackColor     = Color.White;
                    ctrl_TxtCNPJ.IsUserValidated = true;
                    ctrl_TxtCNPJ.CleanError();

                    if (ctrl_TxtLoja.GetEnterPressed())
                    {
                        DadosLoja dl = new DadosLoja();

                        var_exchange.fetch_dadosLoja(ctrl_TxtCNPJ.getTextBoxValue(), "", ref header, ref dl);

                        ctrl_TxtLoja.SetTextBoxText(dl.get_st_loja());

                        i_Form.TxtNome.Text = dl.get_st_nome();
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Editar -

            case event_Editar:
            {
                //InitEventCode event_Editar

                if (i_Form.LstChamados.SelectedItems.Count > 0)
                {
                    event_dlgEditaChamado ev_call = new event_dlgEditaChamado(var_util, var_exchange);

                    ev_call.header     = header;
                    ev_call.id_chamado = var_util.getSelectedListViewItemTag(i_Form.LstChamados);

                    ev_call.i_Form.ShowDialog();
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Relatorio -

            case event_Relatorio:
            {
                //InitEventCode event_Relatorio

                ArrayList lstReport = new ArrayList();

                lstReport.Add("RELATÓRIO DE CHAMADOS");
                lstReport.Add("");
                lstReport.Add("DT. ABERTURA                  DT. FECHAMENTO                OPER (RESP)");
                lstReport.Add("DESCRIÇÃO");
                lstReport.Add("-------------------------------------------------------------------------------------------------------");
                lstReport.Add("");

                string line = "";

                for (int t = 0; t < i_Form.LstChamados.Items.Count; ++t)
                {
                    line  = i_Form.LstChamados.Items[t].SubItems[0].Text.PadRight(29, ' ') + " ";
                    line += i_Form.LstChamados.Items[t].SubItems[1].Text.PadRight(29, ' ') + " ";
                    line += i_Form.LstChamados.Items[t].SubItems[2].Text.PadRight(32, ' ') + " ";

                    lstReport.Add(line);

                    line = i_Form.LstChamados.Items[t].SubItems[3].Text.PadRight(100, ' ').Substring(0, 100);

                    lstReport.Add(line);
                    lstReport.Add("");
                }

                new ConveyPrinter("Courier New", 7, 10, ref lstReport);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Print -

            case event_Print:
            {
                //InitEventCode event_Print
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_LstChamadosDoubleClick -

            case event_LstChamadosDoubleClick:
            {
                //InitEventCode event_LstChamadosDoubleClick
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnProcurarClick -

            case event_BtnProcurarClick:
            {
                //InitEventCode event_BtnProcurarClick
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnReportClick -

            case event_BtnReportClick:
            {
                //InitEventCode event_BtnReportClick
                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                ArrayList lst = new ArrayList();

                var_exchange.fetch_conveyUsuarios(ref header, ref lst);

                i_Form.CboOpers.Items.Clear();

                for (int t = 0; t < lst.Count; ++t)
                {
                    DadosUsuario us = new DadosUsuario(lst[t] as DataPortable);

                    i_Form.CboOpers.Items.Add(us.get_st_nome());
                }

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Alterar -

            case event_Alterar:
            {
                //InitEventCode event_Alterar

                if (i_Form.TxtNewSolution.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Digite o andamento da solução", "Aviso");
                    return(false);
                }

                if (i_Form.CboSit.SelectedIndex == 1)
                {
                    if (MessageBox.Show("Confirma fechamento de chamado?",
                                        "Aviso",
                                        MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Question,
                                        MessageBoxDefaultButton.Button2) == DialogResult.No)
                    {
                        return(false);
                    }
                }

                string st_new_desc = i_Form.TxtNewSolution.Text,
                       tg_fechado  = i_Form.CboSit.SelectedIndex.ToString(),
                       st_operador = i_Form.CboOpers.SelectedItem.ToString();

                var_exchange.exec_alteraChamado(id_chamado, st_new_desc, tg_fechado, st_operador, ref header);

                i_Form.BtnAlterar.Enabled     = false;
                i_Form.TxtNewSolution.Enabled = false;
                i_Form.CboOpers.Enabled       = false;
                i_Form.CboSit.Enabled         = false;

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                ArrayList lst = new ArrayList();

                DadosChamado dc = new DadosChamado();

                if (var_exchange.fetch_chamadoHist(id_chamado, ref header, ref dc, ref lst))
                {
                    i_Form.TxtLoja.Text = dc.get_st_cod_loja();
                    i_Form.TxtNome.Text = dc.get_st_nome_loja();
                    i_Form.TxtDesc.Text = dc.get_st_motivo();

                    for (int t = 0; t < i_Form.CboOpers.Items.Count; ++t)
                    {
                        if (i_Form.CboOpers.Items[t].ToString() == dc.get_st_oper())
                        {
                            i_Form.CboOpers.SelectedIndex = t;
                            break;
                        }
                    }

                    i_Form.CboCateg.SelectedIndex = Convert.ToInt32(dc.get_nu_categ());
                    i_Form.CboSit.SelectedIndex   = Convert.ToInt32(dc.get_tg_fechado());
                    i_Form.TxtDtAbertura.Text     = var_util.getDDMMYYYY_format(dc.get_dt_ab());

                    if (dc.get_tg_fechado() == Context.TRUE)
                    {
                        i_Form.TxtDtFechamento.Text = var_util.getDDMMYYYY_format(dc.get_dt_fech());
                    }

                    i_Form.TxtHist.Text = "";

                    for (int t = 0; t < lst.Count; ++t)
                    {
                        DadosAlteracaoChamado dac = new DadosAlteracaoChamado(lst[t] as DataPortable);

                        i_Form.TxtHist.Text += "-= " +
                                               var_util.getDDMMYYYY_format(dac.get_dt_alt()) +
                                               " (" +
                                               dac.get_st_oper_alt() +
                                               ") =- \r\n";

                        i_Form.TxtHist.Text += dac.get_st_desc_alt();
                        i_Form.TxtHist.Text += "\r\n\r\n";
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnAlterarClick -

            case event_BtnAlterarClick:
            {
                //InitEventCode event_BtnAlterarClick
                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
Ejemplo n.º 7
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                string st_content = "";

                if (var_exchange.fetch_canc_dia_lojista(ref header, ref st_content))
                {
                    while (st_content != "")
                    {
                        ArrayList tmp_memory = new ArrayList();

                        if (var_exchange.fetch_memory(st_content, "200",
                                                      ref st_content,
                                                      ref tmp_memory))
                        {
                            for (int t = 0; t < tmp_memory.Count; ++t)
                            {
                                DadosConsultaTransacao dct = new DadosConsultaTransacao(tmp_memory [t] as DataPortable);

                                string [] full_row = new string [] { dct.get_st_cartao(),
                                                                     "R$ " + new money().formatToMoney(dct.get_vr_valor()),
                                                                     var_util.getDDMMYYYY_format(dct.get_dt_transacao()),
                                                                     dct.get_st_nsu() };

                                i_Form.LstVendas.Items.Add(var_util.GetListViewItem(null, full_row));
                            }
                        }
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnCancelarClick -

            case event_BtnCancelarClick:
            {
                //InitEventCode event_BtnCancelarClick

                if (i_Form.LstVendas.SelectedItems.Count == 0)
                {
                    return(false);
                }

                string dtax = i_Form.LstVendas.SelectedItems[0].SubItems[2].Text;
                string nsu  = i_Form.LstVendas.SelectedItems[0].SubItems[3].Text;

                string dta = var_util.GetDataBaseTimeFormat(
                    new DateTime(Convert.ToInt32(dtax.Substring(6, 4)),
                                 Convert.ToInt32(dtax.Substring(3, 2)),
                                 Convert.ToInt32(dtax.Substring(0, 2))));

                if (!var_exchange.fetch_dadosNSU(nsu,
                                                 dta,
                                                 TipoConfirmacao.Confirmada,
                                                 ref header,
                                                 ref dn))
                {
                    return(false);
                }

                POS_Entrada  pe = new POS_Entrada();
                POS_Resposta pr = new POS_Resposta();

                pe.set_st_terminal(dn.get_st_terminal());
                pe.set_st_empresa(dn.get_st_empresa());
                pe.set_st_matricula(dn.get_st_matricula());
                pe.set_st_titularidade(dn.get_st_titularidade());
                pe.set_nu_parcelas("0");

                string st_msg = "";

                var_exchange.m_Client.QuietMode = true;

                if (var_exchange.exec_pos_cancelaVendaEmpresarial(nsu,
                                                                  dta,
                                                                  header.get_st_user_id(),
                                                                  ref pe,
                                                                  ref st_msg,
                                                                  ref pr))
                {
                    MessageBox.Show("Sucesso no cancelamento", "Aviso");
                }
                else
                {
                    MessageBox.Show(st_msg, "Erro");
                }

                var_exchange.m_Client.QuietMode = false;

                doEvent(event_FormIsOpening, null);

                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
Ejemplo n.º 8
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6);
                ctrl_TxtMatricula.AcquireTextBox(i_Form.TxtMatricula, this, event_val_TxtMatricula, 6);

                if (header.get_tg_user_type() == TipoUsuario.VendedorGift ||
                    header.get_tg_user_type() == TipoUsuario.AdminGift ||
                    header.get_tg_user_type() == TipoUsuario.Operador ||
                    header.get_tg_user_type() == TipoUsuario.Administrador)
                {
                    ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa());
                    i_Form.TxtEmpresa.ReadOnly = true;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtEmpresa -

            case event_val_TxtEmpresa:
            {
                //InitEventCode event_val_TxtEmpresa

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (i_Form.TxtEmpresa.Text.Length > 0)
                    {
                        i_Form.TxtEmpresa.BackColor     = Color.White;
                        ctrl_TxtEmpresa.IsUserValidated = true;
                        ctrl_TxtEmpresa.CleanError();

                        if (ctrl_TxtEmpresa.GetEnterPressed())
                        {
                            doEvent(event_val_TxtCartao, null);
                        }
                    }
                    else
                    {
                        i_Form.TxtEmpresa.BackColor     = colorInvalid;
                        ctrl_TxtEmpresa.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtMatricula -

            case event_val_TxtMatricula:
            {
                //InitEventCode event_val_TxtMatricula

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (i_Form.TxtMatricula.Text.Length > 0)
                    {
                        i_Form.TxtMatricula.BackColor     = Color.White;
                        ctrl_TxtMatricula.IsUserValidated = true;
                        ctrl_TxtMatricula.CleanError();

                        if (ctrl_TxtMatricula.GetEnterPressed())
                        {
                            doEvent(event_val_TxtCartao, null);
                        }
                    }
                    else
                    {
                        i_Form.TxtMatricula.BackColor     = colorInvalid;
                        ctrl_TxtMatricula.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCartao -

            case event_val_TxtCartao:
            {
                //InitEventCode event_val_TxtCartao

                if (!ctrl_TxtEmpresa.IsUserValidated &&
                    !ctrl_TxtMatricula.IsUserValidated)
                {
                    return(false);
                }

                ArrayList lstCred    = new ArrayList();
                ArrayList lstProd    = new ArrayList();
                ArrayList lstComprov = new ArrayList();

                string nome = "";
                string disp = "";
                string sit  = "";

                if (!var_exchange.fetch_consultaCartaoGift(ctrl_TxtEmpresa.getTextBoxValue(),
                                                           ctrl_TxtMatricula.getTextBoxValue(),
                                                           ref header,
                                                           ref nome,
                                                           ref disp,
                                                           ref sit,
                                                           ref lstCred,
                                                           ref lstProd,
                                                           ref lstComprov))
                {
                    return(false);
                }

                i_Form.TxtNome.Text  = nome;
                i_Form.TxtSaldo.Text = new money().formatToMoney(disp);
                i_Form.TxtSit.Text   = sit;

                i_Form.LstCred.Items.Clear();
                i_Form.LstProd.Items.Clear();

                for (int t = 0; t < lstCred.Count; ++t)
                {
                    DadosConsultaGift dcg = new DadosConsultaGift(lstCred[t] as DataPortable);

                    string [] full_row = new string [] { dcg.get_st_nome(),
                                                         "R$ " + new money().formatToMoney(dcg.get_vr_valor()),
                                                         var_util.getDDMMYYYY_format(dcg.get_dt_data()) };

                    i_Form.LstCred.Items.Add(var_util.GetListViewItem("", full_row));
                }

                for (int t = 0; t < lstProd.Count; ++t)
                {
                    DadosConsultaGift dcg = new DadosConsultaGift(lstProd[t] as DataPortable);

                    string [] full_row = new string [] { dcg.get_st_nome(),
                                                         "R$ " + new money().formatToMoney(dcg.get_vr_valor()) };

                    i_Form.LstProd.Items.Add(var_util.GetListViewItem("", full_row));
                }

                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
Ejemplo n.º 9
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                ctrl_TxtDataIni.AcquireTextBox(i_Form.TxtDataIni, this, event_val_TxtDataIni, dateTextController.FORMAT_DDMMYYYY);

                ctrl_TxtDataIni.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') +
                                               DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                               DateTime.Now.Year.ToString().PadLeft(2, '0'));

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Confirmar -

            case event_Confirmar:
            {
                //InitEventCode event_Confirmar

                if (i_Form.LstLojas.SelectedItems.Count == 0)
                {
                    return(false);
                }

                event_dlgConfFinalRepasse ev_call = new event_dlgConfFinalRepasse(var_util, var_exchange);

                ev_call.header = header;

                ev_call.st_codLoja  = var_util.getSelectedListViewItemTag(i_Form.LstLojas);
                ev_call.st_loja     = i_Form.LstLojas.SelectedItems[0].SubItems[0].Text;
                ev_call.vr_valor    = i_Form.LstLojas.SelectedItems[0].SubItems[1].Text.Replace(",", "");
                ev_call.lstParcelas = hshLojas [ev_call.st_codLoja] as ArrayList;

                ev_call.i_Form.ShowDialog();

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_DetalheCheck -

            case event_DetalheCheck:
            {
                //InitEventCode event_DetalheCheck

                if (i_Form.LstLojas.SelectedItems.Count == 0)
                {
                    return(false);
                }

                string st_loja = var_util.getSelectedListViewItemTag(i_Form.LstLojas);

                ArrayList lstDets = hshLojas [st_loja] as ArrayList;

                long tot_detalhes = 0;

                for (int t = 0; t < i_Form.LstDetalhes.Items.Count; ++t)
                {
                    DadosRepasse dr = lstDets [t] as DadosRepasse;

                    if (i_Form.LstDetalhes.Items[t].Checked)
                    {
                        tot_detalhes += Convert.ToInt64(dr.get_vr_repasse());

                        dr.set_tg_confirmado(Context.TRUE);
                    }
                    else
                    {
                        dr.set_tg_confirmado(Context.FALSE);
                    }
                }

                i_Form.LstLojas.SelectedItems[0].SubItems[1].Text = new money().formatToMoney(tot_detalhes.ToString());

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDataIni -

            case event_val_TxtDataIni:
            {
                //InitEventCode event_val_TxtDataIni

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDataIni.BackColor     = colorInvalid;
                    ctrl_TxtDataIni.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDataIni.BackColor     = Color.White;
                    ctrl_TxtDataIni.IsUserValidated = true;

                    if (ctrl_TxtDataIni.GetEnterPressed())
                    {
                        doEvent(event_BuscaDados, null);
                    }
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_SelecionaLoja -

            case event_SelecionaLoja:
            {
                //InitEventCode event_SelecionaLoja

                if (i_Form.LstLojas.SelectedItems.Count == 0)
                {
                    return(false);
                }

                string st_loja = var_util.getSelectedListViewItemTag(i_Form.LstLojas);

                ArrayList lstDets = hshLojas [st_loja] as ArrayList;

                i_Form.LstDetalhes.Items.Clear();

                for (int t = 0; t < lstDets.Count; ++t)
                {
                    DadosRepasse dr = new DadosRepasse(lstDets [t] as DataPortable);

                    DateTime tim_repasse = Convert.ToDateTime(dr.get_dt_repasse());

                    string dt_rep = var_util.getDDMMYYYY_format(dr.get_dt_repasse()).Substring(0, 10);

                    if (dt_rep == ctrl_TxtDataIni.getTextBoxValue())
                    {
                        dt_rep += " [hoje]";
                    }
                    else if (tim_repasse > ctrl_TxtDataIni.getTextBoxValue_Date())
                    {
                        dt_rep += " [futuro]";
                    }

                    string [] full_row = new string [] { new money().formatToMoney(dr.get_vr_repasse()),
                                                         dr.get_st_cartao(),
                                                         dr.get_st_nsu(),
                                                         var_util.getDDMMYYYY_format(dr.get_dt_trans()),
                                                         dt_rep };



                    if (dt_rep.IndexOf("futuro") >= 0 || dt_rep.IndexOf("hoje") >= 0)
                    {
                        i_Form.LstDetalhes.Items.Add(var_util.GetListViewItem(dr.get_st_nsu(),
                                                                              full_row,
                                                                              Color.Black,
                                                                              Color.Bisque));
                    }
                    else
                    {
                        i_Form.LstDetalhes.Items.Add(var_util.GetListViewItem(dr.get_st_nsu(),
                                                                              full_row));
                    }

                    i_Form.LstDetalhes.Items[t].Checked = false;

                    if (dr.get_tg_confirmado() == Context.TRUE)
                    {
                        i_Form.LstDetalhes.Items[t].Checked = true;
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                string block_detalhe_loja = "";
                string block_sumario_loja = "";

                i_Form.LstLojas.Items.Clear();
                i_Form.LstDetalhes.Items.Clear();

                hshLojas.Clear();

                Application.DoEvents();

                var_exchange.fetch_repasseData(ctrl_TxtDataIni.getTextBoxValue(),
                                               ref header,
                                               ref block_detalhe_loja,
                                               ref block_sumario_loja);

                while (block_detalhe_loja != "")
                {
                    ArrayList tmp_memory = new ArrayList();

                    if (var_exchange.fetch_memory(block_detalhe_loja, "400", ref block_detalhe_loja, ref tmp_memory))
                    {
                        for (int t = 0; t < tmp_memory.Count; ++t)
                        {
                            DadosRepasse dr = new DadosRepasse(tmp_memory[t] as DataPortable);

                            string cod = dr.get_st_loja();

                            if (hshLojas [cod] == null)
                            {
                                hshLojas [cod] = new ArrayList();
                            }

                            ArrayList tmp_list = hshLojas [cod] as ArrayList;

                            string dt_rep = var_util.getDDMMYYYY_format(dr.get_dt_repasse()).Substring(0, 10);

                            DateTime tim_repasse = Convert.ToDateTime(dr.get_dt_repasse());

                            if (dt_rep == ctrl_TxtDataIni.getTextBoxValue())
                            {
                                dr.set_tg_confirmado(Context.FALSE);
                            }
                            else if (tim_repasse > ctrl_TxtDataIni.getTextBoxValue_Date())
                            {
                                dr.set_tg_confirmado(Context.FALSE);
                            }

                            tmp_list.Add(dr);
                        }
                    }
                }

                long vr_repasse = 0;

                ArrayList full_memory = new ArrayList();

                while (block_sumario_loja != "")
                {
                    ArrayList tmp_memory = new ArrayList();

                    if (var_exchange.fetch_memory(block_sumario_loja, "200", ref block_sumario_loja, ref tmp_memory))
                    {
                        for (int t = 0; t < tmp_memory.Count; ++t)
                        {
                            full_memory.Add(tmp_memory[t]);
                        }
                    }
                }

                ArrayList sorted_memory = new ArrayList();

                for (int t = 0; t < full_memory.Count; ++t)
                {
                    DadosSumarioRepasse dsr = new DadosSumarioRepasse(full_memory[t] as DataPortable);

                    sorted_memory.Add(dsr.get_vr_valor().PadLeft(20, '0') + dsr.get_st_codLoja().PadRight(20, ' '));
                }

                sorted_memory.Sort();

                for (int g = sorted_memory.Count - 1; g >= 0; --g)
                {
                    string tag = sorted_memory[g].ToString().Substring(20, 20).Trim();

                    for (int t = 0; t < full_memory.Count; ++t)
                    {
                        DadosSumarioRepasse dsr = new DadosSumarioRepasse(full_memory[t] as DataPortable);

                        if (dsr.get_st_codLoja() == tag)
                        {
                            vr_repasse += Convert.ToInt64(dsr.get_vr_valor());

                            string [] full_row = new string [] { dsr.get_st_loja(),
                                                                 new money().formatToMoney(dsr.get_vr_valor()) };

                            i_Form.LstLojas.Items.Add(var_util.GetListViewItem(dsr.get_st_codLoja(), full_row));
                        }
                    }
                }

                i_Form.TxtRepasse.Text = "R$ " + new money().formatToMoney(vr_repasse.ToString());

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_LstLojasClick -

            case event_LstLojasClick:
            {
                //InitEventCode event_LstLojasClick
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnConfirmarClick -

            case event_BtnConfirmarClick:
            {
                //InitEventCode event_BtnConfirmarClick
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_ListView1ItemChecked -

            case event_ListView1ItemChecked:
            {
                //InitEventCode event_ListView1ItemChecked
                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
Ejemplo n.º 10
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6);
                ctrl_TxtCartao.AcquireTextBox(i_Form.TxtCartao, this, event_val_TxtCartao, 6);

                ctrl_TxtDiario.AcquireTextBox(i_Form.TxtDiario, this, event_val_TxtDiario, "R$", 8);
                ctrl_TxtMensal.AcquireTextBox(i_Form.TxtMensal, this, event_val_TxtMensal, "R$", 8);
                ctrl_TxtEdu.AcquireTextBox(i_Form.TxtEdu, this, event_val_TxtEdu, "R$", 8);
                ctrl_TxtExtra.AcquireTextBox(i_Form.TxtExtra, this, event_val_TxtExtra, "R$", 8);

                ctrl_TxtDin.AcquireTextBox(i_Form.TxtDin, this, event_val_TxtDin, "R$", 8);

                ctrl_TxtCartao.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtDiario.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtMensal.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtEdu.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtExtra.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                ctrl_TxtDin.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                ctrl_TxtCartao.IsUserValidated = false;

                ctrl_TxtDtIni.AcquireTextBox(i_Form.TxtDtIni, this, event_val_TxtDtIni, dateTextController.FORMAT_DDMMYYYY);
                ctrl_TxtDtFim.AcquireTextBox(i_Form.TxtDtFim, this, event_val_TxtDtFim, dateTextController.FORMAT_DDMMYYYY);

                ctrl_TxtDtIni.SetTextBoxText(DateTime.Now.AddDays(-7).Day.ToString().PadLeft(2, '0') +
                                             DateTime.Now.AddDays(-7).Month.ToString().PadLeft(2, '0') +
                                             DateTime.Now.AddDays(-7).Year.ToString().PadLeft(2, '0'));

                ctrl_TxtDtFim.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') +
                                             DateTime.Now.Month.ToString().PadLeft(2, '0') +
                                             DateTime.Now.Year.ToString().PadLeft(2, '0'));

                if (header.get_tg_user_type() != TipoUsuario.SuperUser &&
                    header.get_tg_user_type() == TipoUsuario.OperadorEdu)
                {
                    i_Form.TxtEmpresa.Text     = header.get_st_empresa();
                    i_Form.TxtEmpresa.ReadOnly = true;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Definir -

            case event_Definir:
            {
                //InitEventCode event_Definir

                if (!ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                dlgAutorizacao autor = new dlgAutorizacao();

                autor.ShowDialog();

                Application.DoEvents();

                if (autor.IsConfirmed)
                {
                    var_exchange.exec_edu_alteraDiario(var_util.getMd5Hash(autor.senha),
                                                       ctrl_TxtDiario.getTextBoxValue_NumberStr(),
                                                       ctrl_TxtEmpresa.getTextBoxValue() +
                                                       ctrl_TxtCartao.getTextBoxValue() + "01",
                                                       ref header);
                }

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Pagamento -

            case event_Pagamento:
            {
                //InitEventCode event_Pagamento

                if (!ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                dlgAutorizacao autor = new dlgAutorizacao();

                autor.ShowDialog();

                Application.DoEvents();

                if (autor.IsConfirmed)
                {
                    var_exchange.exec_depotEduImediato(var_util.getMd5Hash(autor.senha),
                                                       ctrl_TxtEdu.getTextBoxValue_NumberStr(),
                                                       ctrl_TxtExtra.getTextBoxValue_NumberStr(),
                                                       ctrl_TxtEmpresa.getTextBoxValue(),
                                                       ctrl_TxtCartao.getTextBoxValue(),
                                                       ref header);
                }

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Vis -

            case event_Vis:
            {
                //InitEventCode event_Vis

                // ##############################
                // # SETUP LISTS ################
                // ##############################

                ArrayList lstHeader     = new ArrayList();
                ArrayList lstContent    = new ArrayList();
                ArrayList lstTableSizes = new ArrayList();
                ArrayList lstFooter     = new ArrayList();
                ArrayList lstMessages   = new ArrayList();
                ArrayList lstFilters    = new ArrayList();

                ArrayList lstFooterSub1  = new ArrayList();
                ArrayList lstHeaderSub1  = new ArrayList();
                ArrayList lstContentSub1 = new ArrayList();

                lstHeader.Add(lstHeaderSub1);
                lstFooter.Add(lstFooterSub1);
                lstContent.Add(lstContentSub1);

                // ##############################
                // # CUSTOMIZE
                // ##############################

                string st_csv           = "";
                string st_empresa       = "";
                string st_total_periodo = "";

                if (!var_exchange.fetch_rel_edu_extrato(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()),
                                                        var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddDays(1)),
                                                        ctrl_TxtEmpresa.getTextBoxValue(),
                                                        ctrl_TxtCartao.getTextBoxValue(),
                                                        ref header,
                                                        ref st_csv,
                                                        ref st_empresa,
                                                        ref st_total_periodo))
                {
                    return(false);
                }

                lstMessages.Add("Extrato do aluno: " + i_Form.TxtAluno.Text);

                lstTableSizes.Add(950);

                lstHeaderSub1.Add("NSU");
                lstHeaderSub1.Add("Data");
                lstHeaderSub1.Add("Valor R$");
                lstHeaderSub1.Add("Loja");
                lstHeaderSub1.Add("Saldo R$");
                lstHeaderSub1.Add("Fundo R$");
                lstHeaderSub1.Add("Operação");

                money money_helper = new money();

                ArrayList full_memory = new ArrayList();

                while (st_csv != "")
                {
                    ArrayList tmp_memory = new ArrayList();

                    if (var_exchange.fetch_memory(st_csv, "400", ref st_csv, ref tmp_memory))
                    {
                        for (int t = 0; t < tmp_memory.Count; ++t)
                        {
                            full_memory.Add(tmp_memory[t]);
                        }
                    }
                }

                ArrayList desc    = new TipoConfirmacaoDesc().GetArray();
                ArrayList desc_op = new OperacaoCartaoDesc().GetArray();

                for (int t = 0; t < full_memory.Count; ++t)
                {
                    EduExtrato rel_line = new EduExtrato(full_memory[t] as DataPortable);

                    ArrayList lstLine1 = new ArrayList();

                    lstLine1.Add(rel_line.get_st_nsu());
                    lstLine1.Add(var_util.getDDMMYYYY_format(rel_line.get_dt_trans()));

                    lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_valor()));

                    lstLine1.Add(rel_line.get_st_loja());
                    lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_disp()));
                    lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_fundo()));

                    if (rel_line.get_en_oper() == OperacaoCartao.VENDA_EMPRESARIAL)
                    {
                        lstLine1.Add("Utilização do cartão");
                    }
                    else
                    {
                        lstLine1.Add(desc_op [Convert.ToInt32(rel_line.get_en_oper())].ToString());
                    }

                    lstContentSub1.Add(lstLine1);
                }

                SyCrafReport rel = new SyCrafReport("Extrado de Transações por cartão",
                                                    "ETC",
                                                    st_empresa,
                                                    ctrl_TxtDtIni.getTextBoxValue(),
                                                    ctrl_TxtDtFim.getTextBoxValue(),
                                                    ref lstHeader,
                                                    ref lstContent,
                                                    ref lstTableSizes,
                                                    ref lstFooter,
                                                    ref lstMessages,
                                                    ref lstFilters);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtCartao -

            case event_val_TxtCartao:
            {
                //InitEventCode event_val_TxtCartao

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (i_Form.TxtCartao.Text.Length == 6)
                    {
                        i_Form.TxtCartao.BackColor     = Color.White;
                        ctrl_TxtCartao.IsUserValidated = true;
                        ctrl_TxtCartao.CleanError();
                    }
                    else
                    {
                        i_Form.TxtCartao.BackColor     = colorInvalid;
                        ctrl_TxtCartao.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                if (ctrl_TxtCartao.IsUserValidated)
                {
                    if (ctrl_TxtCartao.GetEnterPressed())
                    {
                        doEvent(event_BuscaDados, null);
                    }
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDiario -

            case event_val_TxtDiario:
            {
                //InitEventCode event_val_TxtDiario
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtMensal -

            case event_val_TxtMensal:
            {
                //InitEventCode event_val_TxtMensal

                if (!ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                long val = ctrl_TxtMensal.getTextBoxValue_Long();

                if (val > 0)
                {
                    ctrl_TxtDiario.SetTextBoxLong(val / 31);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtEdu -

            case event_val_TxtEdu:
            {
                //InitEventCode event_val_TxtEdu

                if (!ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                long val = ctrl_TxtEdu.getTextBoxValue_Long() +
                           ctrl_TxtExtra.getTextBoxValue_Long();

                ctrl_TxtDin.SetTextBoxLong(val);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtExtra -

            case event_val_TxtExtra:
            {
                //InitEventCode event_val_TxtExtra

                if (!ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                long val = ctrl_TxtEdu.getTextBoxValue_Long() +
                           ctrl_TxtExtra.getTextBoxValue_Long();

                ctrl_TxtDin.SetTextBoxLong(val);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDoc -

            case event_val_TxtDoc:
            {
                //InitEventCode event_val_TxtDoc

                /*if ( !ctrl_TxtCartao.IsUserValidated )
                 *      return false;
                 *
                 * if ( ctrl_TxtDoc.getTextBoxValue_Long() > 0 )
                 * {
                 *      long diario = ctrl_TxtDoc.getTextBoxValue_Long() / 31;
                 *
                 *      i_Form.rb1.Text =   "Em Fundo Educacional, definindo R$ " +
                 *                                              new money().formatToMoney ( diario.ToString() ) +
                 *                                              " diário";
                 * }
                 */

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                if (!ctrl_TxtEmpresa.IsUserValidated || !ctrl_TxtCartao.IsUserValidated)
                {
                    return(false);
                }

                DadosCartaoEdu dce = new DadosCartaoEdu();

                if (var_exchange.fetch_dadosAluno(ctrl_TxtEmpresa.getTextBoxValue() +
                                                  ctrl_TxtCartao.getTextBoxValue() +
                                                  "01",
                                                  ref header,
                                                  ref dce))
                {
                    i_Form.TxtAluno.Text = dce.get_st_aluno();

                    ctrl_TxtDiario.SetTextBoxString(dce.get_vr_diario().PadLeft(6, '0'));

                    int diario   = Convert.ToInt32(dce.get_vr_diario());
                    int calc_mes = diario * 31;

                    i_Form.TxtMensal.Text = "R$ " + new money().formatToMoney(calc_mes.ToString());

                    i_Form.TxtVrDisp.Text       = "R$ " + new money().formatToMoney(dce.get_vr_disp());
                    i_Form.TxtVrDispDiario.Text = "R$ " + new money().formatToMoney(diario.ToString());
                    i_Form.TxtVrDispMensal.Text = "R$ " + new money().formatToMoney(calc_mes.ToString());
                    i_Form.TxtSaldoTotal.Text   = "R$ " + new money().formatToMoney(dce.get_vr_depot());

                    DateTime tim = new DateTime(DateTime.Now.Year,
                                                DateTime.Now.Month,
                                                1).AddMonths(1);

                    long dias     = tim.Subtract(DateTime.Now).Days;
                    long prev_mes = dias * diario;

                    i_Form.TxtVrSaldoMes.Text = "R$ " + new money().formatToMoney(prev_mes.ToString());
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDin -

            case event_val_TxtDin:
            {
                //InitEventCode event_val_TxtDin
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtIni -

            case event_val_TxtDtIni:
            {
                //InitEventCode event_val_TxtDtIni

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDtIni.BackColor     = colorInvalid;
                    ctrl_TxtDtIni.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtIni.BackColor     = Color.White;
                    ctrl_TxtDtIni.IsUserValidated = true;
                    ctrl_TxtDtIni.CleanError();
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDtFim -

            case event_val_TxtDtFim:
            {
                //InitEventCode event_val_TxtDtFim

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDtFim.BackColor     = colorInvalid;
                    ctrl_TxtDtFim.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDtFim.BackColor     = Color.White;
                    ctrl_TxtDtFim.IsUserValidated = true;
                    ctrl_TxtDtIni.CleanError();
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtEmpresa -

            case event_val_TxtEmpresa:
            {
                //InitEventCode event_val_TxtEmpresa

                switch (arg as string)
                {
                case numberTextController.NUMBER_INCOMPLETE:
                case numberTextController.NUMBER_COMPLETE:
                {
                    if (i_Form.TxtEmpresa.Text.Length == 6)
                    {
                        i_Form.TxtEmpresa.BackColor     = Color.White;
                        ctrl_TxtEmpresa.IsUserValidated = true;
                        ctrl_TxtEmpresa.CleanError();
                    }
                    else
                    {
                        i_Form.TxtEmpresa.BackColor     = colorInvalid;
                        ctrl_TxtEmpresa.IsUserValidated = false;
                    }

                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnAlterarClick -

            case event_BtnAlterarClick:
            {
                //InitEventCode event_BtnAlterarClick
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnPagamentoClick -

            case event_BtnPagamentoClick:
            {
                //InitEventCode event_BtnPagamentoClick
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnExtratoClick -

            case event_BtnExtratoClick:
            {
                //InitEventCode event_BtnExtratoClick
                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening
                ctrl_TxtDt_Ini.AcquireTextBox(i_Form.TxtDt_Ini, this, event_val_TxtDt_Ini, dateTextController.FORMAT_DDMMYYYY);
                ctrl_TxtDt_Fim.AcquireTextBox(i_Form.TxtDt_Fim, this, event_val_TxtDt_Fim, dateTextController.FORMAT_DDMMYYYY);
                ctrl_TxtDt_Ini.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);
                ctrl_TxtDt_Fim.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false);

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDt_Ini -

            case event_val_TxtDt_Ini:
            {
                //InitEventCode event_val_TxtDt_Ini

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDt_Ini.BackColor     = Color.Lavender;;
                    ctrl_TxtDt_Ini.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDt_Ini.BackColor     = Color.White;
                    ctrl_TxtDt_Ini.IsUserValidated = true;
                    ctrl_TxtDt_Ini.CleanError();
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_val_TxtDt_Fim -

            case event_val_TxtDt_Fim:
            {
                //InitEventCode event_val_TxtDt_Fim

                switch (arg as string)
                {
                case dateTextController.DATE_INVALID:
                {
                    i_Form.TxtDt_Fim.BackColor     = Color.Lavender;;
                    ctrl_TxtDt_Fim.IsUserValidated = false;
                    break;
                }

                case dateTextController.DATE_VALID:
                {
                    i_Form.TxtDt_Fim.BackColor     = Color.White;
                    ctrl_TxtDt_Fim.IsUserValidated = true;
                    ctrl_TxtDt_Fim.CleanError();
                    break;
                }

                default: break;
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BuscaDados -

            case event_BuscaDados:
            {
                //InitEventCode event_BuscaDados

                i_Form.LstMsg.Items.Clear();
                var_util.clearPortable();

                string st_csv_content = "";

                if (!var_exchange.fetch_edu_messages(ref header,
                                                     ref st_csv_content))
                {
                    return(false);
                }

                ArrayList full_memory = new ArrayList();

                while (st_csv_content != "")
                {
                    ArrayList tmp_memory = new ArrayList();

                    if (var_exchange.fetch_memory(st_csv_content, "1000",
                                                  ref st_csv_content,
                                                  ref tmp_memory))
                    {
                        for (int t = 0; t < tmp_memory.Count; ++t)
                        {
                            full_memory.Add(tmp_memory[t] as DataPortable);
                        }
                    }
                }

                for (int t = 0; t < full_memory.Count; ++t)
                {
                    DadosEduMessage dem = new DadosEduMessage(full_memory[t] as DataPortable);

                    string time = var_util.getDDMMYYYY_format(dem.get_dt_start()).Replace(" 00:00:00", "") + " - " +
                                  var_util.getDDMMYYYY_format(dem.get_dt_end()).Replace(" 23:59:59", "");

                    string [] full_row = new string [] { dem.get_st_msg(), time };

                    var_util.savePortable(dem.get_id_mem(), dem);

                    i_Form.LstMsg.Items.Add(var_util.GetListViewItem(dem.get_id_mem(), full_row));
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_LstMsgDoubleClick -

            case event_LstMsgDoubleClick:
            {
                //InitEventCode event_LstMsgDoubleClick

                id = var_util.getSelectedListViewItemTag(i_Form.LstMsg);

                DadosEduMessage dem = new DadosEduMessage(var_util.retrievePortable(id) as DataPortable);

                i_Form.txtMsg.Text = dem.get_st_msg();

                DateTime tim = Convert.ToDateTime(dem.get_dt_start());

                ctrl_TxtDt_Ini.SetTextBoxText(tim.Day.ToString().PadLeft(2, '0') +
                                              tim.Month.ToString().PadLeft(2, '0') +
                                              tim.Year.ToString());

                DateTime tim2 = Convert.ToDateTime(dem.get_dt_end());

                ctrl_TxtDt_Fim.SetTextBoxText(tim2.Day.ToString().PadLeft(2, '0') +
                                              tim2.Month.ToString().PadLeft(2, '0') +
                                              tim2.Year.ToString());

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnNovoClick -

            case event_BtnNovoClick:
            {
                //InitEventCode event_BtnNovoClick

                dlgAutorizacao autor = new dlgAutorizacao();

                autor.ShowDialog();

                Application.DoEvents();

                if (autor.IsConfirmed)
                {
                    DadosEduMessage dem = new DadosEduMessage();

                    dem.set_dt_start(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Ini.getTextBoxValue_Date()));
                    dem.set_dt_end(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Fim.getTextBoxValue_Date().AddHours(23).AddMinutes(59).AddSeconds(59)));
                    dem.set_st_msg(i_Form.txtMsg.Text);

                    var_exchange.ins_edu_msg(ref dem, ref header);

                    doEvent(event_BuscaDados, null);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnAtualizarClick -

            case event_BtnAtualizarClick:
            {
                //InitEventCode event_BtnAtualizarClick

                dlgAutorizacao autor = new dlgAutorizacao();

                autor.ShowDialog();

                Application.DoEvents();

                if (autor.IsConfirmed)
                {
                    DadosEduMessage dem = new DadosEduMessage();

                    dem.set_dt_start(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Ini.getTextBoxValue_Date()));
                    dem.set_dt_end(var_util.GetDataBaseTimeFormat(ctrl_TxtDt_Fim.getTextBoxValue_Date().AddHours(23).AddMinutes(59).AddSeconds(59)));
                    dem.set_st_msg(i_Form.txtMsg.Text);
                    dem.set_id_mem(id);

                    var_exchange.exec_change_edu_msg(ref dem, ref header);

                    doEvent(event_BuscaDados, null);
                }

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnRemoverClick -

            case event_BtnRemoverClick:
            {
                //InitEventCode event_BtnRemoverClick

                if (MessageBox.Show("Remover mensagem?",
                                    "Aviso",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return(false);
                }

                string       tag = var_util.getSelectedListViewItemTag(i_Form.LstMsg);
                DataPortable tmp = var_util.retrievePortable(tag);

                id = "";

                DadosEduMessage dem = new DadosEduMessage(tmp);

                var_exchange.del_edu_msg(dem.get_id_mem(), ref header);

                doEvent(event_BuscaDados, null);

                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }
Ejemplo n.º 12
0
        public override bool doEvent(int event_number, object arg)
        {
            switch (event_number)
            {
                #region - event_Load -

            case event_Load:
            {
                //InitEventCode event_Load

                                        #if ROBOT
                var_util.execDefinedRobot(this, var_alias);
                                        #else
                doEvent(event_Translate, null);
                doEvent(event_FormIsOpening, null);
                                        #endif

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Translate -

            case event_Translate:
            {
                //InitEventCode event_Translate
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_FormIsOpening -

            case event_FormIsOpening:
            {
                //InitEventCode event_FormIsOpening

                i_Form.LblText.Text += mes + "/" + ano + " - Empresa " + st_cod_empresa;

                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_ShowDialog -

            case robot_ShowDialog:
            {
                //InitEventCode robot_ShowDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - robot_CloseDialog -

            case robot_CloseDialog:
            {
                //InitEventCode robot_CloseDialog
                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_Procurar -

            case event_Procurar:
            {
                //InitEventCode event_Procurar

                i_Form.folderBrowserDialog1.ShowNewFolderButton = true;
                i_Form.folderBrowserDialog1.Description         = "Selecione o diretório para o arquivo BDF:";
                i_Form.folderBrowserDialog1.ShowDialog();

                i_Form.TxtFile.Text = i_Form.folderBrowserDialog1.SelectedPath + "fechamen.dbf";

                if (MessageBox.Show("Confirma geração de arquivo?",
                                    "Aviso",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return(false);
                }

                string st_empresa             = "";
                string st_csv_cartao          = "";
                string st_csv_loja            = "";
                string st_csv_loja_content    = "";
                string st_csv_subtotal_loja   = "";
                string st_csv_subtotal_cartao = "";
                string st_csv_cartao_content  = "";
                string st_total = "";

                dlgStatus stat = new dlgStatus("Relatório");

                stat.LblActivity.Text = "Processando no servidor";
                stat.Show();
                Application.DoEvents();

                if (!var_exchange.fetch_rel_3_fech("1",
                                                   mes,
                                                   ano,
                                                   st_cod_empresa,
                                                   "",
                                                   ref header,
                                                   ref st_empresa,
                                                   ref st_csv_cartao,
                                                   ref st_csv_loja,
                                                   ref st_csv_loja_content,
                                                   ref st_csv_subtotal_loja,
                                                   ref st_csv_subtotal_cartao,
                                                   ref st_csv_cartao_content,
                                                   ref st_total))
                {
                    stat.Close();
                    return(false);
                }

                DBfileGen dbf = new DBfileGen(i_Form.folderBrowserDialog1.SelectedPath,
                                              "fechamen",
                                              "dbf");

                dbf.addCampo("data", "date");
                dbf.addCampo("nsu", "varchar(6)");
                dbf.addCampo("matricula", "varchar(6)");
                dbf.addCampo("valor", "currency");
                dbf.addCampo("parcela", "varchar(6)");
                dbf.addCampo("cnpj", "varchar(14)");

                money     money_helper = new money();
                Hashtable mem_Cartoes  = new Hashtable();

                stat.LblActivity.Text = "Obtendo resultados";

                Application.DoEvents();

                #region Busca todos os registros de todos os cartoes
                {
                    ArrayList full_memory = new ArrayList();

                    while (st_csv_cartao_content != "")
                    {
                        ArrayList tmp_memory = new ArrayList();

                        if (var_exchange.fetch_memory(st_csv_cartao_content, "400", ref st_csv_cartao_content, ref tmp_memory))
                        {
                            for (int t = 0; t < tmp_memory.Count; ++t)
                            {
                                full_memory.Add(tmp_memory[t]);
                            }
                        }
                    }

                    for (int t = 0; t < full_memory.Count; ++t)
                    {
                        DadosFechamento df = new DadosFechamento(full_memory[t] as DataPortable);

                        string tmp_cartao = df.get_st_cartao();

                        if (mem_Cartoes [tmp_cartao] == null)
                        {
                            mem_Cartoes [tmp_cartao] = new ArrayList();
                        }

                        ArrayList memoryCart = mem_Cartoes [tmp_cartao] as ArrayList;

                        memoryCart.Add(df);
                    }
                }

                #endregion

                stat.LblActivity.Text = "Escrevendo arquivo";

                Application.DoEvents();

                int tot_Cartoes = var_util.indexCSV(st_csv_cartao);

                ApplicationUtil var_utilFooter = new ApplicationUtil();

                var_utilFooter.indexCSV(st_csv_subtotal_cartao);

                for (int h = 0; h < tot_Cartoes; ++h)
                {
                    string cart = var_util.getCSV(h);

                    ArrayList memCartList = mem_Cartoes [cart] as ArrayList;

                    if (memCartList != null)
                    {
                        for (int t = 0; t < memCartList.Count; ++t)
                        {
                            DadosFechamento df = new DadosFechamento(memCartList[t] as DataPortable);

                            ArrayList lstLine = new ArrayList();

                            lstLine.Add(var_util.getDDMMYYYY_format(df.get_dt_trans()).Substring(0, 10));
                            lstLine.Add(df.get_st_nsu().PadLeft(6, '0'));
                            lstLine.Add(df.get_st_matricula());

                            string vr_val = df.get_vr_valor().PadLeft(3, '0');

                            vr_val = vr_val.Insert(vr_val.Length - 2, ".");

                            lstLine.Add(vr_val);
                            lstLine.Add(df.get_nu_parcela());
                            lstLine.Add(df.get_st_cnpj());

                            dbf.addReg(lstLine);
                        }
                    }
                }

                dbf.save();

                stat.Close();

                //EndEventCode
                return(true);
            }

                #endregion

                #region - event_BtnProcurarClick -

            case event_BtnProcurarClick:
            {
                //InitEventCode event_BtnProcurarClick
                //EndEventCode
                return(true);
            }

                #endregion

            default: break;
            }

            return(false);
        }