From 94a84f05a83a90119c6deba1f7bee55ca2181185 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Thu, 21 May 2020 14:54:48 -0700 Subject: [PATCH 1/7] reporte de sugerencias y mensaje agregado a clsContabilidad --- App_Code/ClsContabilidad.vb | 8 +++++++- Inventarios/EntregaAlmacen.aspx | 6 ++++++ Inventarios/EntregaAlmacen.aspx.vb | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 7f1096c37..a56a6f108 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -1120,7 +1120,13 @@ Public Class ClsContabilidad If Empresa.TipoContabilizacion = 1 Then ' contabilidad en SIG - ContabilizaDesContabilizaPrePoliza(CvePrePoliza, True, Empresa.CveEmpresa) + + Retorno = ContabilizaDesContabilizaPrePoliza(CvePrePoliza, True, Empresa.CveEmpresa) + + If Retorno Then + Mensaje.Append(String.Format("{1}
", CvePrePoliza, _ContaFolio)) + End If + Else If CvePrePoliza <= 0 Then Return False diff --git a/Inventarios/EntregaAlmacen.aspx b/Inventarios/EntregaAlmacen.aspx index e38673a70..d81474caf 100644 --- a/Inventarios/EntregaAlmacen.aspx +++ b/Inventarios/EntregaAlmacen.aspx @@ -770,6 +770,9 @@ + + + diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index c092d7182..6a429e8f0 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -7,6 +7,8 @@ Imports System.Linq Imports CrystalDecisions.[Shared].Json Imports Extensiones +Imports Microsoft.Reporting.WebForms + Partial Class Inventarios_EntregaAlmacen Inherits ClsPaginas @@ -3064,6 +3066,23 @@ Partial Class Inventarios_EntregaAlmacen End If End Sub + Protected Sub BtnImprimirSugerencias_Click(sender As Object, e As EventArgs) + Dim LogoRutaFisica As String = String.Format("Empresas\{0}\Logo.png", UsuarioActual.CveEmpresa) + Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica)) + Dim Imagen As New System.IO.FileInfo(String.Format("{0}Logo.png", UsuarioActual.Empresa.Ruta)) + + Dim params As New List(Of ReportParameter) + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) + + ImprimirPDF("Empresas/Grales/Formatos/RepEntregaAlmacenSugerencia.rdlc", DtDatosSugerencias, params, "Equipo GPS") + End Sub + #End Region From fd49875cb7517eab5062eb27292f4595f1ad8556 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Fri, 22 May 2020 10:01:24 -0700 Subject: [PATCH 2/7] se agregaron los campos de correo de entrega --- App_Code/ClsClientes.vb | 11 +++++++++-- Ventas/Clientes.aspx | 11 +++++++++++ Ventas/Clientes.aspx.vb | 6 ++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 5ec8dc12c..0904a892b 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -569,7 +569,8 @@ Public Class ClsClientes Optional ObservacionRevsion As String = "-1", Optional ReferenciaFiscal As String = "-1", Optional Celular As String = "-1", Optional ExtOtros As String = "-1", Optional CveUsoCFDI As Integer = -1, Optional CveFormaPago33 As Integer = -1, Optional CveMetodoPago33 As Integer = -1, Optional DesglosaIEPS As Boolean = True, Optional AplicaComercioExterior As Boolean = False, Optional CveTipoOperacion As Integer = -1, Optional CvePedimento As Integer = -1, Optional CveIncoterm As Integer = -1, Optional CvePais As Integer = -1, Optional CveEstado As Integer = -1, Optional CveMunicipio As Integer = -1, Optional CveColonia As Integer = -1, Optional CveMotivoTraslado As Integer = 0, Optional NumRegIdTrib As String = "", Optional ComExtEstado As String = "-1", Optional ComExtMunicipio As String = "-1", Optional ComExtColonia As String = "-1", Optional RequiereOC As Boolean = False, - Optional LT As String = "0", Optional LG As String = "0", Optional EsDistribuidor As Boolean = False, Optional TipoCliente As Integer = 1, Optional CargoUsado As Boolean = False, Optional BonificacionUsado As Boolean = False, Optional CveTipoRetencion As Integer = 0) As Boolean + Optional LT As String = "0", Optional LG As String = "0", Optional EsDistribuidor As Boolean = False, Optional TipoCliente As Integer = 1, Optional CargoUsado As Boolean = False, Optional BonificacionUsado As Boolean = False, Optional CveTipoRetencion As Integer = 0, + Optional CorreoEntregaCompras As String = "-1", Optional CorreoEntregaAlmacen As String = "-1") As Boolean Dim Retorno As Boolean = False @@ -706,6 +707,9 @@ Public Class ClsClientes .Add("@CveTipoRetencion", SqlDbType.TinyInt).Value = CveTipoRetencion .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue + + .Add("@CorreoEntregaCompras", SqlDbType.VarChar).Value = CorreoEntregaCompras + .Add("@CorreoEntregaAlmacen", SqlDbType.VarChar).Value = CorreoEntregaAlmacen End With Try SqlAdapter.Fill(Data) @@ -749,7 +753,7 @@ Public Class ClsClientes Optional AplicaComercioExterior As Boolean = False, Optional CveTipoOperacion As Integer = -1, Optional CvePedimento As Integer = -1, Optional CveIncoterm As Integer = -1, Optional CvePais As Integer = -1, Optional CveEstado As Integer = -1, Optional CveMunicipio As Integer = -1, Optional CveColonia As Integer = -1, Optional CveMotivoTraslado As Integer = 0, Optional NumRegIdTrib As String = "-1", Optional ComExtEstado As String = "-1", Optional ComExtMunicipio As String = "-1", Optional ComExtColonia As String = "-1", Optional ApellidoPaternoPF As String = "-1", Optional ApellidoMaternoPF As String = "-1", Optional NombresPF As String = "-1", Optional RequiereOC As Boolean = False, - Optional LT As String = "0", Optional LG As String = "0", Optional EsDistribuidor As Boolean = False, Optional TipoCliente As Integer = 1, Optional CargoUsado As Boolean = False, Optional BonificacionUsado As Boolean = False, Optional CveTipoRetencion As Integer = 0) As Boolean + Optional LT As String = "0", Optional LG As String = "0", Optional EsDistribuidor As Boolean = False, Optional TipoCliente As Integer = 1, Optional CargoUsado As Boolean = False, Optional BonificacionUsado As Boolean = False, Optional CveTipoRetencion As Integer = 0, Optional CorreoEntregaCompras As String = "-1", Optional CorreoEntregaAlmacen As String = "-1") As Boolean Dim Retorno As Boolean = False @@ -900,6 +904,9 @@ Public Class ClsClientes .Add("@CargoUsado", SqlDbType.Bit).Value = CargoUsado .Add("@BonificacionUsado", SqlDbType.Bit).Value = BonificacionUsado .Add("@CveTipoRetencion", SqlDbType.TinyInt).Value = CveTipoRetencion + + .Add("@CorreoEntregaCompras", SqlDbType.VarChar).Value = CorreoEntregaCompras + .Add("@CorreoEntregaAlmacen", SqlDbType.VarChar).Value = CorreoEntregaAlmacen End With Try SqlAdapter.Fill(Data) diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index e9fc7d01e..1d03cdfbd 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -604,6 +604,17 @@ + +
+ + +
+ +
+ + +
+
diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 971422716..1e4424463 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -1666,6 +1666,8 @@ Partial Class Clientes DivProtletRegistrar.Visible = True End If + TxtCorreoEntregaCompras.Text = ObjClientes.DtResultados(0)("CorreoEntregaCompras").ToString + TxtCorreoEntregaAlmacen.Text = ObjClientes.DtResultados(0)("CorreoEntregaCompras").ToString Else Existe = False Alert("El Cliente Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) @@ -2441,7 +2443,7 @@ Partial Class Clientes CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero, DesglosaIEPS:=ChkDesglosarIEPS.Checked, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, CveTipoOperacion:=DdlTipoOperacion.SelectedValue.ToEntero, CvePedimento:=DdlClavePedimento.SelectedValue.ToEntero, CveIncoterm:=DdlIncoterm.SelectedValue.ToEntero, CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, CveMotivoTraslado:=IIf(DdlMotivoTraslado.SelectedValue = "-1", "0", DdlMotivoTraslado.SelectedValue).ToString().ToEntero, NumRegIdTrib:=IIf(TxtNumRegIdTrib.Text = "", "-1", TxtNumRegIdTrib.Text).ToString(), ComExtEstado:=IIf(TxtComExtEstado.Text = "", "-1", TxtComExtEstado.Text).ToString(), ComExtMunicipio:=IIf(TxtComExtMunicipio.Text = "", "-1", TxtComExtMunicipio.Text).ToString(), ComExtColonia:=IIf(TxtComExtColonia.Text = "", "-1", TxtComExtColonia.Text).ToString(), RequiereOC:=ChkRequiereOC.Checked, LT:=LT, LG:=LG, EsDistribuidor:=ChkEsDistribuidor.Checked, - TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CargoUsado:=ChkCargoUsado.Checked, BonificacionUsado:=ChkBonificacionUsado.Checked, CveTipoRetencion:=DdlTipoRetencion.SelectedValue.ToEntero()) Then + TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CargoUsado:=ChkCargoUsado.Checked, BonificacionUsado:=ChkBonificacionUsado.Checked, CveTipoRetencion:=DdlTipoRetencion.SelectedValue.ToEntero(), CorreoEntregaCompras:=TxtCorreoEntregaCompras.Text, CorreoEntregaAlmacen:=TxtCorreoEntregaAlmacen.Text) Then ViewState("CveCliente") = ObjClientes.CveCliente @@ -2536,7 +2538,7 @@ Partial Class Clientes CveMotivoTraslado:=IIf(DdlMotivoTraslado.SelectedValue = "-1", "0", DdlMotivoTraslado.SelectedValue).ToString().ToEntero, NumRegIdTrib:=IIf(TxtNumRegIdTrib.Text = "", "-1", TxtNumRegIdTrib.Text).ToString(), ComExtEstado:=IIf(TxtComExtEstado.Text = "", "-1", TxtComExtEstado.Text).ToString(), ComExtMunicipio:=IIf(TxtComExtMunicipio.Text = "", "-1", TxtComExtMunicipio.Text).ToString(), ComExtColonia:=IIf(TxtComExtColonia.Text = "", "-1", TxtComExtColonia.Text).ToString(), ApellidoPaternoPF:=IIf(TxtApellidoPaterno.Text = "", "-1", TxtApellidoPaterno.Text).ToString(), ApellidoMaternoPF:=IIf(TxtApellidoMaterno.Text = "", "-1", TxtApellidoMaterno.Text).ToString(), NombresPF:=IIf(TxtNombres.Text = "", "-1", TxtNombres.Text).ToString(), - RequiereOC:=ChkRequiereOC.Checked, LT:=LT, LG:=LG, EsDistribuidor:=ChkEsDistribuidor.Checked, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CargoUsado:=ChkCargoUsado.Checked, BonificacionUsado:=ChkBonificacionUsado.Checked, CveTipoRetencion:=DdlTipoRetencion.SelectedValue.ToEntero()) Then + RequiereOC:=ChkRequiereOC.Checked, LT:=LT, LG:=LG, EsDistribuidor:=ChkEsDistribuidor.Checked, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CargoUsado:=ChkCargoUsado.Checked, BonificacionUsado:=ChkBonificacionUsado.Checked, CveTipoRetencion:=DdlTipoRetencion.SelectedValue.ToEntero(), CorreoEntregaCompras:=TxtCorreoEntregaCompras.Text, CorreoEntregaAlmacen:=TxtCorreoEntregaAlmacen.Text) Then ObjClientes.LimpiaImpuestosLocales(CveCliente) From 253e5ef3034694e156c591cc02d70784f15641a0 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 22 May 2020 18:46:58 -0700 Subject: [PATCH 3/7] Validacion de pagos,mensajes del sat --- Ventas/Ventas.aspx | 4 +- Ventas/Ventas.aspx.vb | 103 +++++++++++++++++++++++++++++++++--------- 2 files changed, 84 insertions(+), 23 deletions(-) diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index d410596a0..93eab57e7 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -6326,12 +6326,12 @@
- +
- +
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index d1d61a0b7..b775018f3 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -10,6 +10,7 @@ Imports System.Security.Cryptography.X509Certificates Imports System.Globalization Imports System.Net.Http Imports Newtonsoft.Json.Linq +Imports System.Diagnostics Partial Class Ventas Inherits ClsPaginas @@ -7011,11 +7012,18 @@ Partial Class Ventas 'End If 'Esquema viejo, evitamos que aparezca por surtir If ErrorList.Count = 0 Then + 'MARCAR VENTA ANTERIOR + If Not ObjInventario.ActualizarEsDevolucionVenta(CveDevolucion, 2) Then + ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura") + End If + + 'MARCAR VENTA ANTERIOR If VentaSaldoAlmacenNC <> 0 OrElse DevolucionAlmacenNC = 2 Then If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura") End If End If + End If End If End If @@ -10152,10 +10160,10 @@ Partial Class Ventas Exit For Else ViewState("SeGuardoPrePoliza") = True - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then - ErrorPrepoliza = True - Exit For - End If + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then + ErrorPrepoliza = True + Exit For + End If 'se hace acreditamiento de impuestos 'IVA X TRASLADAR Dim EsAnticipoEspecial As Boolean = False @@ -10208,10 +10216,10 @@ Partial Class Ventas End If - End If - End If + End If + End If Next End If @@ -13289,7 +13297,7 @@ Partial Class Ventas End If Else - Alert("Se presento un error al cancelar el complemento.") + Alert("Los servicios de cancelación del SAT no se encuentran disponibles o presentan time out. Intente de nuevo en unos minutos.
Origen del error: WebService www.sat.gob.mx", TipoMensaje.MsgError) End If ObjBanco.Dispose() @@ -16154,6 +16162,8 @@ Partial Class Ventas End If MovDetalle.Dispose() + + OcurrioError = Not GeneroMovimientoAlmacen End If End If @@ -16167,7 +16177,7 @@ Partial Class Ventas End If Next - OcurrioError = Not GeneroMovimientoAlmacen + End If End If @@ -16321,7 +16331,7 @@ Partial Class Ventas CveMovimientoDetalleEntrada = MovDet("CveMovimientoDetalle").ToString().ToEntero() End If - If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, CveSeccionAlmacen:=CVeSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then + If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then ContadorMovtosDetalles += 1 Else OcurrioError = True @@ -17022,7 +17032,21 @@ Partial Class Ventas Dim TotalT As Decimal = TxtTotal.Text.ToDecimal Dim RFCReceptor As String = LblRFC.Text.Trim + + Dim SWatch As New Stopwatch + SWatch.Start() + Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True) + + SWatch.Stop() + + Dim SegundosRespuesta As Double = SWatch.ElapsedMilliseconds / 1000 + SegundosRespuesta = SegundosRespuesta.ToEntero + + If SegundosRespuesta >= 5 Then + Alert($"Los servicios de validacion del SAT presentan lentitud en la respuesta [{ SegundosRespuesta } s].", TipoMensaje.ToastError, "") + End If + If Vigencia IsNot Nothing Then If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then @@ -17990,17 +18014,30 @@ Partial Class Ventas Private Function ValidaPagosContado() As Boolean Dim Retorno = False + Dim AmortizacionNC As Decimal = 0 + + 'SI ES AMORTIZACION POR NOTA DE CREDITO DEBE SUMAR LA TOTALIDAD PARA COMPARAR EL PAGO + If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then + For Each gvr As GridViewRow In GVAnticipos.Rows + If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then + AmortizacionNC += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal + End If + Next + End If + + Dim TienePagos As Boolean = ((Not (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0)) AndAlso (DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0)) OrElse AmortizacionNC > 0 + 'SI LA VENTA ES NUEVA VALIDAR TAMBIEN LOS PAGOS DE CONTADO If UsuarioActual.CveEmpresa = 141 AndAlso CveVenta <= 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then - If Not PermiteCredito AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) AndAlso TxtTotal.Text.ToDecimal > 0 Then + If Not PermiteCredito AndAlso Not TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia) Retorno = True Return Retorno End If - If Not PermiteCredito AndAlso (DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0) AndAlso TxtTotal.Text.ToDecimal > 0 Then - Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + If Not PermiteCredito AndAlso TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then + Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + AmortizacionNC If TotalPago < TxtTotal.Text.ToDecimal Then Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia) @@ -18013,15 +18050,15 @@ Partial Class Ventas 'SI TIENE SALDO PENDIENTE VALIDA SI TIENE PAGOS If Me.SaldoVenta > 0 Then - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso (UsuarioActual.Empresa.Funcionalidad(531) = "1") AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) And TxtTotal.Text.ToDecimal > 0 Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso (UsuarioActual.Empresa.Funcionalidad(531) = "1") AndAlso (Not PermiteCredito) AndAlso Not TienePagos And TxtTotal.Text.ToDecimal > 0 Then Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia) Retorno = True End If If UsuarioActual.CveEmpresa = 141 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then - If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 AndAlso TxtTotal.Text.ToDecimal > 0 Then - Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + If Not PermiteCredito AndAlso TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then + Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + AmortizacionNC If TotalPago < TxtTotal.Text.ToDecimal Then Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia) @@ -18035,18 +18072,18 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, LblTotalNC.Text.Trim().ToDecimal(), 0) If TotalNC > 0 Then - If (DtPagos.SUM("Importe").ToString().ToDecimal + Total - TxtCambio.Text.ToDecimal) > TotalNC Then + If (DtPagos.SUM("Importe").ToString().ToDecimal() + AmortizacionNC + Total - TxtCambio.Text.ToDecimal) > TotalNC Then Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) Retorno = True End If Else - If (DtPagos.SUM("Importe").ToString().ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then + If (DtPagos.SUM("Importe").ToString().ToDecimal() + AmortizacionNC + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) Retorno = True End If End If Else - If (DtPagos.SUM("Importe").ToString().ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then + If (DtPagos.SUM("Importe").ToString().ToDecimal() + AmortizacionNC + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) Retorno = True End If @@ -19165,6 +19202,7 @@ Partial Class Ventas End If End If + ObjVentas.Dispose() End Sub Private Sub MostrarCondicionesCancelacion() @@ -19199,7 +19237,19 @@ Partial Class Ventas Dim TotalT As Decimal = TxtTotal.Text.ToDecimal Dim RFCReceptor As String = LblRFC.Text.Trim + Dim SWatch As New Stopwatch + SWatch.Start() Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True) + + SWatch.Stop() + + Dim SegundosRespuesta As Double = SWatch.ElapsedMilliseconds / 1000 + SegundosRespuesta = SegundosRespuesta.ToEntero + + If SegundosRespuesta >= 5 Then + Alert($"Los servicios de validacion del SAT presentan lentitud en la respuesta [{ SegundosRespuesta } s].", TipoMensaje.ToastAdventencia, "") + End If + If Vigencia IsNot Nothing Then If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then Alert("Esta factura no es cancelable.", TipoMensaje.MsgAdvertencia) @@ -19259,7 +19309,7 @@ Partial Class Ventas CancelacionAcuse = ObjCancelacion.CancelacionAcuse CveEstatus = 5 Else - Alert("La factura no se pudo cancelar ante el SAT", TipoMensaje.MsgError) + Alert("Los servicios de cancelación del SAT no se encuentran disponibles o presentan time out. Intente de nuevo en unos minutos.
Origen del error: WebService www.sat.gob.mx", TipoMensaje.MsgError) Exit Sub End If Else @@ -19379,6 +19429,8 @@ Partial Class Ventas Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing If ObjFacturaCancelacion IsNot Nothing AndAlso ObjFacturaCancelacion.CveVenta > 0 Then + Dim SWatch As New Stopwatch + SWatch.Start() If EsRefacturacion Then resp = ObjFacturaCancelacion.CancelarPorRefacturacion() @@ -19397,16 +19449,25 @@ Partial Class Ventas resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar) End If + SWatch.Stop() + + Dim SegundosRespuesta As Double = SWatch.ElapsedMilliseconds / 1000 + SegundosRespuesta = SegundosRespuesta.ToEntero + + If SegundosRespuesta >= 5 Then + Alert($"Los servicios de cancelación del SAT presentan lentitud en la respuesta [{ SegundosRespuesta } s].", TipoMensaje.ToastAdventencia, "") + End If + If resp.CveEstatus = 5 AndAlso Not EsRefacturacion Then Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnEnviarMailCancelacion();", TextoConfirmacion:="    Si    ", TextoCancelacion:="    No    ") Else If EsRefacturacion Then If resp.CveEstatus = 20 Then ObjFacturaCancelacion.Dispose() - Response.Redirect($"/Ventas/RepCancelacionesPorRespuesta.aspx?CveVenta={CveVenta}") + Server.Transfer($"/Ventas/RepCancelacionesPorRespuesta.aspx?CveVenta={CveVenta}") ElseIf resp.CveEstatus.Contiene(4, 5) Then ObjFacturaCancelacion.Dispose() - Response.Redirect($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1") + Server.Transfer($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1") Else Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();") End If From 85ae56a9abaa3d08909fd647cb9dcb1f4d135b38 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 22 May 2020 18:48:08 -0700 Subject: [PATCH 4/7] Acuse de cancelacion del sat, en cancelaciones por respuesta --- App_Code/Modelos.vb | 49 ++- Ventas/RepCancelacionesPorRespuesta.aspx | 289 +++++++------- Ventas/RepCancelacionesPorRespuesta.aspx.cs | 402 ++++++++++---------- 3 files changed, 382 insertions(+), 358 deletions(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index d19de8eef..eb2eea490 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -4217,16 +4217,14 @@ Namespace Modelos 'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN If RequiereAceptacion Then CancelacionFecha = Now.Date - CancelacionAcuse = "" CveEstatus = 20 - Else CancelacionFecha = ObjCancelacion.CancelacionFecha - CancelacionAcuse = ObjCancelacion.CancelacionAcuse CveEstatus = 5 End If + CancelacionAcuse = ObjCancelacion.CancelacionAcuse Else - Retorno.Mensaje = "La factura no se pudo cancelar ante el SAT." + Retorno.Mensaje = "Los servicios de cancelación del SAT no se encuentran disponibles o presentan time out. Intente de nuevo en unos minutos.
Origen del error: WebService www.sat.gob.mx" Retorno.TipoMensaje = TipoMensaje.MsgError Return Retorno @@ -4568,22 +4566,21 @@ Namespace Modelos 'SI EXISTEN HAY EXISTENCIA EN (ENTREGA POR ADELANTADO) SE TIENE QUE REGRESAR AL ALMACEN GENERAL If Not ErrorCancelar AndAlso ListaRemisionesCancelar IsNot Nothing AndAlso ListaRemisionesCancelar.Count > 0 Then For Each CveRemision As Integer In ListaRemisionesCancelar - For Each RowDevolucion As DataRow In DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}", DistinctColumns:={"CveRemision", "CveAlmacen", "CveAlmacenDestino"}).Rows + Dim DtDevRemision As DataTable = DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}") - Dim DtDevRemision As DataTable = DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}") + Dim RowDevolucion As DataRow = DtDevRemision.FiltraParametros("", DistinctColumns:={"CveRemision", "CveAlmacen", "CveAlmacenDestino"}).Rows(0) - CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero() - CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero() + CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero() + CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero() - 'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN GENERAL - If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision, ObjVentas, ObjInventario) Then - ErrorCancelar = True - MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión." - Exit For - End If + 'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN GENERAL + If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision, ObjVentas, ObjInventario) Then + ErrorCancelar = True + MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión." + Exit For + End If - DtDevRemision.Dispose() - Next + DtDevRemision.Dispose() Next End If @@ -5030,22 +5027,34 @@ Namespace Modelos End If 'ENTRADA A (ALMACEN GENERAL) + Dim DtEntradaDetalle As DataTable = Nothing + If Not ErrorCancelar Then If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then - For Each Dr As DataRow In ObjInventario.DtResultados.Rows + DtEntradaDetalle = ObjInventario.DtResultados.Copy() + End If + End If + + If Not ErrorCancelar Then + If DtEntradaDetalle IsNot Nothing Then + For Each Dr As DataRow In DtEntradaDetalle.Rows If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString) Then ErrorCancelar = True Exit For End If Next + Else + ErrorCancelar = True End If End If - - If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveRemision) Then - ErrorCancelar = True + If Not ErrorCancelar Then + If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveRemision) Then + ErrorCancelar = True + End If End If + Return Not ErrorCancelar End Function diff --git a/Ventas/RepCancelacionesPorRespuesta.aspx b/Ventas/RepCancelacionesPorRespuesta.aspx index 06a752b32..878847631 100644 --- a/Ventas/RepCancelacionesPorRespuesta.aspx +++ b/Ventas/RepCancelacionesPorRespuesta.aspx @@ -1,134 +1,161 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepCancelacionesPorRespuesta.aspx.cs" Inherits="Ventas_RepCancelacionesPorRespuesta" %> - - - - - - - Reporte de Cancelaciones por Respuesta - - - - -
  • - Verificar Cancelaciones
  • -
    -
    -
    - - - - - - - -
    - -
    -
    -
    -
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    -
    - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    - Facturas Pendientes Por Refacturar -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    -
    - - - - - - - - - - - - - - - - <%-- - - - - --%> - - - - -
    -
    -
    -
    -