151 lines
7.1 KiB
C#
151 lines
7.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using Extensiones;
|
|
|
|
public partial class Ventas_SolicitudesSAT : ClsPaginas
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
//this.RegistraScript("$('#ModalSolicitarSat').modal();");
|
|
int rtipo = Request["tipo"] == null ? -1 : Request["tipo"].ToString().ToEntero();
|
|
string rfIngInicio = Request["fIngInicio"] == null ? "" : Request["fIngInicio"].ToString().Trim();
|
|
string rfIngFin = Request["fIngFin"] == null ? "" : Request["fIngFin"].ToString().Trim();
|
|
string rfSolInicio = Request["fSolInicio"] == null ? "" : Request["fSolInicio"].ToString().Trim();
|
|
string rfSolFin = Request["fSolFin"] == null ? "" : Request["fSolFin"].ToString().Trim();
|
|
|
|
if (rfIngInicio == "")
|
|
{
|
|
rfIngInicio = string.Format("{0:01/MM/yyyy}",DateTime.Now);
|
|
}
|
|
if (rfIngFin == "")
|
|
{
|
|
rfIngFin = string.Format("{0:dd/MM/yyyy}",string.Format("{0:01/MM/yyyy}", DateTime.Now).ToDateTime().AddMonths(1).AddDays(-1));
|
|
|
|
}
|
|
DateTime dValor = DateTime.Now;
|
|
dValor = DateTime.Now; if (DateTime.TryParse(rfIngInicio, out dValor)) { rfIngInicio = string.Format("{0:dd/MM/yyyy}", dValor); } else { rfIngInicio = ""; }
|
|
dValor = DateTime.Now; if (DateTime.TryParse(rfIngFin, out dValor)) { rfIngFin = string.Format("{0:dd/MM/yyyy}", dValor); } else { rfIngFin = ""; }
|
|
dValor = DateTime.Now; if (DateTime.TryParse(rfSolInicio, out dValor)) { rfSolInicio = string.Format("{0:dd/MM/yyyy}", dValor); } else { rfSolInicio = ""; }
|
|
dValor = DateTime.Now; if (DateTime.TryParse(rfSolFin, out dValor)) { rfSolFin = string.Format("{0:dd/MM/yyyy}", dValor); } else { rfSolFin = ""; }
|
|
|
|
DdlTipo.SelectedValueExist(rtipo);
|
|
txtFechaI.Text = rfIngInicio;
|
|
txtFechaF.Text = rfIngFin;
|
|
txtFechaISol.Text = rfSolInicio;
|
|
txtFechaFSol.Text = rfSolFin;
|
|
cargarDatos();
|
|
}
|
|
}
|
|
|
|
|
|
private void cargarDatos()
|
|
{
|
|
int rtipo = DdlTipo.SelectedValue.ToEntero();
|
|
string rfIngInicio = txtFechaI.Text;
|
|
string rfIngFin = txtFechaF.Text;
|
|
string rfSolInicio = txtFechaISol.Text;
|
|
string rfSolFin = txtFechaFSol.Text;
|
|
using (ClsGenerales objgral = new ClsGenerales())
|
|
{
|
|
objgral.SAT_DescargaSolicitudesGET(UsuarioActual.CveEmpresa, rtipo, rfIngInicio, rfIngFin, rfSolInicio, rfSolFin);
|
|
GVSAT_DescargaSolicitudes.DataSource = objgral.DtResultados;
|
|
GVSAT_DescargaSolicitudes.DataBind();
|
|
}
|
|
upDatosSAT.Update();
|
|
}
|
|
|
|
protected void BtnConsultar_Click(object sender, EventArgs e)
|
|
{
|
|
cargarDatos();
|
|
}
|
|
|
|
protected void LnkVerificarSolicitudes_Click(object sender, EventArgs e)
|
|
{
|
|
string direxe = string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, "Utilerias\\ADSUtilerias.exe");
|
|
|
|
String json = string.Format("{{cveTareaProgramada:{0},cveEmpresa:{1},CveTareaProgramadaHistorial:{2},recursividad:{3},Resultado:{4},parametros:'Tipo=SP'}}", 1, UsuarioActual.CveEmpresa, -1, 0, 1);//Mod.ToLiteral(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(tarea));
|
|
//this.Alert(string.Format("json:{0} : --mod TareaProgramada --Item {1}", DateTime.Now, json));
|
|
try
|
|
{
|
|
string Mensajes = "";
|
|
System.Diagnostics.Process ObjProcess = null;
|
|
{
|
|
ObjProcess = new System.Diagnostics.Process();
|
|
ObjProcess.StartInfo.RedirectStandardOutput = true;
|
|
ObjProcess.StartInfo.FileName = direxe;//System.Configuration.ConfigurationManager.AppSettings["DirUtilerias"].ToString();
|
|
ObjProcess.StartInfo.Arguments = $"--mod TareaProgramada --Item {json} ";
|
|
ObjProcess.StartInfo.UseShellExecute = false;
|
|
ObjProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
|
|
ObjProcess.Start();
|
|
}
|
|
using (System.IO.StreamReader myStreamReader = ObjProcess.StandardOutput)
|
|
{
|
|
Mensajes = myStreamReader.ReadLine();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ex.ToString().GuardaLog();
|
|
}
|
|
cargarDatos();
|
|
Alert("La solicitud ha sido enviada");
|
|
}
|
|
|
|
protected void LnkSolicitarCFDI_Click(object sender, EventArgs e)
|
|
{
|
|
string FechaI = string.Format("{0:yyyy-MM-dd}T00:00:00", txtFechaIAdd.Text.ToDateTime());
|
|
string FechaF = string.Format("{0:yyyy-MM-dd}T23:59:59", txtFechaFAdd.Text.ToDateTime());
|
|
|
|
string direxe = string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, "Utilerias\\ADSUtilerias.exe");
|
|
|
|
String json = string.Format("{{cveTareaProgramada:{0},cveEmpresa:{1},CveTareaProgramadaHistorial:{2},recursividad:{3},Resultado:{4},parametros:'Tipo={5}&fechai={6}&fechaf={7}'}}", 1, UsuarioActual.CveEmpresa, -1, 0, 1, DdlTipoAdd.SelectedValue, FechaI, FechaF);//Mod.ToLiteral(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(tarea));
|
|
//this.Alert(string.Format("json:{0} : --mod TareaProgramada --Item {1}", DateTime.Now, json));
|
|
try
|
|
{
|
|
string Mensajes = "";
|
|
System.Diagnostics.Process ObjProcess = null;
|
|
{
|
|
ObjProcess = new System.Diagnostics.Process();
|
|
ObjProcess.StartInfo.RedirectStandardOutput = true;
|
|
ObjProcess.StartInfo.FileName = direxe;//System.Configuration.ConfigurationManager.AppSettings["DirUtilerias"].ToString();
|
|
ObjProcess.StartInfo.Arguments = $"--mod TareaProgramada --Item {json} ";
|
|
ObjProcess.StartInfo.UseShellExecute = false;
|
|
ObjProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
|
|
ObjProcess.Start();
|
|
}
|
|
using (System.IO.StreamReader myStreamReader = ObjProcess.StandardOutput)
|
|
{
|
|
Mensajes = myStreamReader.ReadLine();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ex.ToString().GuardaLog();
|
|
}
|
|
cargarDatos();
|
|
Alert("La solicitud ha sido enviada");
|
|
}
|
|
|
|
protected void LnknoCFDI_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow gvrow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
int CveSolicitudSat = gvrow.DataKey("CveSolicitudSat").ToEntero();
|
|
using (ClsGenerales objgeneral = new ClsGenerales())
|
|
{
|
|
objgeneral.SAT_DescargaSolicitudeUUIDSGET(CveSolicitudSat);
|
|
GVFoliosSAT.DataSource = objgeneral.DtResultados;
|
|
}
|
|
GVFoliosSAT.DataBind();
|
|
RegistraScript("$('#ModalFoliosSolicitud').modal();");
|
|
UpFoliosSAT.Update();
|
|
}
|
|
} |