private string ObtenerHistoricoMoneda() { string sAux = ""; StringBuilder sb = new StringBuilder(); try { sb.Append("<table id='tblDatos' style='WIDTH: 300px;' mantenimiento='1'>"); sb.Append("<colgroup>"); sb.Append("<col style='width:180px;' />"); //Denominación sb.Append("<col style='width:120px;' />"); //Tipo de cambio sb.Append("</colgroup>"); sb.Append("<tbody>"); SqlDataReader dr = TIPOCAMBIOMENSUAL.Catalogo(hdnID.Text); while (dr.Read()) { sb.Append("<tr id='" + dr["t699_anomes"].ToString() + "' style='height:20px;cursor:pointer;' onclick='ms(this)' bd=''>"); #region Creación tabla HTML sb.Append("<td style='text-align:center;'>" + Fechas.AnnomesAFechaDescLarga(int.Parse(dr["t699_anomes"].ToString())) + "</td>"); sb.Append("<td style='text-align:left;'>");//CELL 2 sAux = double.Parse(dr["t699_tipocambio"].ToString()).ToString("##,##0.0000"); sb.Append("<input type='text' maxlength='9' style='width:80px' "); if (int.Parse(dr["t699_anomes"].ToString()) >= int.Parse((DateTime.Now.Year * 100 + DateTime.Now.Month).ToString())) { sb.Append(" class='txtNumV' value=\"" + sAux + "\">"); } else { sb.Append(" class='txtNumL' onfocus='fn(this,5, 4)' value=\"" + sAux + "\" onKeyUp='mod(this);'>"); } sb.Append("</td>"); sb.Append("</tr>"); #endregion } dr.Close(); dr.Dispose(); sb.Append("</tbody>"); sb.Append("</table>"); return("OK@#@" + sb.ToString()); } catch (Exception ex) { return("Error@#@" + Errores.mostrarError("Error al obtener el histórico de monedas", ex)); } }
protected string Grabar(string strDatos) { string sResul = ""; try { oConn = Conexion.Abrir(); tr = Conexion.AbrirTransaccion(oConn); } catch (Exception ex) { if (oConn.State == ConnectionState.Open) { Conexion.Cerrar(oConn); } sResul = "Error@#@" + Errores.mostrarError("Error al abrir la conexión", ex); return(sResul); } try { string[] aTipoCambio = Regex.Split(strDatos, "///"); foreach (string oTipoCambio in aTipoCambio) { if (oTipoCambio == "") { continue; } string[] aValores = Regex.Split(oTipoCambio, "##"); //0. Opcion BD. "D" //1. ID anomes //2. Tipo de cambio switch (aValores[0]) { case "U": TIPOCAMBIOMENSUAL.Update(tr, hdnID.Text, int.Parse(aValores[1]), decimal.Parse(aValores[2])); break; } } Conexion.CommitTransaccion(tr); sResul = "OK@#@"; } catch (Exception ex) { Conexion.CerrarTransaccion(tr); sResul = "Error@#@" + Errores.mostrarError("Error al grabar los tipos de cambio mensuales de las monedas.", ex) + "@#@"; } finally { Conexion.Cerrar(oConn); } return(sResul); }
private string getLineas(string sSerie, string sNumero) { try { StringBuilder sb = new StringBuilder(); decimal dTotFact = 0, dTotCobro = 0; string sHayCobros = "F", sAnoMes = "", sClaseEco = ""; int iAnoMes = Factura.GetAnoMes(sSerie, int.Parse(sNumero)); int i = 0; StringBuilder sb2 = new StringBuilder(); sb2.Append(" aTipo = new Array();"); //SqlDataReader dr2 = TIPOCAMBIOMENSUAL.ListaMes(sSerie, sNumero); SqlDataReader dr2 = TIPOCAMBIOMENSUAL.ListaMes(iAnoMes); while (dr2.Read()) { sb2.Append("aTipo[" + i.ToString() + "] = {idM:\"" + dr2["t422_idmoneda"].ToString() + "\"," + "tc:\"" + dr2["t699_tipocambio"].ToString() + "\"};"); //\n i++; } SqlDataReader dr = Factura.LineasYCobros(sSerie, int.Parse(sNumero)); sb.Append("<table id='tblDatos' class='texto MANO' style='width: 950px;' mantenimiento='1'>"); //sb.Append("<colgroup><col style='width:10px;' /><col style='width:290px;' /><col style='width:100px;text-align:right;' />"); //sb.Append("<col style='width:100px;text-align:right;' /><col style='width:30px;text-align:right;' />"); //sb.Append("<col style='width:20px;text-align:right;padding-right:3px;' /><col style='width:120px;' /><col style='width:120px;' />"); //sb.Append("<col style='width:160px;' /></colgroup>"); sb.Append("<colgroup><col style='width:10px;' /><col style='width:275px;' /><col style='width:80px;' />"); sb.Append("<col style='width:80px;' /><col style='width:80px;' />"); sb.Append("<col style='width:80px;' /><col style='width:30px;' />"); sb.Append("<col style='width:25px;' /><col style='width:25px;' />"); sb.Append("<col style='width:95px;' /><col style='width:100px;' /><col style='width:70px;' /></colgroup>"); sb.Append("<tbody id='tbodyDatos'>"); while (dr.Read()) { sHayCobros = "T"; dTotFact += decimal.Parse(dr["importeEU"].ToString()); dTotCobro += decimal.Parse(dr["cobroEU"].ToString()); if (sAnoMes == "") { sAnoMes = dr["t325_anomes"].ToString(); } if (sClaseEco == "") { sClaseEco = dr["t329_idclaseeco"].ToString(); } sb.Append("<tr id='" + dr["t376_iddatoeco"].ToString() + "' iPSN='" + dr["t305_idproyectosubnodo"].ToString() + "'"); sb.Append(" cat='" + dr["t301_categoria"].ToString() + "'"); sb.Append(" cua='" + dr["t305_cualidad"].ToString() + "'"); sb.Append(" est='" + dr["t301_estado"].ToString() + "'"); sb.Append(" mp='" + dr["t422_denominacionimportes"].ToString() + "'"); sb.Append(" bd='' onclick='mm(event)' style='height:20px'>"); sb.Append("<td><img src='../../../images/imgFN.gif'></td>"); sb.Append("<td>"); switch (dr["t301_categoria"].ToString()) { case "P": sb.Append("<img src='../../../images/imgProducto.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"); break; default: sb.Append("<img src='../../../images/imgServicio.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"); break; } switch (dr["t305_cualidad"].ToString()) { case "C": sb.Append("<img src='../../../images/imgIconoContratante.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"); break; case "J": sb.Append("<img src='../../../images/imgIconoRepJor.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"); break; case "P": sb.Append("<img src='../../../images/imgIconoRepPrecio.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"); break; } switch (dr["t301_estado"].ToString()) { case "A": sb.Append("<img src='../../../images/imgIconoProyAbierto.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"); break; case "C": sb.Append("<img src='../../../images/imgIconoProyCerrado.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"); break; case "H": sb.Append("<img src='../../../images/imgIconoProyHistorico.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"); break; case "P": sb.Append("<img src='../../../images/imgIconoProyPresup.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"); break; } sb.Append("<nobr class='NBR W190' style='margin-left:5px;' "); //sb.Append("title='" + dr["t301_denominacion"].ToString()); sb.Append(" title=\"cssbody=[dvbdy] cssheader=[dvhdr] header=[<img src='../../../images/info.gif' style='vertical-align:middle' /> Información] body=[<label style='width:60px;'>" + Estructura.getDefCorta(Estructura.sTipoElem.NODO) + ":</label>" + dr["t303_denominacion"].ToString().Replace((char)34, (char)39) + "<br><label style='width:60px;'>Proyecto:</label>" + dr["t301_denominacion"].ToString().Replace((char)34, (char)39) + "] hideselects=[off]\""); sb.Append(">" + int.Parse(dr["t301_idproyecto"].ToString()).ToString("#,###") + " " + dr["t301_denominacion"].ToString()); sb.Append("</nobr></td>"); sb.Append("<td style='text-align:right;'><input type='text' class='txtNumL' style='width:80px;' value=\"" + decimal.Parse(dr["importeEU"].ToString()).ToString("N") + "\" onKeyUp='vtn(event);fm(event);recTotal();setImpMoneda(this);' onfocus='fn(this)'></td>"); sb.Append("<td style='text-align:right;'>" + decimal.Parse(dr["importeMP"].ToString()).ToString("N") + "</td>"); sb.Append("<td style='text-align:right;'>" + decimal.Parse(dr["cobroEU"].ToString()).ToString("N") + "</td>"); sb.Append("<td style='text-align:right;padding-right:3px;'>" + decimal.Parse(dr["cobroMP"].ToString()).ToString("N") + "</td>"); sb.Append("<td title='" + dr["t422_denominacionimportes"].ToString() + "'>" + dr["t422_idmoneda"].ToString() + "</td>"); sb.Append("<td style='text-align:right;'>" + dr["t325_anomes"].ToString().Substring(0, 4) + "</td>"); sb.Append("<td style='text-align:right;padding-right:3px;'>" + dr["t325_anomes"].ToString().Substring(4, 2) + "</td>"); //sb.Append("<td title='" + dr["denCliProy"].ToString() + "'>"); sb.Append("<td title=\"cssbody=[dvbdy] cssheader=[dvhdr] header=[<img src='../../../images/info.gif' style='vertical-align:middle' /> Información] body=[<label style='width:60px;'>Cód.Ext.:</label>" + dr["codCliProy"].ToString() + "<br><label style='width:60px;'>Cliente:</label>" + dr["denCliProy"].ToString().Replace((char)34, (char)39) + "] hideselects=[off]\""); sb.Append("><nobr class='NBR W100' style='margin-left:5px;'>" + dr["denCliProy"].ToString() + "</nobr></td>"); //sb.Append("<td title='" + dr["denCliFact"].ToString() + "'><nobr class='NBR W100' style='margin-left:5px;'>" + dr["denCliFact"].ToString() + "</nobr></td>"); sb.Append("<td title=\"cssbody=[dvbdy] cssheader=[dvhdr] header=[<img src='../../../images/info.gif' style='vertical-align:middle' /> Información] body=[<label style='width:60px;'>Cód.Ext.:</label>" + dr["codCliFact"].ToString() + "<br><label style='width:60px;'>Cliente:</label>" + dr["denCliFact"].ToString().Replace((char)34, (char)39) + "] hideselects=[off]\""); sb.Append("><div class='NBR W100' style='margin-left:5px;'>" + dr["denCliFact"].ToString() + "</div></td>"); sb.Append("<td title='" + dr["t376_motivo"].ToString() + "'><div class='NBR W70' style='margin-left:0px;'>" + dr["t376_motivo"].ToString() + "</div></td>"); sb.Append("</tr>"); } dr.Close(); dr.Dispose(); sb.Append("</tbody>"); sb.Append("</table>"); return("OK@#@" + sb.ToString() + "@#@" + sHayCobros + "@#@" + dTotFact.ToString("N") + "@#@" + dTotCobro.ToString("N") + "@#@" + sAnoMes + "@#@" + sClaseEco + "@#@" + sb2.ToString()); } catch (Exception ex) { return("Error@#@" + Errores.mostrarError("Error al obtener las líneas de la factura.", ex)); } }