From 5d01d5bea37f3a029500be53298c44e25de69506 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 17 Jun 2020 08:47:15 -0700 Subject: [PATCH 1/3] cuando se registra una NC de dev, y se registra el movimiento de almacen, en el mismo registro, no genera el mov del concepto 68 de prepolizas, referenciado al movimeinto --- Compras/Compras.aspx.vb | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 3eb5a8958..3a56568cf 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4402,6 +4402,8 @@ Partial Class Compras_Compras Dim IVA As Decimal = 1.16D Dim ListaMovimientosAlmacen As New List(Of Integer) + Dim Devolucion As MMensajeDevolucion = Nothing + Dim ErrorCreditoCapitalIntres As Boolean = False Dim ErrorCredito As Boolean = False @@ -4572,7 +4574,9 @@ Partial Class Compras_Compras ViewState("CveCompra") = ObjCompras.CveCompra If ObjCompras.DtResultados.Rows.Count > 0 Then ViewState("CompraFolio") = ObjCompras.DtResultados.Rows(0)("vFolio").ToString If DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") Then - ErrorMovDev = guardardevolucion(ObjInventario, ObjCompras.CveCompra, TxtSubTotal.Text.ToDouble, TxtFecha.Text.Trim.ToDate) + Devolucion = guardardevolucion(ObjInventario, ObjCompras.CveCompra, TxtSubTotal.Text.ToDouble, TxtFecha.Text.Trim.ToDate) + + TieneError = Devolucion.TieneError End If Dim ErrorDetalles As Boolean = False ' Dim IDPoliza As Integer @@ -6649,6 +6653,13 @@ Partial Class Compras_Compras importeMN = importeMovimiento * tipoCambioActual * Multiplicador Dim ConceptoContabilizacionNC = 225 + Dim CveMovimientoDevolucion As Integer = -1 + + 'CUANDO NO SE RECIBE LA MERCANCIA EN COMPRAS, SE REGISTRA EL 225, SI SE ESTA REGISTRANDO LA DEVOLUCION EN ALMACEN, SE REGISTRA EL 68 + If Devolucion IsNot Nothing AndAlso Devolucion.DebeRealizarDevolucion AndAlso Devolucion.CveMovimiento > 0 Then + ConceptoContabilizacionNC = 68 + CveMovimientoDevolucion = Devolucion.CveMovimiento + End If If ObjConta.GetRetCuenta(ConceptoContabilizacionNC, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then @@ -6666,7 +6677,7 @@ Partial Class Compras_Compras idCuentaContabilizacion = 0 End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContabilizacionNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContabilizacionNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True End If @@ -13925,13 +13936,15 @@ Partial Class Compras_Compras '*se envia true si hubo un error*' - Private Function guardardevolucion(ObjInventario As ClsInventarios, CveCompra As Integer, subtotal As Double, Fecha As Date) As Boolean + Private Function guardardevolucion(ObjInventario As ClsInventarios, CveCompra As Integer, subtotal As Double, Fecha As Date) As MMensajeDevolucion Dim ErrorMovInv As Boolean = False Dim CveAlmacen As Integer = DdlAlmacenDevolucion.SelectedValue.ToEntero() Dim subtotaldevolucion As Double = 0 Dim realizadevolucion As Boolean = False + Dim CveMovimientoEntrada As Integer = -1 'Calculo los subtotales para comparar con la NC Dim cantidad As Double = 0.0 + For Each Dr As GridViewRow In GVDevolucion.Rows 'CveAlmacen = Dr.DataKey("CveAlmacen").ToString.ToEntero cantidad = Dr.FCTextBox("TxtCantidad").Text.ToDouble @@ -13946,7 +13959,7 @@ Partial Class Compras_Compras 'si el subtotal es iwal a la nc lo guardo si no marco error If subtotal > subtotaldevolucion - 1 AndAlso subtotal < subtotaldevolucion + 1 Then - Dim CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacen, 13, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, Modulo:="Comp/G") + CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacen, 13, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, Modulo:="Comp/G") If CveMovimientoEntrada <= 0 Then ErrorMovInv = True Else @@ -13964,9 +13977,14 @@ Partial Class Compras_Compras Alert("El Total de la NC debe ser igual al total de la devolucion", TipoMensaje.MsgAdvertencia) End If End If - Return ErrorMovInv - End Function + Return New MMensajeDevolucion() With + { + .CveMovimiento = CveMovimientoEntrada, + .DebeRealizarDevolucion = realizadevolucion, + .TieneError = ErrorMovInv + } + End Function Private Sub cargaddldevoluciones(CveProveedor As Integer, SubTotal As Double) Dim objcompras As New ClsCompras() @@ -19887,4 +19905,10 @@ Partial Class Compras_Compras End If End Sub +End Class + +Public Class MMensajeDevolucion + Public Property CveMovimiento As Integer + Public Property TieneError As Boolean + Public Property DebeRealizarDevolucion As Boolean End Class \ No newline at end of file From 03f0726425ca35d086d24e3acc3fdc90e9365f87 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Wed, 17 Jun 2020 21:17:47 -0700 Subject: [PATCH 2/3] tarea web terminada, falta cargar la imagen de la entrega --- TareasProgramadas/Tareas72.ashx | 134 ++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 TareasProgramadas/Tareas72.ashx diff --git a/TareasProgramadas/Tareas72.ashx b/TareasProgramadas/Tareas72.ashx new file mode 100644 index 000000000..1edc5d88a --- /dev/null +++ b/TareasProgramadas/Tareas72.ashx @@ -0,0 +1,134 @@ +<%@ WebHandler Language="C#" Class="Tareas72" %> + +using System; +using System.Web; +using System.Data; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Extensiones; +using System.IO; +using Microsoft.Reporting.WebForms; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading.Tasks; +using System.Text; +public class Tareas72 : IHttpHandler +{ + + public void ProcessRequest(HttpContext context) + { + context.Response.ContentType = "text/plain"; + context.Response.Write("Hello World"); + + bool retorno = false; + string Metodo = context.Request["Metodo"] == null ? "" : context.Request["Metodo"]; + switch (Metodo) + { + case "ActualizarProcesoPaqueterias": + retorno = ActualizarProcesoPaqueterias(); + break; + } + + context.Response.Write(retorno); + context.Response.End(); + } + + private bool ActualizarProcesoPaqueterias() + { + bool retorno = true; + ClsGenerales ObjGenerales = new ClsGenerales(); + ClsClientes ObjClientes = new ClsClientes(); + ClsVentas ObjVentas = new ClsVentas(); + ClsVtaVendedores ObjVendedores = new ClsVtaVendedores(); + ClsSisMail Correo = new ClsSisMail(); + + ClsSisEmpresas ObjEmpresa = new ClsSisEmpresas(); + Empresa Empresa = new Empresa(); + if (ObjEmpresa.GetEmpresas(72, "-1", "-1", "-1", "-1")) + { + Empresa = ObjEmpresa.Empresa; + } + try + { + if (ObjGenerales.GetPaqueteriasGuias(-1, -1, 7, 1, -1, 72, "-1", "01/01/1990", "01/01/2100")) + { + DataRowCollection GuiasPendientes = ObjGenerales.DtResultados.Rows; + foreach (DataRow Guia in GuiasPendientes) + { + int CvePaqueteriaGuia = Guia["CvePaqueteriaGuia"].ToString().ToEntero(); + string GuiaConsultar = Guia["Guia"].ToString(); + + //CONSULTAMOS CADA GUIA EN LA SIGUIENTE API + string uriConsultaGuia = string.Format("https://cc.paquetexpress.com.mx/ptxws/rest/api/v2/guia/historico/ultimoevento/{0}/@1@2@3@4@5", GuiaConsultar); + HttpClient Client = new HttpClient(); + HttpResponseMessage ResponseMessage = Client.GetAsync(uriConsultaGuia).Result; + string JsonString = ResponseMessage.Content.ReadAsStringAsync().Result; + string JsonStringFormat = JsonString.Replace("Resultado(", "{\"Resultado\":").Replace(")", "}"); + DataSet dataSet = JsonConvert.DeserializeObject(JsonStringFormat); + DataTable dataTable = dataSet.Tables["Resultado"]; + if (dataTable.Rows[0]["eventoId"].ToString() == "Hdc") + { + int EstatusEntregado = 3; + + //MANDAMOS A ACTUALIZAR CON ESTATUS DE ENTREGADO + if (ObjGenerales.UpdatePaqueteriasGuias(CvePaqueteriaGuia, -1, -1, -1, EstatusEntregado, "-1", "", "", -1, -1, "-1", "-1", "")) + { + #region 'MANDAR CORREOS' + int CveCliente = Guia["CveCliente"].ToString().ToEntero(); + int CveVenta = Guia["CveAgrupador"].ToString().ToEntero(); + StringBuilder correos = new StringBuilder(""); + + if (ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1)) + { + if (ObjClientes.DtResultados.Rows.Count > 0) + { + DataRow DatosCliente = ObjClientes.DtResultados.Rows[0]; + if (DatosCliente["CorreoEntregaCompras"].ToString().Length > 0) correos.Append(string.Format("{0};", DatosCliente["CorreoEntregaCompras"].ToString())); + if (DatosCliente["CorreoEntregaAlmacen"].ToString().Length > 0) correos.Append(string.Format("{0};", DatosCliente["CorreoEntregaAlmacen"].ToString())); + } + } + + if (ObjVentas.GetVenta(CveVenta, 72)) + { + if (ObjVentas.DtResultados.Rows.Count > 0) + { + int CveVendedor = ObjVentas.DtResultados.Rows[0]["CveVendedor"].ToEntero(); + if (ObjVendedores.GetVendedores(72)) + { + DataRow DatosVendedor = ObjVendedores.DtResultados.FiltroPrimero(string.Format("CveVendedor = {0}", CveVendedor)); + if (DatosVendedor["Correo"].ToString().Length > 0) correos.Append(string.Format("{0};", DatosVendedor["Correo"].ToString())); + if (DatosVendedor["CorreoAdicionalNotificaciones"].ToString().Length > 0) correos.Append(string.Format("{0};", DatosVendedor["CorreoAdicionalNotificaciones"].ToString())); + } + } + } + string CorreosString = correos.ToString(); + if (CorreosString.Length > 0) + { + Correo.SendMail(Empresa, correos.ToString(), "Actualización de paqueterias entregadas", ""); + } + #endregion + } + } + } + } + } + catch (Exception e) + { + ModExtensiones.GuardaLogAD(string.Format("{3} CveEmpresa={0} cveTareaProgramada={1} CveTareaProgramadaHistorial={2}", 72, "", "", e.Message), "Tareas Programadas"); + retorno = false; + } + + ObjGenerales.Dispose(); + ObjClientes.Dispose(); + ObjVentas.Dispose(); + ObjVendedores.Dispose(); + ObjEmpresa.Dispose(); + return false; + } + + public bool IsReusable + { + get { return false; } + } + +} \ No newline at end of file From 1c5f96ab4a7e5a071fec07220a746741d639bc9a Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Thu, 18 Jun 2020 11:10:38 -0700 Subject: [PATCH 3/3] campos fijos en los reportes --- AC/Reportes/RepEstadoActividades.rdlc | 13 ++++++++++++- AC/Reportes/RepSituacionFinanciera.rdlc | 13 ++++++++++++- App_Code/ClsPaginas.vb | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/AC/Reportes/RepEstadoActividades.rdlc b/AC/Reportes/RepEstadoActividades.rdlc index 931f42736..de0652b3b 100644 --- a/AC/Reportes/RepEstadoActividades.rdlc +++ b/AC/Reportes/RepEstadoActividades.rdlc @@ -1008,7 +1008,18 @@ - =Parameters!pFirma1.Value + C.P Vera Guadalupe Tarazon Moreno + + + + + + Director Administrativo + + + + + Director Administrativo