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); }
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); }
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); }