This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2020-05-22 22:43:14 -07:00
14 changed files with 538 additions and 400 deletions

View File

@@ -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 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 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 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 Dim Retorno As Boolean = False
@@ -706,6 +707,9 @@ Public Class ClsClientes
.Add("@CveTipoRetencion", SqlDbType.TinyInt).Value = CveTipoRetencion .Add("@CveTipoRetencion", SqlDbType.TinyInt).Value = CveTipoRetencion
.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue
.Add("@CorreoEntregaCompras", SqlDbType.VarChar).Value = CorreoEntregaCompras
.Add("@CorreoEntregaAlmacen", SqlDbType.VarChar).Value = CorreoEntregaAlmacen
End With End With
Try Try
SqlAdapter.Fill(Data) 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 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 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 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 Dim Retorno As Boolean = False
@@ -900,6 +904,9 @@ Public Class ClsClientes
.Add("@CargoUsado", SqlDbType.Bit).Value = CargoUsado .Add("@CargoUsado", SqlDbType.Bit).Value = CargoUsado
.Add("@BonificacionUsado", SqlDbType.Bit).Value = BonificacionUsado .Add("@BonificacionUsado", SqlDbType.Bit).Value = BonificacionUsado
.Add("@CveTipoRetencion", SqlDbType.TinyInt).Value = CveTipoRetencion .Add("@CveTipoRetencion", SqlDbType.TinyInt).Value = CveTipoRetencion
.Add("@CorreoEntregaCompras", SqlDbType.VarChar).Value = CorreoEntregaCompras
.Add("@CorreoEntregaAlmacen", SqlDbType.VarChar).Value = CorreoEntregaAlmacen
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)

View File

@@ -1120,7 +1120,13 @@ Public Class ClsContabilidad
If Empresa.TipoContabilizacion = 1 Then ' contabilidad en SIG 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("<a href='/Contabilidad/RegPrePolizaS.aspx?CvePrePoliza={0}' class='Texto' target='_blank'>{1}</a><br/>", CvePrePoliza, _ContaFolio))
End If
Else Else
If CvePrePoliza <= 0 Then Return False If CvePrePoliza <= 0 Then Return False

View File

@@ -4217,16 +4217,14 @@ Namespace Modelos
'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN 'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN
If RequiereAceptacion Then If RequiereAceptacion Then
CancelacionFecha = Now.Date CancelacionFecha = Now.Date
CancelacionAcuse = ""
CveEstatus = 20 CveEstatus = 20
Else Else
CancelacionFecha = ObjCancelacion.CancelacionFecha CancelacionFecha = ObjCancelacion.CancelacionFecha
CancelacionAcuse = ObjCancelacion.CancelacionAcuse
CveEstatus = 5 CveEstatus = 5
End If End If
CancelacionAcuse = ObjCancelacion.CancelacionAcuse
Else 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.<br/>Origen del error: WebService www.sat.gob.mx"
Retorno.TipoMensaje = TipoMensaje.MsgError Retorno.TipoMensaje = TipoMensaje.MsgError
Return Retorno Return Retorno
@@ -4568,22 +4566,21 @@ Namespace Modelos
'SI EXISTEN HAY EXISTENCIA EN (ENTREGA POR ADELANTADO) SE TIENE QUE REGRESAR AL ALMACEN GENERAL '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 If Not ErrorCancelar AndAlso ListaRemisionesCancelar IsNot Nothing AndAlso ListaRemisionesCancelar.Count > 0 Then
For Each CveRemision As Integer In ListaRemisionesCancelar 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() CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero()
CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero() CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero()
'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN GENERAL 'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN GENERAL
If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision, ObjVentas, ObjInventario) Then If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision, ObjVentas, ObjInventario) Then
ErrorCancelar = True ErrorCancelar = True
MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión." MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión."
Exit For Exit For
End If End If
DtDevRemision.Dispose() DtDevRemision.Dispose()
Next
Next Next
End If End If
@@ -5030,22 +5027,34 @@ Namespace Modelos
End If End If
'ENTRADA A (ALMACEN GENERAL) 'ENTRADA A (ALMACEN GENERAL)
Dim DtEntradaDetalle As DataTable = Nothing
If Not ErrorCancelar Then If Not ErrorCancelar Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) 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 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 ErrorCancelar = True
Exit For Exit For
End If End If
Next Next
Else
ErrorCancelar = True
End If End If
End If End If
If Not ErrorCancelar Then
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveRemision) Then If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveRemision) Then
ErrorCancelar = True ErrorCancelar = True
End If
End If End If
Return Not ErrorCancelar Return Not ErrorCancelar
End Function End Function

View File

@@ -3417,7 +3417,7 @@ Partial Class Contratos_Default
Private Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click Private Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click
If TxtExcel.getfiles().Archivos.Count > 0 Then If TxtExcel.getfiles().Archivos.Count > 0 Then
Dim file As Archivo = TxtExcel.getfiles().Archivos(0) Dim file As Archivo = TxtExcel.getfiles().Archivos(0)
Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.patch Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch
Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
CargarArchivo(Directorio, file.filename, Tipo) CargarArchivo(Directorio, file.filename, Tipo)
Else Else
@@ -3741,7 +3741,7 @@ Partial Class Contratos_Default
#Region " IMPRIMIR DOCUMENTO - SABE " #Region " IMPRIMIR DOCUMENTO - SABE "
Public Sub DescarFormato(documento As String) Public Sub DescarFormato(documento As String)
Dim PathRoot As String = ModExtensiones.DirectorioBaseEmpresas Dim PathRoot As String = Server.MapPath("/")
Dim PathSource As String Dim PathSource As String
Dim pathDesti As String Dim pathDesti As String

View File

@@ -770,6 +770,9 @@
<h4 class="modal-title">Sugerencias</h4> <h4 class="modal-title">Sugerencias</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="row" style="text-align:right;height:50px;width:98%">
<asp:Button ID="BtnImprimirSugerencias" CssClass="btn green-haze btn-outline btn-circle btn-sm" OnClick="BtnImprimirSugerencias_Click" runat="server" Text="Imprimir" AutoPostBack="true"/>
</div>
<asp:GridView ID="GvSugerencias" runat="server" EmptyDataText="No se encontraron registros." AutoGenerateColumns="False" ShowHeader="true" ShowHeaderWhenEmpty="True" CssClass="table table-striped table-hover Widthall ScrollAD" GridLines="None"> <asp:GridView ID="GvSugerencias" runat="server" EmptyDataText="No se encontraron registros." AutoGenerateColumns="False" ShowHeader="true" ShowHeaderWhenEmpty="True" CssClass="table table-striped table-hover Widthall ScrollAD" GridLines="None">
<Columns> <Columns>
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Cantidad" DataField="Cantidad" DataFormatString="{0:#,###.##}" ItemStyle-HorizontalAlign="Right" />
@@ -787,6 +790,9 @@
</div> </div>
</div> </div>
</ContentTemplate> </ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="BtnImprimirSugerencias"/>
</Triggers>
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>

View File

@@ -7,6 +7,8 @@ Imports System.Linq
Imports CrystalDecisions.[Shared].Json Imports CrystalDecisions.[Shared].Json
Imports Extensiones Imports Extensiones
Imports Microsoft.Reporting.WebForms
Partial Class Inventarios_EntregaAlmacen Partial Class Inventarios_EntregaAlmacen
Inherits ClsPaginas Inherits ClsPaginas
@@ -3064,6 +3066,23 @@ Partial Class Inventarios_EntregaAlmacen
End If End If
End Sub 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 #End Region

View File

@@ -1419,13 +1419,22 @@ Partial Class Inventarios_TraspasoAlmacen
CargaRecepcion() CargaRecepcion()
End Sub End Sub
Private Sub CargaRecepcion() Private Sub CargaRecepcion()
Dim ObjInventarios As New ClsInventarios
Dim Dtt As DataTable = Nothing Dim Dtt As DataTable = Nothing
FolioBusqueda = If(TxtFolioRecepcion.Text = "", -1, TxtFolioRecepcion.Text.ToEntero) FolioBusqueda = If(TxtFolioRecepcion.Text = "", -1, TxtFolioRecepcion.Text.ToEntero)
Dim ObjInventarios As New ClsInventarios
If ObjInventarios.GetMovimientosTransitorios(DdlAlmacenRecepcion.SelectedValue.ToEntero, -1, DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero, -1, FolioBusqueda, UsuarioActual.CveEmpresa) Then If ObjInventarios.GetMovimientosTransitorios(DdlAlmacenRecepcion.SelectedValue.ToEntero, -1, DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero, -1, FolioBusqueda, UsuarioActual.CveEmpresa) Then
Dtt = ObjInventarios.DtResultados.FiltraParametros(String.Format("CveTipoAlmacenDestino <> 4")) Dtt = ObjInventarios.DtResultados.FiltraParametros(String.Format("CveTipoAlmacenDestino <> 4"))
Else
Alert("Ocurrió un error al consultar los movimientos transitorios. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Dtt = Nothing
End If
ObjInventarios.Dispose()
If Dtt IsNot Nothing Then
If TxtFolioRecepcion.Text.Trim <> "" Then If TxtFolioRecepcion.Text.Trim <> "" Then
CveMovimientoSalida = ObjInventarios.DtResultados.FiltroPrimeroValor("CveMovimiento", "").ToEntero CveMovimientoSalida = ObjInventarios.DtResultados.FiltroPrimeroValor("CveMovimiento", "").ToEntero
@@ -1433,14 +1442,7 @@ Partial Class Inventarios_TraspasoAlmacen
CveAlmacenDestino = DdlAlmacenRecepcion.SelectedValue.ToEntero CveAlmacenDestino = DdlAlmacenRecepcion.SelectedValue.ToEntero
CveAlmacenTransitorio = DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero CveAlmacenTransitorio = DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero
'CveUsuarioResponsable = DdlResponsableRecepcion.SelectedValue.ToEntero 'CveUsuarioResponsable = DdlResponsableRecepcion.SelectedValue.ToEntero
Else
Alert("Ocurrió un error al consultar los movimientos transitorios. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Dtt = Nothing
End If
ObjInventarios.Dispose()
If Dtt IsNot Nothing Then
GvDatosRecepcion.DataSource = Dtt GvDatosRecepcion.DataSource = Dtt
GvDatosRecepcion.DataBind() GvDatosRecepcion.DataBind()

View File

@@ -395,13 +395,13 @@
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group form-md-line-input"> <div class="form-group form-md-line-input">
<asp:TextBox ID="TxtNoExt" runat="server" CssClass="form-control" MaxLength="15"></asp:TextBox> <asp:TextBox ID="TxtNoExt" runat="server" CssClass="form-control" MaxLength="40"></asp:TextBox>
<label for="<%= TxtNoExt.ClientID.ToString()%>">No. Ext. </label> <label for="<%= TxtNoExt.ClientID.ToString()%>">No. Ext. </label>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group form-md-line-input"> <div class="form-group form-md-line-input">
<asp:TextBox ID="TxtNoInt" runat="server" CssClass="form-control" MaxLength="15"></asp:TextBox> <asp:TextBox ID="TxtNoInt" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox>
<label for="<%= TxtNoInt.ClientID.ToString()%>">No. Int.</label> <label for="<%= TxtNoInt.ClientID.ToString()%>">No. Int.</label>
</div> </div>
</div> </div>
@@ -604,6 +604,17 @@
</asp:DropDownList> </asp:DropDownList>
<label for="<%= DdlTipoCliente.ClientID.ToString()%>">Tipo de Cliente:</label> <label for="<%= DdlTipoCliente.ClientID.ToString()%>">Tipo de Cliente:</label>
</div> </div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox runat="server" ID="TxtCorreoEntregaCompras" CssClass="form-control"/>
<label for="<%= TxtCorreoEntregaCompras.ClientID.ToString()%>">Correo de Entrega de Compras:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox runat="server" ID="TxtCorreoEntregaAlmacen" CssClass="form-control"/>
<label for="<%= TxtCorreoEntregaAlmacen.ClientID.ToString()%>">Correo de Entrega de Almacén:</label>
</div>
<div class="form-group form-md-line-input input-iconright" runat="server" id="DivCargoUsado" visible="false"> <div class="form-group form-md-line-input input-iconright" runat="server" id="DivCargoUsado" visible="false">
<label>Cargo Usado:</label> <label>Cargo Usado:</label>
<asp:CheckBox ID="ChkCargoUsado" runat="server" CssClass="make-switchsd" data-size="small" Text="" ClientIDMode="Static" Enabled="true" /> <asp:CheckBox ID="ChkCargoUsado" runat="server" CssClass="make-switchsd" data-size="small" Text="" ClientIDMode="Static" Enabled="true" />

View File

@@ -1666,6 +1666,8 @@ Partial Class Clientes
DivProtletRegistrar.Visible = True DivProtletRegistrar.Visible = True
End If End If
TxtCorreoEntregaCompras.Text = ObjClientes.DtResultados(0)("CorreoEntregaCompras").ToString
TxtCorreoEntregaAlmacen.Text = ObjClientes.DtResultados(0)("CorreoEntregaCompras").ToString
Else Else
Existe = False Existe = False
Alert("El Cliente Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) 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, 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(), 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, 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 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(), 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(), 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(), 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) ObjClientes.LimpiaImpuestosLocales(CveCliente)

View File

@@ -2342,12 +2342,12 @@
<label for="<%= TxtCPCliente.ClientID.ToString()%>">Código Postal:</label> <label for="<%= TxtCPCliente.ClientID.ToString()%>">Código Postal:</label>
</div> </div>
<div class="form-group form-md-line-input input-iconright col-xs-4"> <div class="form-group form-md-line-input input-iconright col-xs-4">
<asp:TextBox ID="TxtNumExtCliente" CssClass="form-control " runat="server" MaxLength="20" CausesValidation="true"></asp:TextBox> <asp:TextBox ID="TxtNumExtCliente" CssClass="form-control " runat="server" MaxLength="40" CausesValidation="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVNoEC" runat="server" ControlToValidate="TxtNumExtCliente" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Número Exterior''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarCliente"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RFVNoEC" runat="server" ControlToValidate="TxtNumExtCliente" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Número Exterior''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarCliente"></asp:RequiredFieldValidator>
<label for="<%= TxtNumExtCliente.ClientID.ToString()%>">Número Exterior:</label> <label for="<%= TxtNumExtCliente.ClientID.ToString()%>">Número Exterior:</label>
</div> </div>
<div class="form-group form-md-line-input input-iconright col-xs-4"> <div class="form-group form-md-line-input input-iconright col-xs-4">
<asp:TextBox ID="TxtNumIntCliente" CssClass="form-control " runat="server" MaxLength="20" CausesValidation="true"></asp:TextBox> <asp:TextBox ID="TxtNumIntCliente" CssClass="form-control " runat="server" MaxLength="50" CausesValidation="true"></asp:TextBox>
<label for="<%= TxtNumIntCliente.ClientID.ToString()%>">Número Interior:</label> <label for="<%= TxtNumIntCliente.ClientID.ToString()%>">Número Interior:</label>
</div> </div>
</div> </div>

View File

@@ -22,6 +22,17 @@
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server"> <asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="row">
<div class="col-md-12" style="vertical-align: middle;" align="center">
<div style="z-index: 5; position: relative;">
<div id="DivAdvertencia" clientidmode="Static" runat="server" class="alert alert-warning" style="padding: 5px; margin-bottom: 5px; padding-right: 25px;">
<button type="button" class="close" data-dismiss="alert" style="margin-top: 5px;" aria-hidden="true"></button>
<strong style="font-size: 20px; margin-right: 25px;">Información: </strong>
<asp:Literal Text="Para que el documento se cancele sin aceptación por parte del cliente tendrá que transcurrir 72 horas hábiles" runat="server" ID="LtlAdvertencia"></asp:Literal>
</div>
</div>
</div>
</div>
<div class="portlet light smmallpadding traspasorow bordered"> <div class="portlet light smmallpadding traspasorow bordered">
<div class="portlet-title"> <div class="portlet-title">
<div class="caption font-green"> <div class="caption font-green">
@@ -55,6 +66,8 @@
<asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Mon" DataField="Abreviatura" ItemStyle-Width="30px" /> <asp:BoundField HeaderText="Mon" DataField="Abreviatura" ItemStyle-Width="30px" />
<asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" /> <asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" />
<asp:BoundField HeaderText="Fecha Solicitud" DataField="FechaCambioEstatus" ItemStyle-Width="160px" />
<asp:BoundField HeaderText="Fecha Cancelacion" DataField="FechaCancelacion" ItemStyle-Width="160px" />
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar"> <asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
<ItemTemplate> <ItemTemplate>
<asp:LinkButton runat="server" OnClick="BtnValidar_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton> <asp:LinkButton runat="server" OnClick="BtnValidar_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
@@ -100,6 +113,8 @@
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="80px" /> <asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="80px" />
<asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Mon" DataField="Abreviatura" ItemStyle-Width="30px" /> <asp:BoundField HeaderText="Mon" DataField="Abreviatura" ItemStyle-Width="30px" />
<asp:BoundField HeaderText="Fecha Solicitud" DataField="FechaCambioEstatus" ItemStyle-Width="160px" />
<asp:BoundField HeaderText="Fecha Cancelacion" DataField="FechaCancelacion" ItemStyle-Width="160px" />
<asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" /> <asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" />
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar"> <asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
<ItemTemplate> <ItemTemplate>
@@ -107,11 +122,6 @@
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:HyperLinkField HeaderText="Refacturación" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" /> <asp:HyperLinkField HeaderText="Refacturación" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" />
<%-- <asp:TemplateField ItemStyle-Width="35px" HeaderText="Refacturar">
<ItemTemplate>
<asp:LinkButton runat="server" OnClick="BtnRefacturar_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>--%>
</Columns> </Columns>
<RowStyle CssClass="Texto" /> <RowStyle CssClass="Texto" />
<HeaderStyle CssClass="Titulos" /> <HeaderStyle CssClass="Titulos" />
@@ -123,12 +133,29 @@
<asp:Button ID="BtnRefacturarDocumento" runat="server" ClientIDMode="Static" Text="Refacturar Documento" Style="display: none;" /> <asp:Button ID="BtnRefacturarDocumento" runat="server" ClientIDMode="Static" Text="Refacturar Documento" Style="display: none;" />
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<asp:Button ID="BtnEnviarMailCancelacion" runat="server" ClientIDMode="Static" Text="Enviar Mail Cliente" Style="display: none;" OnClick="BtnEnviarMailCancelacion_Click" />
</asp:Content> </asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
<script src="/Metronic/assets/global/plugins/jquery.pulsate.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
function BtnRefacturarDocumento() { function BtnRefacturarDocumento() {
$('#BtnRefacturarDocumento').click(); $('#BtnRefacturarDocumento').click();
} }
function BtnEnviarMailCancelacion() {
$('#BtnEnviarMailCancelacion').click();
}
$(document).ready(function () {
if ($('#DivAdvertencia')) {
$("#DivAdvertencia").pulsate("destroy");
jQuery('#DivAdvertencia').pulsate({
color: "#faebcc"
});
}
});
</script> </script>
</asp:Content> </asp:Content>

View File

@@ -10,6 +10,7 @@ using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using Extensiones; using Extensiones;
using static Extensiones.ModExtensiones; using static Extensiones.ModExtensiones;
using Microsoft.Reporting.WebForms;
public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
{ {
@@ -75,7 +76,16 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
string Nombre = GvRow.DataKey("Nombre"); string Nombre = GvRow.DataKey("Nombre");
if (CveVenta > 0) if (CveVenta > 0)
{ {
Alert(VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total)); var resp = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total);
if (resp.EnviarAcuse)
{
Alert(resp.Mensaje,TipoMensaje.MsgConfirmacion,"BtnEnviarMailCancelacion();");
}
else
{
Alert(resp.Mensaje);
}
} }
CargaDatos(); CargaDatos();
} }
@@ -92,28 +102,53 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
string Folio = GvRow.DataKey("Folio"); string Folio = GvRow.DataKey("Folio");
string TipoDocto = GvRow.DataKey("TipoDocto"); string TipoDocto = GvRow.DataKey("TipoDocto");
string Nombre = GvRow.DataKey("Nombre"); string Nombre = GvRow.DataKey("Nombre");
if (CveVenta > 0) if (CveVenta > 0)
{ {
Alert(VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total, true)); var respuesta = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total, true);
Alert(respuesta.Mensaje);
CargaDatos();
//if (respuesta.IrARefacturar)
//{
// Server.Transfer(respuesta.LigaRefacturacion);
//}
//else
//{
// Alert(respuesta.Mensaje);
// CargaDatos();
//}
} }
CargaDatos();
} }
private string VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false) private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false)
{ {
var retorno = new MRespuestaSAT()
{
Mensaje = "",
EnviarAcuse = false,
LigaRefacturacion = "",
IrARefacturar = false
};
var sb = new StringBuilder(); var sb = new StringBuilder();
var CancelacionAcuse = "";
var CancelacionFecha = DateTime.Now; string CancelacionAcuse = "";
DateTime CancelacionFecha = DateTime.Now;
int CveEstatus = 4; int CveEstatus = 4;
try try
{ {
var resp = Timbrado.VerificarVigenciaSAT(uuid, UsuarioActual.Empresa.RFC, receptor, total, UsuarioActual.Empresa.FacturaProduccion); var resp = Timbrado.VerificarVigenciaSAT(uuid, UsuarioActual.Empresa.RFC, receptor, total, true);
if (resp != null) if (resp != null)
{ {
if (resp.Estado == null) if (resp.Estado == null)
{ {
sb.Append("No se pudo comprobar el estado de la factura. El servicio del sat no esta disponible"); sb.Append("No se pudo comprobar el estado de la factura. El servicio del sat no esta disponible");
return sb.ToString(); retorno.Mensaje = sb.ToString();
return retorno;
} }
sb.AppendFormat("Folio Fiscal: {0} <br/>", uuid); sb.AppendFormat("Folio Fiscal: {0} <br/>", uuid);
@@ -124,12 +159,22 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
if (!UsuarioActual.Empresa.FacturaProduccion && (string.IsNullOrEmpty(uuid) || uuid.Contains("test"))) if (!UsuarioActual.Empresa.FacturaProduccion && (string.IsNullOrEmpty(uuid) || uuid.Contains("test")))
{ {
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje; var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion);
sb.AppendFormat("{0} <br/>", FueCancelado); sb.AppendFormat("{0} <br/>", respCancelacion.Mensaje);
if (CveEstatus.Contiene(4, 5) && EsRefacturacion) if (!respCancelacion.HuboError)
{ {
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta)); retorno.EnviarAcuse = true;
sb.Append("El Documento se canceló correctamente.");
sb.Append($"</br> <a href='/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=CAN&CVEVTA={CveVenta}")}' class='Texto' target='_blank'>Imprimir Acuse</a>");
sb.Append("</br></br> ¿Desea enviar el Acuse de Cancelación al Cliente?");
}
if (respCancelacion.CveEstatus.Contiene(4, 5) && EsRefacturacion)
{
retorno.IrARefacturar = true;
retorno.LigaRefacturacion = string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta);
} }
} }
else else
@@ -137,30 +182,28 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
if ((resp.EsCancelable.ToUpper() == "NO CANCELABLE")) if ((resp.EsCancelable.ToUpper() == "NO CANCELABLE"))
{ {
sb.Append("Esta factura no es cancelable."); sb.Append("Esta factura no es cancelable.");
return sb.ToString(); retorno.Mensaje = sb.ToString();
return retorno;
} }
if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO") if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO")
{ {
CveEstatus = 5; CveEstatus = 5;
var solicitud = new WSGF.Service1SoapClient();
var acuse = solicitud.GetAcuse(emisor, "rene.molina@adsistemas.mx", "rene2018", uuid);
if (acuse.Estado == 0) var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion);
sb.AppendFormat("{0} <br/>", respCancelacion.Mensaje);
if (!respCancelacion.HuboError)
{ {
var xmlAcuse = new System.Xml.XmlDocument(); sb.Append("El Documento se canceló correctamente.");
xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64)); sb.Append($"</br> <a href='/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=CAN&CVEVTA={CveVenta}")}' class='Texto' target='_blank'>Imprimir Acuse</a>");
sb.Append("</br></br> ¿Desea enviar el Acuse de Cancelación al Cliente?");
CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
} }
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion).Mensaje; if (respCancelacion.CveEstatus.Contiene(4, 5) && EsRefacturacion)
sb.AppendFormat("{0} <br/>", FueCancelado);
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
{ {
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta)); retorno.IrARefacturar = true;
retorno.LigaRefacturacion = string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta);
} }
} }
else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA") else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA")
@@ -183,16 +226,19 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
else else
{ {
sb.Append("No se pudo comprobar la vigencia de la factura."); sb.Append("No se pudo comprobar la vigencia de la factura.");
return sb.ToString(); retorno.Mensaje = sb.ToString();
return retorno;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
sb.Append("Error al consumir el servicio: " + ex.Message); sb.Append("Error al consumir el servicio: " + ex.Message);
return sb.ToString(); retorno.Mensaje = sb.ToString();
return retorno;
} }
return sb.ToString(); retorno.Mensaje = sb.ToString();
return retorno;
} }
private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false) private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false)
{ {
@@ -210,180 +256,6 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
return retorno; return retorno;
} }
//private int GenerarPolizaAC(ClsContPAQi ObjAC, int CveVenta, string Folio, int CveCliente, string TipoComprobante, DateTime Fecha, bool CancelacionIngreso = false)
//{
// int CtaCliente = 0;
// int OrdenPago = 0;
// string NombreCliente = "";
// var ObjClientes = new ClsClientes();
// if (ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa))
// {
// CtaCliente = ObjClientes.IdCtaContClientes;
// NombreCliente = ObjClientes.NombreComercial;
// }
// ObjClientes.Dispose();
// var ObjVentas = new ClsVentas();
// if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa))
// {
// if (ObjVentas.DtResultados.Rows.Count > 0)
// {
// OrdenPago = ObjVentas.DtResultados.Rows[0]["Num3"].ToEntero();
// }
// }
// int Retorno = 0;
// int IDPoliza = 0;
// bool ErrorAC = false;
// string Concepto = string.Format("GD {0}", NombreCliente);
// int Paridad = 1;
// bool TipoMovto = false;
// if (CancelacionIngreso)
// {
// Concepto = string.Format("Cancelación GD {0}", NombreCliente);
// Paridad = -1;
// TipoMovto = true;
// }
// var TipoPoliza = TipoComprobante.Contiene("OP", "Com") ? 3 : 1;
// DataRow dr = null;
// int CtaISSSTESON = 643;
// int CtaISPT = 1745;
// var AC = new ClsAC();
// //var ObjAC = new ClsContPAQi(UsuarioActual.Empresa);
// //ObjAC.IniciaTransacSQL();
// IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, 0, 0, UsuarioActual.CveUsuario, Fecha);
// if (IDPoliza > 0)
// {
// if (TipoComprobante == "OP")
// {
// //Orden de PAGO
// if (OrdenPago == 1)
// {
// //ISSSTESON
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
// {
// if (!ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
// {
// ErrorAC = true;
// }
// }
// else
// {
// ErrorAC = true;
// }
// }
// else
// {
// //ISPT
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
// {
// if (!ObjAC.AddMovimiento(IDPoliza, CtaISPT, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
// {
// ErrorAC = true;
// }
// }
// else
// {
// ErrorAC = true;
// }
// }
// }
// else
// {
// //NORMAL
// DataTable Detalles = null;
// DataTable DTPresupuestoIngresos = null;
// if (ObjVentas.GetVentaDetalle(CveVenta))
// {
// Detalles = ObjVentas.DtResultados.Copy();
// }
// if (AC.GetPresupuestoIngresos(-1, DateTime.Now.Year, true, UsuarioActual.CveEmpresa))
// {
// DTPresupuestoIngresos = AC.DtResultados.Copy();
// }
// if (Detalles != null && DTPresupuestoIngresos != null)
// {
// var query = from gvr in Detalles.AsEnumerable()
// group gvr by gvr["CvePresupuestoIngreso"].ToString().ToEntero() into g
// select new { TotalImporte = g.Sum((x) => x["Total"].ToString().ToDouble()), CvePresupuestoIngreso = g.Key };
// foreach (var item in query)
// {
// dr = DTPresupuestoIngresos.FiltroPrimero(string.Format("CvePresupuestoIngreso = {0}", item.CvePresupuestoIngreso));
// if (dr != null)
// {
// Concepto = string.Format("{0} - {1}: {2}", NombreCliente, TipoComprobante, Folio);
// if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaPorEjecutar"].ToString().ToEntero(), false, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
// {
// if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaDevengado"].ToString().ToEntero(), true, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
// {
// // CARGO la deuda del cliente
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
// {
// // abono,
// if (!ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaMatriz"].ToString().ToEntero(), !TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
// {
// ErrorAC = true;
// break;
// }
// }
// else
// {
// ErrorAC = true;
// break;
// }
// }
// else
// {
// ErrorAC = true;
// break;
// }
// }
// else
// {
// ErrorAC = true;
// break;
// }
// }
// else
// {
// ErrorAC = true;
// break;
// }
// }
// }
// else
// {
// ErrorAC = true;
// }
// }
// }
// else
// {
// ErrorAC = true;
// }
// if (!ErrorAC)
// {
// ObjAC.AjustaPoliza(IDPoliza);
// Retorno = IDPoliza;
// }
// else
// {
// Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError);
// }
// AC.Dispose();
// ObjVentas.Dispose();
// return Retorno;
//}
private string DecodeBase64(string strXMLCodificado) private string DecodeBase64(string strXMLCodificado)
{ {
try try
@@ -429,8 +301,124 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
{ {
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0) if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0)
{ {
e.Row.Cells[8].Text = ""; e.Row.Cells[10].Text = "";
} }
} }
} }
public void BtnEnviarMailCancelacion_Click(object sender, EventArgs e)
{
ImprimeCancelacion(CveVenta);
}
public void ImprimeCancelacion(int CveVenta)
{
var Archivo = new System.IO.FileInfo(ModExtensiones.DirectorioBaseEmpresas + @"Empresas\Grales\Formatos\AcuseCancelacion.rdlc");
if (Archivo.Exists)
{
var ObjFactura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa);
string SelloCancelacion = "";
string FechaCancelacion = "";
DataTable DtDatos = null;
using (ClsVentas ObjVentas = new ClsVentas())
{
if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa))
{
DtDatos = ObjVentas.DtResultados.Copy();
DataRow drv = DtDatos.Rows[0];
SelloCancelacion = drv["SelloCancelacion"].ToString();
FechaCancelacion = drv["FechaCancelacion"].ToString().ToDateTime().ToString("dd/MM/yyyy HH:mm:ss");
}
}
List<ReportParameter> parametros = new List<ReportParameter>();
parametros.Add(new ReportParameter("FechaCancelacion", FechaCancelacion.ToString()));
parametros.Add(new ReportParameter("FolioFiscal", ObjFactura.FolioFiscal));
parametros.Add(new ReportParameter("RFCEmisor", UsuarioActual.Empresa.RFC));
parametros.Add(new ReportParameter("SelloCancelacion", SelloCancelacion));
byte[] ObjetoPDF = StreamPDF(@"Empresas\Grales\Formatos\AcuseCancelacion.rdlc", DtDatos, parametros, "AcuseCancelacion" + CveVenta);
List<ClsSisMail.ArchivoMail> LSRutasMail = new List<ClsSisMail.ArchivoMail>();
string Asunto = string.Empty;
string Cuerpo = string.Empty;
StringBuilder sb = new StringBuilder();
if (UsuarioActual.CveEmpresa == 119)
{
sb.Append("<!DOCTYPE html>");
sb.Append("<html>");
sb.Append("<head>");
sb.Append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>");
sb.Append(" <title>Acuse De Cancelación</title>");
sb.Append(" <meta charset=\"utf-8\" />");
sb.Append("</head>");
sb.Append("<body>");
sb.Append(" <font face=\"calibri\">");
sb.Append($" Estimado Cliente <b>{ObjFactura.Cliente.Nombre}</b>,<br /><br />");
sb.Append($" Le informamos que Agroquímicos JAM, S.A. DE C.V ha cancelado el CFDI <b>{ObjFactura.SerieFolio}</b>, el cual ha quedado sin Efectos Fiscales y encontrará adjunto en este correo el Acuse de <br />");
sb.Append($" cancelación del SAT.<br />");
sb.Append(" POR LO QUE PEDIMOS ELIMINARLO Y NO INCLUIRLO EN SU CONTABILIDAD, YA QUE PUEDE REPRESENTAR UN PROBLEMA FISCAL PARA USTED O SU EMPRESA CUANDO EL SAT REALICE UNA FUTURA AUDITORIA <br /> ");
sb.Append(" EN SU CONTABILIDAD. </font> ");
sb.Append(" <font face=\"calibri\" size=\"2\">");
sb.Append(" <br /><br /><br /><br /><br />");
sb.Append(" <i>Este correo se generó automaticamente, favor de no responder este mensaje.</i>");
sb.Append(" </font>");
sb.Append("</body>");
sb.Append("</html>");
}
else
{
sb.Append("<!DOCTYPE html>");
sb.Append("<html>");
sb.Append("<head>");
sb.Append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>");
sb.Append(" <title>Acuse De Cancelación</title>");
sb.Append(" <meta charset=\"utf-8\" />");
sb.Append("</head>");
sb.Append("<body>");
sb.Append(" <font face=\"calibri\">");
sb.Append($" Estimado Cliente <b>{ObjFactura.Cliente.Nombre}</b>,<br /><br />");
sb.Append($" A través del presente medio la Empresa <b>{UsuarioActual.Empresa.Empresa} - {UsuarioActual.Empresa.RFC}</b>, canceló el documento tipo <b>{ObjFactura.TipodeComprobante}</b> <br />");
sb.Append($" con folio <b>{ObjFactura.SerieFolio}</b> y el Importe de <b>${ObjFactura.Total}</b>. <br /><br />");
sb.Append(" Le hacemos llegar el acuse de cancelación. </font> ");
sb.Append(" <font face=\"calibri\" size=\"2\">");
sb.Append(" <br /><br /><br /><br /><br />");
sb.Append(" <i>Este correo se generó automaticamente, favor de no responder este mensaje.</i>");
sb.Append(" </font>");
sb.Append("</body>");
sb.Append("</html>");
}
Asunto = $"Acuse de Cancelacion {ObjFactura.SerieFolio}";
Cuerpo = sb.ToString();
string DisplayName = "";
if (UsuarioActual.CveEmpresa == 119)
DisplayName = "Facturación Agroquímicos JAM";
LSRutasMail.Add(new ClsSisMail.ArchivoMail() { ArchivoBinario = ObjetoPDF, NombreArchivo = $"AcuseCancelacion{ObjFactura.SerieFolio}.pdf" });
ClsSisMail ObjMail = new ClsSisMail();
if (ObjMail.SendMail(UsuarioActual.Empresa, ObjFactura.Cliente.Mail, Asunto, Cuerpo, "", LSRutasMail, Displayname: DisplayName))
{
Alert("El acuse de cancelación ha sido envíado correctamente.");
}
else
{
Alert("El acuse de cancelación no pudo ser enviado.",TipoMensaje.MsgError);
}
}
}
}
public class MRespuestaSAT
{
public bool EnviarAcuse { get; set; }
public string LigaRefacturacion { get; set; }
public bool IrARefacturar { get; set; }
public string Mensaje { get; set; }
} }

View File

@@ -6326,12 +6326,12 @@
<label for="<%= TxtCPCliente.ClientID.ToString()%>">Código Postal:</label> <label for="<%= TxtCPCliente.ClientID.ToString()%>">Código Postal:</label>
</div> </div>
<div class="form-group form-md-line-input input-iconright col-xs-4"> <div class="form-group form-md-line-input input-iconright col-xs-4">
<asp:TextBox ID="TxtNumExtCliente" CssClass="form-control " runat="server" MaxLength="20" CausesValidation="true"></asp:TextBox> <asp:TextBox ID="TxtNumExtCliente" CssClass="form-control " runat="server" MaxLength="40" CausesValidation="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVNoEC" runat="server" ControlToValidate="TxtNumExtCliente" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Número Exterior''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarCliente"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RFVNoEC" runat="server" ControlToValidate="TxtNumExtCliente" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Número Exterior''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarCliente"></asp:RequiredFieldValidator>
<label for="<%= TxtNumExtCliente.ClientID.ToString()%>">Número Exterior:</label> <label for="<%= TxtNumExtCliente.ClientID.ToString()%>">Número Exterior:</label>
</div> </div>
<div class="form-group form-md-line-input input-iconright col-xs-4"> <div class="form-group form-md-line-input input-iconright col-xs-4">
<asp:TextBox ID="TxtNumIntCliente" CssClass="form-control " runat="server" MaxLength="20" CausesValidation="true"></asp:TextBox> <asp:TextBox ID="TxtNumIntCliente" CssClass="form-control " runat="server" MaxLength="50" CausesValidation="true"></asp:TextBox>
<label for="<%= TxtNumIntCliente.ClientID.ToString()%>">Número Interior:</label> <label for="<%= TxtNumIntCliente.ClientID.ToString()%>">Número Interior:</label>
</div> </div>
</div> </div>

View File

@@ -10,6 +10,7 @@ Imports System.Security.Cryptography.X509Certificates
Imports System.Globalization Imports System.Globalization
Imports System.Net.Http Imports System.Net.Http
Imports Newtonsoft.Json.Linq Imports Newtonsoft.Json.Linq
Imports System.Diagnostics
Partial Class Ventas Partial Class Ventas
Inherits ClsPaginas Inherits ClsPaginas
@@ -7011,11 +7012,18 @@ Partial Class Ventas
'End If 'End If
'Esquema viejo, evitamos que aparezca por surtir 'Esquema viejo, evitamos que aparezca por surtir
If ErrorList.Count = 0 Then 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 VentaSaldoAlmacenNC <> 0 OrElse DevolucionAlmacenNC = 2 Then
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura") ErrorList.Add("No se pudo Cancelar el movimiento de almacen de la Factura")
End If End If
End If End If
End If End If
End If End If
End If End If
@@ -10152,10 +10160,10 @@ Partial Class Ventas
Exit For Exit For
Else Else
ViewState("SeGuardoPrePoliza") = True 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 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 ErrorPrepoliza = True
Exit For Exit For
End If End If
'se hace acreditamiento de impuestos 'se hace acreditamiento de impuestos
'IVA X TRASLADAR 'IVA X TRASLADAR
Dim EsAnticipoEspecial As Boolean = False Dim EsAnticipoEspecial As Boolean = False
@@ -10208,10 +10216,10 @@ Partial Class Ventas
End If End If
End If
End If End If
End If End If
End If
Next Next
End If End If
@@ -13289,7 +13297,7 @@ Partial Class Ventas
End If End If
Else 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.<br/>Origen del error: WebService www.sat.gob.mx", TipoMensaje.MsgError)
End If End If
ObjBanco.Dispose() ObjBanco.Dispose()
@@ -16154,6 +16162,8 @@ Partial Class Ventas
End If End If
MovDetalle.Dispose() MovDetalle.Dispose()
OcurrioError = Not GeneroMovimientoAlmacen
End If End If
End If End If
@@ -16167,7 +16177,7 @@ Partial Class Ventas
End If End If
Next Next
OcurrioError = Not GeneroMovimientoAlmacen
End If End If
End If End If
@@ -16321,7 +16331,7 @@ Partial Class Ventas
CveMovimientoDetalleEntrada = MovDet("CveMovimientoDetalle").ToString().ToEntero() CveMovimientoDetalleEntrada = MovDet("CveMovimientoDetalle").ToString().ToEntero()
End If 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 ContadorMovtosDetalles += 1
Else Else
OcurrioError = True OcurrioError = True
@@ -17022,7 +17032,21 @@ Partial Class Ventas
Dim TotalT As Decimal = TxtTotal.Text.ToDecimal Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
Dim RFCReceptor As String = LblRFC.Text.Trim 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) 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 IsNot Nothing Then
If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
@@ -17990,17 +18014,30 @@ Partial Class Ventas
Private Function ValidaPagosContado() As Boolean Private Function ValidaPagosContado() As Boolean
Dim Retorno = False 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 '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 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) Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
Retorno = True Retorno = True
Return Retorno Return Retorno
End If End If
If Not PermiteCredito AndAlso (DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0) AndAlso TxtTotal.Text.ToDecimal > 0 Then If Not PermiteCredito AndAlso TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + AmortizacionNC
If TotalPago < TxtTotal.Text.ToDecimal Then If TotalPago < TxtTotal.Text.ToDecimal Then
Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia) 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 'SI TIENE SALDO PENDIENTE VALIDA SI TIENE PAGOS
If Me.SaldoVenta > 0 Then 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) Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
Retorno = True Retorno = True
End If End If
If UsuarioActual.CveEmpresa = 141 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then 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 If Not PermiteCredito AndAlso TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + AmortizacionNC
If TotalPago < TxtTotal.Text.ToDecimal Then If TotalPago < TxtTotal.Text.ToDecimal Then
Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia) 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 If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, LblTotalNC.Text.Trim().ToDecimal(), 0) Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, LblTotalNC.Text.Trim().ToDecimal(), 0)
If TotalNC > 0 Then 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) Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
Retorno = True Retorno = True
End If End If
Else 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) Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
Retorno = True Retorno = True
End If End If
End If End If
Else 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) Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
Retorno = True Retorno = True
End If End If
@@ -19165,6 +19202,7 @@ Partial Class Ventas
End If End If
End If End If
ObjVentas.Dispose()
End Sub End Sub
Private Sub MostrarCondicionesCancelacion() Private Sub MostrarCondicionesCancelacion()
@@ -19199,7 +19237,19 @@ Partial Class Ventas
Dim TotalT As Decimal = TxtTotal.Text.ToDecimal Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
Dim RFCReceptor As String = LblRFC.Text.Trim 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) 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 IsNot Nothing Then
If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
Alert("Esta factura no es cancelable.", TipoMensaje.MsgAdvertencia) Alert("Esta factura no es cancelable.", TipoMensaje.MsgAdvertencia)
@@ -19259,7 +19309,7 @@ Partial Class Ventas
CancelacionAcuse = ObjCancelacion.CancelacionAcuse CancelacionAcuse = ObjCancelacion.CancelacionAcuse
CveEstatus = 5 CveEstatus = 5
Else 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.<br/>Origen del error: WebService www.sat.gob.mx", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
Else Else
@@ -19379,6 +19429,8 @@ Partial Class Ventas
Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing
If ObjFacturaCancelacion IsNot Nothing AndAlso ObjFacturaCancelacion.CveVenta > 0 Then If ObjFacturaCancelacion IsNot Nothing AndAlso ObjFacturaCancelacion.CveVenta > 0 Then
Dim SWatch As New Stopwatch
SWatch.Start()
If EsRefacturacion Then If EsRefacturacion Then
resp = ObjFacturaCancelacion.CancelarPorRefacturacion() resp = ObjFacturaCancelacion.CancelarPorRefacturacion()
@@ -19397,16 +19449,25 @@ Partial Class Ventas
resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar) resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar)
End If 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 If resp.CveEstatus = 5 AndAlso Not EsRefacturacion Then
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnEnviarMailCancelacion();", TextoConfirmacion:="&nbsp;&nbsp;&nbsp;&nbsp;Si&nbsp;&nbsp;&nbsp;&nbsp;", TextoCancelacion:="&nbsp;&nbsp;&nbsp;&nbsp;<a onclick='Recargar()'>No</>&nbsp;&nbsp;&nbsp;&nbsp;") Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnEnviarMailCancelacion();", TextoConfirmacion:="&nbsp;&nbsp;&nbsp;&nbsp;Si&nbsp;&nbsp;&nbsp;&nbsp;", TextoCancelacion:="&nbsp;&nbsp;&nbsp;&nbsp;<a onclick='Recargar()'>No</>&nbsp;&nbsp;&nbsp;&nbsp;")
Else Else
If EsRefacturacion Then If EsRefacturacion Then
If resp.CveEstatus = 20 Then If resp.CveEstatus = 20 Then
ObjFacturaCancelacion.Dispose() ObjFacturaCancelacion.Dispose()
Response.Redirect($"/Ventas/RepCancelacionesPorRespuesta.aspx?CveVenta={CveVenta}") Server.Transfer($"/Ventas/RepCancelacionesPorRespuesta.aspx?CveVenta={CveVenta}")
ElseIf resp.CveEstatus.Contiene(4, 5) Then ElseIf resp.CveEstatus.Contiene(4, 5) Then
ObjFacturaCancelacion.Dispose() ObjFacturaCancelacion.Dispose()
Response.Redirect($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1") Server.Transfer($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1")
Else Else
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();") Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
End If End If