You are on page 1of 3

private void localizador_tabajara(string codForn, string DigForn , strin g nNota, string Emissao, string CnpjEmi, string DescrProd ) { clsBanco

clBanco = new clsBanco(); clsBanco clBanco2 = new clsBanco(); OdbcDataReader res1; clBanco.ServerSQL = "RMSHPUX"; clBanco.BancoSQL = ""; clBanco.UserSQL = "LOPES"; clBanco.SenhaSQL = "LOPES"; clBanco.DriverSQL = "Driver={Microsoft ODBC for Oracle}"; clBanco.PortaSQL = "1521"; ArrayList vArray = new ArrayList(); ArrayList vArCode = new ArrayList(); res1 = clBanco.Selecionar2Pg(@"SELECT DISTINCT decode(nvl(git_tipo_p ro,0),9, nvl((select devi_descr_inf from ag1detdv where devi_destino (+) = decode(tbc_int g_3, 'E', esclc_codigo esclc_digito, eschljc_codi go eschljc_digito) and devi_dta_agenda (+) = eschc_data and devi_distrib (+) = decode(tbc_i ntg_3, 'E', eschljc_codigo, esclc_codigo) and devi_nota (+) = eschc_nro_no ta and devi_item (+) = esitc_codigo esitc_digito and devi_tipo (+) = 9), nvl( (select devi_descr_inf from ag1detdv,ag1devcp where devc_agenda_saida_1 = eschc_agenda and devc_nota_saida_1 = eschc_nro_nota

and devc_serie_saida_1 = eschc_ser_nota and devc_data_saida_1 and devc_destino * 10 + eschljc_digito and devi_nota and devi_serie and devi_dta_agenda a and devi_destino and devi_distrib and devi_item 10 + esitc_digito and devi_tipo cao)) ,GIT_DESCRICAO) as GIT_DESCRICAO, ESITC_DIGITO,8) CODIGO, ENTSAIC_QUANTI_UN, ENTSAIC_BASE_EMB FROM AG1IENSA, AA3CITEM, AG1FENSA, AA1CTC ON, AA2CPISI , ag2trbit fec, ag2trbit ret WHERE ESITC_CODIGO = GIT_COD_ITE M AND ESITC_DIGITO = GIT_DIGITO AND ESCHLJC_CODIGO = 14571 RPAD(ESITC_CODIGO = 9) ,git_descri = devc_destino = devc_distrib = esitc_codigo * = devc_nota = devc_serie = devc_dta_agend = eschc_data = eschljc_codigo

AND AND AND AND AND AND AND AND

ESCHLJC_DIGITO = 8 ESCHC_NRO_NOTA = 12279 ESCHC_DATA = 1110630 ESIT_CODIGO(+) = ESITC_CODIGO ESIT_DIGITO(+) = ESITC_DIGITO ESCH_DATA(+)= ESCHC_DATA ESCH_AGENDA(+) = ESCHC_AGENDA ESCHLJ_CODIGO(+)= ESCHLJC_CODIGO

AND ESCHLJ_DIGITO(+)= ESCHLJC_DIGITO AND ESCH_NRO_NOTA(+)= ESCHC_NRO_NOTA AND ESCH_SER_NOTA(+)= ESCHC_SER_NOTA AND AND AND AND DA AND fec.TRBIT_COD_ORG (+)= ESCHLJC_C ODIGO AND fec.TRBIT_NRO_NOTA (+)= ESCHC_NR O_NOTA AND fec.TRBIT_SER_NOTA (+)= ESCHC_SE R_NOTA AND fec.TRBIT_COD_ITE (+)= ESITC_COD IGO /* AND fec.TRBIT_COD_TRB (+)= 37 AND fec.TRBIT_TIP_TRB (+)= 'IT' */ AND ret.TRBIT_DATA (+)= ESCHC_DATA AND ret.TRBIT_AGENDA (+)= ESCHC_AGEN DA AND ret.TRBIT_COD_ORG (+)= ESCHLJC_C ODIGO AND ret.TRBIT_NRO_NOTA (+)= ESCHC_NR O_NOTA AND ret.TRBIT_SER_NOTA (+)= ESCHC_SE R_NOTA AND ret.TRBIT_COD_ITE (+)= ESITC_COD IGO /* AND ret.TRBIT_COD_TRB (+)= 39 AND ret.TRBIT_TIP_TRB (+)= 'IT' */ and pisi_agd(+)= ESCHC_AGENDA and pisi_org(+)= ESCHLJC_CODIGO and pisi_nta(+)= ESCHC_NRO_NOTA and pisi_ser(+)= ESCHC_SER_NOTA and pisi_dta(+)= ESCHC_DATA and pisi_dst(+)= ESCLC_CODIGO and pisi_ite(+)= ESITC_CODIGO ORDER BY 1 "); TBC_AGENDA (+) = ESCHC_AGENDA TBC_CODIGO (+) = 0 fec.TRBIT_DATA (+)= ESCHC_DATA fec.TRBIT_AGENDA (+)= ESCHC_AGEN

//string vVar = "PRESERV. PROSEX CX 24X6 MORANGO ".Replace(" ", "").ToUpper(); string vVar = DescrProd.Replace(" ", "").ToUpper(); while (res1.Read()) { // If the temporary table has not code. So, the array below will

be vArray.Add(res1["GIT_DESCRICAO"].ToString()); vArCode.Add(res1["GIT_DESCRICAO"].ToString()); } int i = 0; int s = 0; int y = 0; while (i <= vArray.Count - 1) { string vVar2 = vArray[i].ToString(); while (y <= vVar2.Length - 1) { //vVar = vVar.Replace(vVar2[y].ToString() + vVar2[y+1].ToStr ing(), "*"); try { // vVar = vVar.Replace(vVar2.Substring(y, 2), "**"); if (vVar.IndexOf(vVar2.Substring(y, 2)) > -1) { // ); s++; } } catch { } y++; } i++; listBox1.Items.Add(vVar2 + " " + s.ToString()); s = 0; y = 0; } } vVar = vVar.Replace(vVar2.Substring(y, 1), "**"