public bool GuardarCatalogoHijo(Catalogos_VM cat) { try { using (var contexto = new ControlAlumnosEntities()) { catalogos catalogo = new catalogos(); catalogo.idPadre = cat.idPadre; catalogo.Nombre = cat.Nombre; catalogo.activo = true; contexto.catalogos.Add(catalogo); contexto.SaveChanges(); return(true); } } catch (Exception) { return(false); throw; } }
public bool BorrarCatalogo(Catalogos_VM cat) { try { using (var contexto = new ControlAlumnosEntities()) { catalogos catalogo = new catalogos(); catalogo.id = cat.id; catalogo.idPadre = cat.idPadre; catalogo.Nombre = cat.Nombre; catalogo.activo = false; contexto.Entry(catalogo).State = EntityState.Modified; contexto.SaveChanges(); return(true); } } catch (Exception ex) { return(false); throw; } }
protected void Page_Load(object sender, EventArgs e) { try { hidUsuario.Value = Session["Usuario"].ToString(); hidNumEmp.Value = Session["NumEmp"].ToString(); hidTipoEmp.Value = Session["TipoEmp"].ToString(); //string[] a = Request.Form.AllKeys; //Conexion c = new Conexion("E-DESARROLL2", "Initial02"); Conexion con = new Conexion(); catalogos c = new catalogos(); if (con.conectar()) { List <string> mon = con.monedas(); List <meins> mei = con.meinss(); monedas = formaMoneda("MXN", mon); um_meins = formaMeins("", mei); fecha_limite = con.fechaLimite(); if (Request.Form.AllKeys.Length == 0) { //IRfcTable lista_vkorg = con.ListaVKORG(""); //IRfcTable lista_vtweg = con.ListaVTWEG(""); IRfcTable lista_spart = con.ListaSPART("", hidNumEmp.Value, "", "", "02"); //IRfcTable lista_pltyp = con.ListaPLTYP(hidNumEmp.Value); //for (int i = 0; i < lista_vkorg.Count; i++) //{ // lista_vkorg.CurrentIndex = i; // txtVKORG.Items.Add(new ListItem(lista_vkorg.GetString("VKORG") + " " + lista_vkorg.GetString("VTEXT"), lista_vkorg.GetString("VKORG"))); //} //for (int i = 0; i < lista_vtweg.Count; i++) //{ // lista_vtweg.CurrentIndex = i; // txtVTWEG.Items.Add(new ListItem(lista_vtweg.GetString("VTWEG") + " " + lista_vtweg.GetString("VTEXT"), lista_vtweg.GetString("VTWEG"))); //} for (int i = 0; i < lista_spart.Count; i++) { lista_spart.CurrentIndex = i; txtSPART.Items.Add(new ListItem(lista_spart.GetString("SPART") + " " + lista_spart.GetString("VTEXT"), lista_spart.GetString("SPART"))); } } if (Request.Form.AllKeys.Length > 0) { string vkorg = Request.Form["txtVKORG"]; string vtweg = Request.Form["txtVTWEG"]; string spart = Request.Form["txtSPART"]; string pltyp = Request.Form["txtPLTYP"].Split(' ')[0]; string matkl = Request.Form["txtMATKL"]; string p_inc = Request.Form["P_inc"]; string p_dec = Request.Form["P_dec"]; string c_inc = Request.Form["C_inc"]; string c_dec = Request.Form["C_dec"]; string cambio = p_inc + p_dec + c_inc + c_dec; if (cambio.Trim().Equals("")) { cambio = "X"; } else { cambio = ""; } matkl = matkl.Split(' ')[0]; IRfcTable a720 = con.consultaLPDetail("", "", spart, "", "", matkl, pltyp, "A610"); txtPos.Value = a720.Count + ""; string tabla = ""; string valores = ""; tabla = "<table id='Table9' style='borde -width: 0px; border-style: None; width: 100 %; border-collapse: collapse;'><tbody><tr class='cell08'><td></td></tr></tbody></table>"; tabla += "<table id='tblTabla' border='0' style='border-width: 0px; border-style: None; width: 100%; border-collapse: collapse;'><tbody>"; tabla += "<tr><td class='tablahead'>Gpo de artículos</td><td class='tablahead'>Denominación</td><td class='tablahead'>Unidad</td>" + "<td class='tablahead'>Precio actual</td><td class='tablahead'>Moneda</td>" + "<td class='tablahead'>Precio nuevo</td><td class='tablahead'>Moneda</td>" + "<td class='tablahead'>Válido de</td><td class='tablahead'>Válido a</td><td class='tablahead'></td><td class='tablahead'></td></tr>"; if (a720.Count > 0) { List <SolicitudesL> ss = new List <SolicitudesL>(); for (int i = 0; i < a720.Count; i++) { SolicitudesL s = new SolicitudesL(); a720.CurrentIndex = i; s.obj = a720.GetString("MATKL"); s.importe = a720.GetString("KBETR"); s.moneda = a720.GetString("KONWA"); s.importe_n = nuevoPrecio(a720.GetString("KBETR")); s.moneda_n = a720.GetString("KONWA"); s.fecha_a = f.fecha(a720.GetString("DATAB")); s.fecha_b = f.fecha(a720.GetString("DATBI")); s.id = a720.GetString("KNUMH"); s.escala = a720.GetString("ESCALA"); s.desc2 = a720.GetString("KMEIN"); ss.Add(s); } ss = obtenerDatos(ss, "G"); int pos = 0; for (int i = 0; i < ss.Count; i++) { pos++; tabla += "<tr id='tr-" + pos + "'><td class='tablaCent' id='OBJ-" + pos + "' ondblclick='escalas(this.id)'>"; tabla += "<input type='hidden' id='MATKL-" + pos + "' value='" + ss[i].obj + "' />"; tabla += ss[i].obj; tabla += "</td>"; tabla += "<td class='tablaCent' id='DESC-" + pos + "' ondblclick='escalas(this.id)'>"; tabla += ss[i].desc; tabla += "</td>"; tabla += "<td class='tablaCent' id='DESC2-" + pos + "' ondblclick='escalas(this.id)'>"; tabla += "<select id='MEINS-" + pos + "' class='cell031' style='width:40px;' onchange='cambiaMeins(this.id, this.value)' />"; tabla += formaMeins(ss[i].desc2, mei); tabla += "</select>"; tabla += "</td>"; tabla += "<td class='tablaCent'>"; tabla += ss[i].importe; tabla += "</td><td class='tablaCent'>"; tabla += ss[i].moneda; tabla += "<td class='tablaCent'>"; tabla += "<input class='cell031' type='text' onchange='cambiaCant(this.id)' id='KBETR-" + pos + "' value='"; tabla += ss[i].importe_n; tabla += "' />"; tabla += "</td><td class='tablaCent'>"; tabla += "<select class='cell031' type='text' onchange='cambiaMone(this)' id='KONWA-" + pos + "' >"; //tabla += "<option>MXN</option><option>USD</option><option>EUR</option>"; tabla += formaMoneda(ss[i].moneda_n, mon); tabla += "' </select>"; tabla += "</td><td class='tablaCent'>"; tabla += "<input class='cell031 datepicker' type='text' onchange='cambiaFechA(this.value, this.id);' ondblclick='copiaA(this.value)' id='DATAB-" + pos + "' value='"; tabla += f.fechaToOUT(ss[i].fecha_a); tabla += "' />"; tabla += "</td><td class='tablaCent'>"; tabla += "<input class='cell031 datepicker' type='text' onchange='cambiaFechB(this.value, this.id);' ondblclick='copiaB(this.value)' id='DATBI-" + pos + "' value='"; tabla += f.fechaToOUT(ss[i].fecha_b); tabla += "' />"; tabla += "</td>"; tabla += "<td><input type='checkbox' id='chk-" + pos + "'"; if (ss[i].escala.Equals("X")) { tabla += "checked disabled='disabled' /><input type='hidden' id='knumh-" + pos + "' value='" + ss[i].id + "' /><script>generaEscalas('" + ss[i].id + "', " + pos + ");</script></td>"; } else { tabla += " disabled='disabled' /><input type='hidden' id='knumh-" + pos + "' value='' /></td>"; } tabla += "<td class='tablaCent'><input type='button' id='btn-" + pos + "' value='-' class='btn2' onclick='elimina(this.id)' /></td></tr>"; valores += ss[i].obj + "|" + ss[i].importe + "|" + ss[i].moneda + "|"; valores += ss[i].importe_n; if (ss[i].moneda_n.Trim().Equals("")) { valores += "|MXN|"; } else { valores += "|" + ss[i].moneda_n + "|"; } valores += f.fechaToOUT(ss[i].fecha_a) + "|" + f.fechaToOUT(ss[i].fecha_b) + "|" + ss[i].id + "|X|"; btnSubmit.Disabled = false; valores += ss[i].desc2 + "|"; if (!matkl.Trim().Equals("")) { btnAgregar.Disabled = true; } else { btnAgregar.Disabled = false; } btnCargar.Disabled = false; } } else { if (!matkl.Trim().Equals("")) { tabla += "<tr id='tr-1'><td class='tablaCent' id='OBJ-1' ondblclick='escalas(this.id)'>"; tabla += "<input type='hidden' id='MATKL-1' value='" + matkl + "' />"; tabla += matkl; tabla += "</td>"; tabla += "<td>"; tabla += con.columnaMatkl(matkl, "WGBEZ"); tabla += "</td>"; tabla += "<td>"; tabla += "<select id='MEINS-1' class='cell031' style='width:40px;' onchange='cambiaMeins(this.id, this.value)' />"; tabla += formaMeins("M2", mei); tabla += "</select>"; tabla += "</td>"; tabla += "<td>0.00</td><td></td>"; tabla += "<td class='tablaCent'><input class='cell031' type='text' onchange='cambiaCant(this.id)' id='KBETR-1' /></td>"; tabla += "<td class='tablaCent'><select class='cell031' onchange='cambiaMone(this)' id='KONWA-1'>"; tabla += formaMoneda("MXN", mon); tabla += "</select></td>"; tabla += "<td class='tablaCent'><input class='cell031 datepicker' type='text' onchange='cambiaFechA(this.value, this.id);' ondblclick='copiaA(this.value)' onblur='revisaFechaA(this.id);' id='DATAB-1' /></td>"; tabla += "<td class='tablaCent'><input class='cell031 datepicker' type='text' onchange='cambiaFechB(this.value, this.id)' ondblclick='copiaB(this.value)' onblur='revisaFechaA(this.id);' id='DATBI-1' /></td>"; tabla += "<td><input type='checkbox' id='chk-1'"; tabla += " disabled='disabled' /><input type='hidden' id='knumh-1' value='' /></td>"; tabla += "<td class='tablaCent'><input type='button' id='chk-1' value='-' class='btn2' onclick='elimina(this.id)' /></td></tr>"; if (con.columnaMatkl(matkl, "WGBEZ").Equals("")) { txtMATKL.Value = ""; tabla = ""; txtPos.Value = "0"; } else { btnAgregar.Disabled = true; btnSubmit.Disabled = false; valores += matkl + "|0.00||0.00|MXN||||X|M|"; txtPos.Value = "0"; } } else { btnAgregar.Disabled = false; btnCargar.Disabled = false; txtPos.Value = "0"; } } //else //{ // btnSubmit.Disabled = true; //} tabla += "</tbody></table>"; lblTabla.InnerHtml = tabla; txtTabla.Value = valores; } } } catch (Exception ex) { //Response.Redirect("../../../Default.aspx"); var page = HttpContext.Current.Handler as Page; if (page != null) { page.ClientScript.RegisterClientScriptBlock(typeof(string), "Redirect", "window.parent.location='https://www.terzaonline.com/nworkflow/login/';", true); } //ClientScriptManager.RegisterClientScriptBlock(this.GetType(), "RedirectScript", "window.parent.location = '../../../Default.aspx'", true); } }
protected void Page_Load(object sender, EventArgs e) { string tipoF = Request.QueryString["Tipo"]; string folio = Request.QueryString["Folio"]; oper = Request.QueryString["Oper"]; string posi = Request.QueryString["posi"]; hidTipo.Value = tipoF; hidFolio.Value = folio; hidOper.Value = "N"; hidPosi.Value = posi; Conexion con = new Conexion(); catalogos c = new catalogos(); if (oper != null) { if (oper.Equals("N")) { string links = ""; links += "<a href='Procesa.aspx"; links += "?Tipo=" + tipoF + "&Folio=" + folio + "&Oper=A&Posi=" + posi; links += "'>Autorizar</a> | <a href='Procesa.aspx"; links += "?Tipo=" + tipoF + "&Folio=" + folio + "&Oper=R&Posi=" + posi; links += "'>Rechazar</a> | <a href='Default.aspx'>Regresar</a> "; //links += "| <a href='https://www.terzaonline.com/nworkflow/login/'>Cerrar sesión</a> "; links += " "; hidOper.Value = oper; lblLinks.InnerHtml = links; if (con.conectar()) { if (tipoF.Equals("01")) { IRfcTable header = con.consultaCabecera(folio, ""); IRfcTable detail = con.consultaDetalle(folio, ""); List <Solicitudes> ss = new List <Solicitudes>(); if (header.Count > 0) { txtFolio.InnerText = "Autorización de Solicitud " + header.GetString("ID_SOLICITUD"); txtPERNR.InnerText = header.GetString("PERNR") + " " + con.nombrePERNR(header.GetString("PERNR")); txtDATE.InnerText = f.fechaToOUT(f.fecha(header.GetString("FECHA"))); txtCOMM.InnerText = header.GetString("COMMENTS"); for (int i = 0; i < detail.Count; i++) { detail.CurrentIndex = i; Solicitudes s = new Solicitudes(); s.vkorg = detail.GetString("VKORG"); s.vtweg = detail.GetString("VTWEG"); s.spart = detail.GetString("SPART"); s.kunnr = detail.GetString("KUNNR"); s.pltyp = detail.GetString("LP_ANT"); s.pltyp_n = detail.GetString("LP_NVO"); s.date = f.fecha(detail.GetString("FECHA")); if (!s.pltyp.Equals("")) { //s.pltyp_desc = c.getDescLP(s.pltyp); s.pltyp_desc = con.getLP_Desc("", s.pltyp); } else { s.pltyp_desc = "Sin lista de precios"; } if (!s.pltyp_n.Equals("")) { //s.pltyp_n_desc = c.getDescLP(s.pltyp_n); s.pltyp_n_desc = con.getLP_Desc("", s.pltyp_n); } else { s.pltyp_n_desc = "Sin lista de precios"; } s.name1 = c.getColumnaCliente(s.vkorg, s.vtweg, s.spart, s.kunnr, "NAME1"); ss.Add(s); } string tab = ""; tab = "<table border='0' style='border-width: 0px; border-style: None; width: 100%; border-collapse: collapse;'><tbody>"; tab += "<tr><td class='cell12'>Org. Compras</td><td class='cell12'>Canal Dist.</td><td class='cell12'>Sector</td><td class='cell12'>Cliente</td><td class='cell12'>Nombre</td><td class='cell12'>Lista anterior</td><td class='cell12'>Nueva Lista de precios</td><td class='cell12'>Vigencia</td></tr>"; foreach (Solicitudes s in ss) { string style = ""; if (s.error) { style = "background-color: red !important;"; } tab += "<tr style='" + style + "'>"; if (s.error) { style = "white-text"; } tab += "<td class='cell18 " + style + "'>" + s.vkorg + "</td>"; tab += "<td class='cell18 " + style + "'>" + s.vtweg + "</td>"; tab += "<td class='cell18 " + style + "'>" + s.spart + "</td>"; tab += "<td class='cell18 " + style + "'>" + s.kunnr + "</td>"; tab += "<td class='cell17 " + style + "'>" + s.name1 + "</td>"; tab += "<td class='cell18 " + style + "'>" + s.pltyp_desc + "</td>"; tab += "<td class='cell18 " + style + "'>" + s.pltyp_n_desc + "</td>"; tab += "<td class='cell18 " + style + "'>" + s.date.ToString("dd/MM/yyyy") + "</td>"; tab += "</tr>"; } tab += "</tbody></table>"; lblTabla.InnerHtml = tab; } else { Response.Redirect("Default.aspx", false); } } else if (tipoF.Equals("02")) { IRfcTable header = con.consultaCabeceraL(folio, ""); IRfcTable detail = con.consultaDetalleL(folio, ""); List <SolicitudesL> ss = new List <SolicitudesL>(); if (header.Count > 0) { txtFolio.InnerText = "Autorización de Solicitud " + header.GetString("ID_SOLICITUD"); txtPERNR.InnerText = header.GetString("PERNR") + " " + con.nombrePERNR(header.GetString("PERNR")); txtDATE.InnerText = f.fechaToOUT(f.fecha(header.GetString("FECHA"))); txtCOMM.InnerText = header.GetString("COMMENTS"); string vkorg = header.GetString("VKORG"); string vtweg = header.GetString("VTWEG"); string spart = header.GetString("SPART"); string kunnr = header.GetString("KUNNR"); string pltyp = header.GetString("PLTYP"); string matnr = header.GetString("MATNR"); string cabecera = "<table style='position: relative; left: 50%; margin-left: -200px'>"; //cabecera += "<tr>"; if (!vkorg.Equals("")) { cabecera += "<tr><td class='cell03'>Org. Compras</td>"; cabecera += "<td class='cell05'>" + vkorg + " " + con.ListaVKORG(vkorg, "").GetString("VTEXT") + "</td></tr>"; } if (!vtweg.Equals("")) { cabecera += "<tr><td class='cell03'>Canal Distribución</td>"; cabecera += "<td class='cell05'>" + vtweg + " " + con.ListaVTWEG(vtweg, "", "").GetString("VTEXT") + "</td></tr>"; } if (!spart.Equals("")) { cabecera += "<tr><td class='cell03'>Sector</td>"; cabecera += "<td class='cell05'>" + spart + " " + con.ListaSPART(spart, "", "", "", "").GetString("VTEXT") + "</td></tr>"; } if (!kunnr.Equals("")) { cabecera += "<tr><td class='cell03'>Cliente</td>"; cabecera += "<td class='cell05'>" + kunnr + " " + con.getCliente(vkorg, vtweg, spart, kunnr).GetString("NAME1") + "</td></tr>"; } if (!pltyp.Equals("")) { cabecera += "<tr><td class='cell03'>Lista de precios</td>"; cabecera += "<td class='cell05'>" + con.getLP_Desc("", pltyp) + "</td></tr>"; } if (!matnr.Equals("")) { cabecera += "<tr><td class='cell03'>Material</td>"; cabecera += "<td class='cell05'>" + matnr + " " + con.columnaMatnr(matnr, "MAKTG", "X") + "</td></tr>"; } cabecera += "<tr><td class='cell03'>Porcentaje</td>"; cabecera += "<td class='cell05'>" + header.GetString("PORCENTAJE") + " %" + "</td></tr>"; cabecera += "</table>"; lblFolio.InnerHtml = cabecera; string tipo = header.GetString("TIPO"); string obj = ""; string titulo = ""; if (tipo.Substring(1, 1).Equals("M")) { obj = "MATNR"; titulo = "Material"; } else if (tipo.Substring(1, 1).Equals("G")) { obj = "MATKL"; titulo = "Grupo de artículos"; } else if (tipo.Substring(1, 1).Equals("P")) { obj = "EBELN"; titulo = "Pedido de cliente"; } else if (tipo.Substring(1, 1).Equals("L")) { obj = "CHARG"; titulo = "Lote"; } for (int i = 0; i < detail.Count; i++) { detail.CurrentIndex = i; SolicitudesL s = new SolicitudesL(); s.obj = detail.GetString(obj); //s.desc = detail.GetString("VTWEG"); //s.desc2 = detail.GetString("SPART"); s.importe = detail.GetString("PR_ANT"); s.moneda = detail.GetString("MON_ANT"); s.importe_n = detail.GetString("PR_NVO"); s.moneda_n = detail.GetString("MON_NVO"); s.fecha_a = f.fecha(detail.GetString("FECHA_INI")); s.fecha_b = f.fecha(detail.GetString("FECHA_FIN")); s.comentario = detail.GetString("COMMENTS"); //if (tipo.Substring(1, 1).Equals("M")) //{ // s.desc = con.columnaMatnr(s.obj, "MAKTG"); // s.desc2 = con.columnaMatnr(s.obj, "MEINS"); //} //else if (tipo.Substring(1, 1).Equals("G")) //{ // s.desc = con.columnaMatkl(s.obj, "WGBEZ"); //} ss.Add(s); } ss = obtenerDatos(ss, tipo.Substring(1, 1)); string tab = ""; tab = "<table border='0' style='border-width: 0px; border-style: None; width: 100%; border-collapse: collapse;'><tbody>"; tab += "<tr>"; tab += "<td class='cell10'>" + titulo + "</td>"; if (!tipo.Substring(1, 1).Equals("P") & !tipo.Substring(1, 1).Equals("L")) { tab += "<td class='cell11'>Denominación</td>"; } if (tipo.Substring(1, 1).Equals("M")) { tab += "<td class='cell12'>Unidad</td>"; } tab += "<td class='cell12'>Precio Anterior</td>"; tab += "<td class='cell12'>Moneda</td>"; tab += "<td class='cell12'>Precio nuevo</td>"; tab += "<td class='cell12'>Moneda</td>"; tab += "<td class='cell12'>Válido de</td>"; tab += "<td class='cell12'>Válido a</td>"; if (tipo.Substring(1, 1).Equals("L")) { tab += "<td class='cell12'>Comentarios</td>"; } tab += "</tr>"; foreach (SolicitudesL s in ss) { string style = ""; if (s.error) { style = "background-color: red !important;"; } tab += "<tr style='" + style + "'>"; if (s.error) { style = "white-text"; } tab += "<td class='cell16 " + style + "'>" + s.obj + "</td>"; if (!tipo.Substring(1, 1).Equals("P") & !tipo.Substring(1, 1).Equals("L")) { tab += "<td class='cell17 " + style + "'>" + s.desc + "</td>"; } if (tipo.Substring(1, 1).Equals("M")) { tab += "<td class='cell18 " + style + "'>" + s.desc2 + "</td>"; } tab += "<td class='cell18 " + style + "'>" + s.importe + "</td>"; tab += "<td class='cell18 " + style + "'>" + s.moneda + "</td>"; tab += "<td class='cell18 " + style + "'>" + s.importe_n + "</td>"; tab += "<td class='cell18 " + style + "'>" + s.moneda_n + "</td>"; tab += "<td class='cell18 " + style + "'>" + s.fecha_a.ToString("dd/MM/yyyy") + "</td>"; tab += "<td class='cell18 " + style + "'>" + s.fecha_b.ToString("dd/MM/yyyy") + "</td>"; if (tipo.Substring(1, 1).Equals("L")) { tab += "<td class='cell18 " + style + "'>" + s.comentario + "</td>"; } tab += "</tr>"; } tab += "</tbody></table>"; lblTabla.InnerHtml = tab; } } IRfcTable bitacora = con.getBitacora(tipoF, folio); string tabla = ""; tabla = "<table border='0' style='border-width: 0px; border-style: None; width: 100%; border-collapse: collapse;'><tbody>"; tabla += "<tr><td class='cell12'>Empleado</td><td class='cell12'>Evento</td><td class='cell12'>Fecha autorizar</td><td class='cell12'>Fecha Procesada</td><td class='cell12'>Status</td><td class='cell12'>Comentario</td></tr>"; for (int i = 0; i < bitacora.Count; i++) { bitacora.CurrentIndex = i; tabla += "<tr><td class='cell17'>"; tabla += bitacora.GetString("ZUSRA") + " - " + bitacora.GetString("ZDUSA"); tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZDEEV"); tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZFEAL") + "[" + bitacora.GetString("ZHOAL") + "]"; tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZFEUM") + "[" + bitacora.GetString("ZHOUM") + "]"; tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZSWAR"); tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZCOME"); //tabla += "sad ads fas a s fasifu sa disad iasduasdiasud a sdaiud asi duiasdhasoidha soih sad sahdjashdiusahd sa "; tabla += "</td>"; tabla += "</tr>"; } lblBItacora.InnerHtml = tabla; } } else if (oper.Equals("A")) { hidOper.Value = oper; if (con.conectar()) { string links = ""; links += "<a href='Procesa.aspx"; links += "?Tipo=" + tipoF + "&Folio=" + folio + "&Oper=N&Posi=" + posi; links += "'>Cancelar</a> "; lblLinks.InnerHtml = links; if (tipoF.Equals("01")) { IRfcTable header = con.consultaCabecera(folio, ""); //IRfcTable detail = con.consultaDetalle(folio, ""); //List<Solicitudes> ss = new List<Solicitudes>(); if (header.Count > 0) { txtFolio.InnerText = "Ha Seleccionado Autorizar Solicitud " + header.GetString("ID_SOLICITUD"); } } else if (tipoF.Equals("02")) { IRfcTable header = con.consultaCabeceraL(folio, ""); //IRfcTable detail = con.consultaDetalleL(folio, ""); //List<SolicitudesL> ss = new List<SolicitudesL>(); if (header.Count > 0) { txtFolio.InnerText = "Ha Seleccionado Autorizar Solicitud " + header.GetString("ID_SOLICITUD"); } } } } else if (oper.Equals("R")) { hidOper.Value = oper; if (con.conectar()) { string links = ""; links += "<a href='Procesa.aspx"; links += "?Tipo=" + tipoF + "&Folio=" + folio + "&Oper=N&Posi=" + posi; links += "'>Cancelar</a> "; lblLinks.InnerHtml = links; if (tipoF.Equals("01")) { IRfcTable header = con.consultaCabecera(folio, ""); //IRfcTable detail = con.consultaDetalle(folio, ""); //List<Solicitudes> ss = new List<Solicitudes>(); if (header.Count > 0) { txtFolio.InnerText = "Ha Seleccionado Rechazar Solicitud " + header.GetString("ID_SOLICITUD"); } } else if (tipoF.Equals("02")) { IRfcTable header = con.consultaCabeceraL(folio, ""); //IRfcTable detail = con.consultaDetalleL(folio, ""); //List<SolicitudesL> ss = new List<SolicitudesL>(); if (header.Count > 0) { txtFolio.InnerText = "Ha Seleccionado Rechazar Solicitud " + header.GetString("ID_SOLICITUD"); } } } } } }
protected void Page_Load(object sender, EventArgs e) { string folio = Request.QueryString["Folio"]; try { hidUsuario.Value = Session["Usuario"].ToString(); hidNumEmp.Value = Session["NumEmp"].ToString(); Conexion con = new Conexion(); catalogos c = new catalogos(); IRfcTable header = con.consultaCabeceraL(folio, hidNumEmp.Value); IRfcTable detail = con.consultaDetalleL(folio, hidNumEmp.Value); meinss = con.meinss(); List <SolicitudesL> ss = new List <SolicitudesL>(); if (header.Count > 0) { header.CurrentIndex = 0; txtFolio.Value = header.GetString("ID_SOLICITUD"); txtCOMM.InnerText = header.GetString("COMMENTS"); tipo = header.GetString("TIPO"); string vkorg = header.GetString("VKORG"); string vtweg = header.GetString("VTWEG"); string spart = header.GetString("SPART"); string kunnr = header.GetString("KUNNR"); string pltyp = header.GetString("PLTYP"); string matnr = header.GetString("MATNR"); if (!vkorg.Equals("")) { txtVKORG.Value = vkorg + " " + con.ListaVKORG(vkorg, "").GetString("VTEXT"); } if (!vtweg.Equals("")) { txtVTWEG.Value = vtweg + " " + con.ListaVTWEG(vtweg, "", "").GetString("VTEXT"); } txtSPART.Value = spart + " " + con.ListaSPART(spart, "", "", "", "").GetString("VTEXT"); if (!kunnr.Equals("")) { IRfcTable kunn = con.getCliente(vkorg, vtweg, spart, kunnr); if (kunn.Count > 0) { txtKUNNR.Value = kunnr + " " + con.getCliente(vkorg, vtweg, spart, kunnr).GetString("NAME1"); } } if (!pltyp.Equals("")) { txtPLTYP.Value = con.getLP_Desc("", pltyp); } if (!matnr.Equals("")) { txtMATNR.Value = matnr + " " + con.columnaMatnr(matnr, "MAKTG", "X"); } txtPORC.Value = header.GetString("PORCENTAJE") + " %"; string obj = ""; string titulo = ""; if (tipo.Substring(1, 1).Equals("M")) { obj = "MATNR"; titulo = "Material"; } else if (tipo.Substring(1, 1).Equals("G")) { obj = "MATKL"; titulo = "Grupo de artículos"; } else if (tipo.Substring(1, 1).Equals("P")) { obj = "EBELN"; titulo = "Pedido de cliente"; } else if (tipo.Substring(1, 1).Equals("L")) { obj = "CHARG"; titulo = "Lote"; } for (int i = 0; i < detail.Count; i++) { detail.CurrentIndex = i; SolicitudesL s = new SolicitudesL(); s.obj = detail.GetString(obj); //s.desc = detail.GetString("VTWEG"); s.desc2 = detail.GetString("MEINS"); s.importe = detail.GetString("PR_ANT"); s.moneda = detail.GetString("MON_ANT"); s.importe_n = detail.GetString("PR_NVO"); s.moneda_n = detail.GetString("MON_NVO"); s.fecha_a = f.fecha(detail.GetString("FECHA_INI")); s.fecha_b = f.fecha(detail.GetString("FECHA_FIN")); s.comentario = detail.GetString("COMMENTS"); s.escala = detail.GetString("ESCALA"); s.pos = detail.GetString("POS");; //if (tipo.Substring(1, 1).Equals("M")) //{ // s.desc = con.columnaMatnr(s.obj, "MAKTG"); // s.desc2 = con.columnaMatnr(s.obj, "MEINS"); //} //else if (tipo.Substring(1, 1).Equals("G")) //{ // s.desc = con.columnaMatkl(s.obj, "WGBEZ"); //} ss.Add(s); } ss = obtenerDatos(ss, tipo.Substring(1, 1)); string tab = ""; tab = "<table border='0' style='border-width: 0px; border-style: None; width: 100%; border-collapse: collapse;'><tbody>"; tab += "<tr>"; tab += "<td class='tablahead'>" + titulo + "</td>"; if (!tipo.Substring(1, 1).Equals("P") & !tipo.Substring(1, 1).Equals("L")) { tab += "<td class='tablahead'>Denominación</td>"; } //if (tipo.Substring(1, 1).Equals("M")) tab += "<td class='tablahead'>Unidad</td>"; tab += "<td class='tablahead'>Precio Anterior</td>"; tab += "<td class='tablahead'>Moneda</td>"; tab += "<td class='tablahead'>Precio nuevo</td>"; tab += "<td class='tablahead'>Moneda</td>"; tab += "<td class='tablahead'>Válido de</td>"; tab += "<td class='tablahead'>Válido a</td>"; if (tipo.Substring(1, 1).Equals("L")) { tab += "<td class='tablahead'>Comentario</td>"; } tab += "<td class='tablahead'>E</td>"; tab += "</tr>"; foreach (SolicitudesL s in ss) { string style = ""; if (s.error) { style = "background-color: red !important;"; } tab += "<tr style='" + style + "' id='tr-" + s.pos + "' ondblclick='escalas(this.id)'>"; if (s.error) { style = "white-text"; } tab += "<td class='tablaCent " + style + "'>" + s.obj + "</td>"; if (!tipo.Substring(1, 1).Equals("P") & !tipo.Substring(1, 1).Equals("L")) { tab += "<td class='tablaIzq " + style + "'>" + s.desc + "</td>"; } //if (tipo.Substring(1, 1).Equals("M")) tab += "<td class='tablaCent " + style + "' id='MEINS-" + s.pos + "'>" + MeinsEsp(s.desc2) + "</td>"; tab += "<td class='tablaCent " + style + "'>" + s.importe + "</td>"; tab += "<td class='tablaCent " + style + "'>" + s.moneda + "</td>"; tab += "<td class='tablaCent " + style + "'>" + s.importe_n + "</td>"; tab += "<td class='tablaCent " + style + "' id='KONWA-" + s.pos + "'>" + s.moneda_n + "</td>"; tab += "<td class='tablaCent " + style + "'>" + s.fecha_a.ToString("dd/MM/yyyy") + "</td>"; tab += "<td class='tablaCent " + style + "'>" + s.fecha_b.ToString("dd/MM/yyyy") + "</td>"; if (tipo.Substring(1, 1).Equals("L")) { tab += "<td class='tablaCent " + style + "'>" + s.comentario + "</td>"; } if (s.escala.Equals("X")) { tab += "<td><input type='checkbox' checked disabled id='chk-" + s.pos + "'/></td>"; } else { tab += "<td><input type='checkbox' disabled id='chk-" + s.pos + "'/></td>"; } tab += "</tr>"; } tab += "</tbody></table>"; lblTabla.InnerHtml = tab; IRfcTable bitacora = con.getBitacora("02", folio); string tabla = ""; tabla = "<table border='0' style='border-width: 0px; border-style: None; width: 100%; border-collapse: collapse;'><tbody>"; tabla += "<tr><td class='cell12'>Empleado</td><td class='cell12'>Evento</td><td class='cell12'>Fecha autorizar</td><td class='cell12'>Fecha Procesada</td><td class='cell12'>Status</td><td class='cell12'>Comentario</td></tr>"; for (int i = 0; i < bitacora.Count; i++) { bitacora.CurrentIndex = i; tabla += "<tr><td class='cell17'>"; tabla += bitacora.GetString("ZUSRA") + " - " + bitacora.GetString("ZDUSA"); tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZDEEV"); tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZFEAL") + "[" + bitacora.GetString("ZHOAL") + "]"; tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZFEUM") + "[" + bitacora.GetString("ZHOUM") + "]"; tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZSWAR"); tabla += "</td>"; tabla += "<td class='cell18' style='max-width:200px;overflow-y:hidden;'>"; tabla += bitacora.GetString("ZCOME"); //tabla += "sad ads fas a s fasifu sa disad iasduasdiasud a sdaiud asi duiasdhasoidha soih sad sahdjashdiusahd sa "; tabla += "</td>"; tabla += "</tr>"; } lblBItacora.InnerHtml = tabla; } else { Response.Redirect("Default.aspx", false); } } catch (Exception ex) { Response.Redirect("https://www.terzaonline.com/nworkflow/login/"); } }
protected void Page_Load(object sender, EventArgs e) { try { //hidUsuario.Value = Session["Usuario"].ToString(); //hidNumEmp.Value = Session["NumEmp"].ToString(); //string[] a = Request.Form.AllKeys; //Conexion c = new Conexion("E-DESARROLL2", "Initial02"); Conexion con = new Conexion(); catalogos c = new catalogos(); if (con.conectar()) { List <string> mon = con.monedas(); monedas = formaMoneda("MXN", mon); fecha_limite = con.fechaLimite(); if (Request.Form.AllKeys.Length == 0) { IRfcTable lista_vkorg = con.ListaVKORG("", ""); IRfcTable lista_vtweg = con.ListaVTWEG("", "", ""); IRfcTable lista_spart = con.ListaSPART("", "", "", "", ""); //IRfcTable lista_pltyp = con.ListaPLTYP(); txtVKORG.Items.Add(new ListItem("-", "")); for (int i = 0; i < lista_vkorg.Count; i++) { lista_vkorg.CurrentIndex = i; txtVKORG.Items.Add(new ListItem(lista_vkorg.GetString("VKORG") + " " + lista_vkorg.GetString("VTEXT"), lista_vkorg.GetString("VKORG"))); } txtVTWEG.Items.Add(new ListItem("-", "")); for (int i = 0; i < lista_vtweg.Count; i++) { lista_vtweg.CurrentIndex = i; txtVTWEG.Items.Add(new ListItem(lista_vtweg.GetString("VTWEG") + " " + lista_vtweg.GetString("VTEXT"), lista_vtweg.GetString("VTWEG"))); } txtSPART.Items.Add(new ListItem("-", "")); for (int i = 0; i < lista_spart.Count; i++) { lista_spart.CurrentIndex = i; txtSPART.Items.Add(new ListItem(lista_spart.GetString("SPART") + " " + lista_spart.GetString("VTEXT"), lista_spart.GetString("SPART"))); } } if (Request.Form.AllKeys.Length > 0) { string vkorg = Request.Form["txtVKORG"]; string vtweg = Request.Form["txtVTWEG"]; string spart = Request.Form["txtSPART"]; string pernr = Request.Form["txtPERNR"].Split(' ')[0]; string pltyp1 = Request.Form["txtPLTYP1"].Split(' ')[0]; string pltyp2 = Request.Form["txtPLTYP2"].Split(' ')[0]; string fecha_s = Request.Form["txtDATEs"]; if (!fecha_s.Equals("")) { fecha_s = f.fechaToSAP(f.fechaD(Request.Form["txtDATEs"])); } string fecha_a = Request.Form["txtDATEa"]; if (!fecha_a.Equals("")) { fecha_a = f.fechaToSAP(f.fechaD(Request.Form["txtDATEa"])); } string kunnr1 = Request.Form["txtKUNNR1"].Split(' ')[0]; string kunnr2 = Request.Form["txtKUNNR2"].Split(' ')[0]; //txtVKORG.Disabled = true; //txtVTWEG.Disabled = true; //txtSPART.Disabled = true; //txtNAME1.Value = c.getColumnaCliente(vkorg, vtweg, spart, kunnr, "NAME1"); IRfcTable a720 = con.busquedaL(vkorg, vtweg, spart, pernr, pltyp1, pltyp2, fecha_s, fecha_a, kunnr1, kunnr2); string tabla = ""; tabla = "<table id='tblTabla' border='0' style='border-width: 0px; border-style: None; width: 100%; border-collapse: collapse;'><tbody>"; tabla += "<tr><td class='tablahead'>Org. de ventas</td>"; tabla += "<td class='tablahead'>Canal Dist.</td>"; tabla += "<td class='tablahead'>Sector</td>"; tabla += "<td class='tablahead'>Cliente</td>"; tabla += "<td class='tablahead'>Lista de precios</td>"; //tabla += "<td class='tablahead'>Descripción</td>"; tabla += "<td class='tablahead'>Lista Anterior</td>"; //tabla += "<td class='tablahead'>Descripción</td>"; tabla += "<td class='tablahead'>Fecha Solicitud</td>"; tabla += "<td class='tablahead'>Solicitante</td>"; tabla += "<td class='tablahead'>Fecha Cambio</td></tr>"; if (a720.Count > 0) { int pos = 0; for (int i = 0; i < a720.Count; i++) { a720.CurrentIndex = i; pos++; tabla += "<tr><td class='tablaCent'>"; tabla += a720.GetString("VKORG"); tabla += "</td>"; tabla += "<td class='tablaCent'>"; tabla += a720.GetString("VTWEG"); tabla += "</td>"; tabla += "<td class='tablaCent'>"; tabla += a720.GetString("SPART"); tabla += "</td>"; tabla += "<td class='tablaIzq'>"; tabla += a720.GetString("KUNNR") + " " + a720.GetString("NAME1"); tabla += "</td>"; tabla += "<td class='tablaCent'>"; tabla += a720.GetString("LP_NVO") + " "; //tabla += "</td>"; //tabla += "<td class='tablaIzq'>"; tabla += a720.GetString("DESC_NVO"); tabla += "</td>"; tabla += "<td class='tablaCent'>"; tabla += a720.GetString("LP_ANT") + " "; //tabla += "</td>"; //tabla += "<td class='tablaCent'>"; tabla += a720.GetString("DESC_ANT"); tabla += "</td>"; tabla += "<td class='tablaCent'>"; tabla += f.fechaToOUT(f.fecha(a720.GetString("FECHA_H"))); tabla += "</td>"; tabla += "<td class='tablaCent'>"; tabla += a720.GetString("PERNR"); tabla += "</td>"; tabla += "<td class='tablaCent'>"; string d = a720.GetString("FECHA_AUT"); if (!d.Equals("0000-00-00")) { tabla += f.fechaToOUT(f.fecha(d)); } tabla += "</td></tr>"; } } tabla += "</tbody></table>"; lblTabla.InnerHtml = tabla; } } } catch (Exception ex) { //Response.Redirect("../../../Default.aspx"); var page = HttpContext.Current.Handler as Page; if (page != null) { page.ClientScript.RegisterClientScriptBlock(typeof(string), "Redirect", "window.parent.location='https://www.terzaonline.com/nworkflow/login/';", true); } //ClientScriptManager.RegisterClientScriptBlock(this.GetType(), "RedirectScript", "window.parent.location = '../../../Default.aspx'", true); } }
protected void Page_Load(object sender, EventArgs e) { try { hidUsuario.Value = Session["Usuario"].ToString(); hidNumEmp.Value = Session["NumEmp"].ToString(); string folio = Request.QueryString["Folio"]; Conexion con = new Conexion(); catalogos c = new catalogos(); IRfcTable header = con.consultaCabecera(folio, hidNumEmp.Value); IRfcTable detail = con.consultaDetalle(folio, hidNumEmp.Value); List <Solicitudes> ss = new List <Solicitudes>(); if (header.Count > 0) { txtFolio.Value = header.GetString("ID_SOLICITUD"); txtPERNR.InnerText = header.GetString("PERNR") + " " + con.nombrePERNR(header.GetString("PERNR")); txtDATE.InnerText = f.fechaToOUT(f.fecha(header.GetString("FECHA"))); txtCOMM.InnerText = header.GetString("COMMENTS"); for (int i = 0; i < detail.Count; i++) { detail.CurrentIndex = i; Solicitudes s = new Solicitudes(); s.vkorg = detail.GetString("VKORG"); s.vtweg = detail.GetString("VTWEG"); s.spart = detail.GetString("SPART"); s.kunnr = detail.GetString("KUNNR"); s.pltyp = detail.GetString("LP_ANT"); s.pltyp_n = detail.GetString("LP_NVO"); s.date = f.fecha(detail.GetString("FECHA")); if (!s.pltyp.Equals("")) { //s.pltyp_desc = c.getDescLP(s.pltyp); s.pltyp_desc = con.getLP_Desc("", s.pltyp); } else { s.pltyp_desc = "Sin lista de precios"; } if (!s.pltyp_n.Equals("")) { //s.pltyp_n_desc = c.getDescLP(s.pltyp_n); s.pltyp_n_desc = con.getLP_Desc("", s.pltyp_n); } else { s.pltyp_n_desc = "Sin lista de precios"; } s.name1 = c.getColumnaCliente(s.vkorg, s.vtweg, s.spart, s.kunnr, "NAME1"); ss.Add(s); } string tab = ""; tab = "<table border='0' style='border-width: 0px; border-style: None; width: 100%; border-collapse: collapse;'><tbody>"; tab += "<tr><td class='tablahead'>Org. Compras</td><td class='tablahead'>Canal Dist.</td><td class='tablahead'>Sector</td><td class='tablahead'>Cliente</td><td class='tablahead'>Nombre</td><td class='tablahead'>Lista anterior</td><td class='tablahead'>Nueva Lista de precios</td><td class='tablahead'>Vigencia</td></tr>"; foreach (Solicitudes s in ss) { string style = ""; if (s.error) { style = "background-color: red !important;"; } tab += "<tr style='" + style + "'>"; if (s.error) { style = "white-text"; } tab += "<td class='tablaCent " + style + "'>" + s.vkorg + "</td>"; tab += "<td class='tablaCent " + style + "'>" + s.vtweg + "</td>"; tab += "<td class='tablaCent " + style + "'>" + s.spart + "</td>"; tab += "<td class='tablaCent " + style + "'>" + s.kunnr + "</td>"; tab += "<td class='tablaIzq " + style + "'>" + s.name1 + "</td>"; tab += "<td class='tablaCent " + style + "'>" + s.pltyp_desc + "</td>"; tab += "<td class='tablaCent " + style + "'>" + s.pltyp_n_desc + "</td>"; tab += "<td class='tablaCent " + style + "'>" + s.date.ToString("dd/MM/yyyy") + "</td>"; tab += "</tr>"; } tab += "</tbody></table>"; lblTabla.InnerHtml = tab; IRfcTable bitacora = con.getBitacora("01", folio); string tabla = ""; tabla = "<table border='0' style='border-width: 0px; border-style: None; width: 100%; border-collapse: collapse;'><tbody>"; tabla += "<tr><td class='cell12'>Empleado</td><td class='cell12'>Evento</td><td class='cell12'>Fecha autorizar</td><td class='cell12'>Fecha Procesada</td><td class='cell12'>Status</td><td class='cell12'>Comentario</td></tr>"; for (int i = 0; i < bitacora.Count; i++) { bitacora.CurrentIndex = i; tabla += "<tr><td class='cell17'>"; tabla += bitacora.GetString("ZUSRA") + " - " + bitacora.GetString("ZDUSA"); tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZDEEV"); tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZFEAL") + "[" + bitacora.GetString("ZHOAL") + "]"; tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZFEUM") + "[" + bitacora.GetString("ZHOUM") + "]"; tabla += "</td>"; tabla += "<td class='cell18'>"; tabla += bitacora.GetString("ZSWAR"); tabla += "</td>"; tabla += "<td class='cell18' style='max-width:200px;overflow-y:hidden;'>"; tabla += bitacora.GetString("ZCOME"); //tabla += "sad ads fas a s fasifu sa disad iasduasdiasud a sdaiud asi duiasdhasoidha soih sad sahdjashdiusahd sa "; tabla += "</td>"; tabla += "</tr>"; } lblBItacora.InnerHtml = tabla; } else { Response.Redirect("Default.aspx", false); } } catch (Exception ex) { Response.Redirect("https://www.terzaonline.com/nworkflow/login/"); } }