--Addenda en ventas, guardar, lectura y escritura en xml
This commit is contained in:
@@ -454,7 +454,8 @@ Public Class ClsVentas
|
||||
Optional CorreoNotificacion As String = "", Optional FormaPaqueteria As Integer = 1, Optional FacturarSucursal As Boolean = False, Optional VentaDesglosaIEPS As Boolean = False, Optional ServicioDomicilio As Boolean = False, Optional RFCReceptor As String = "", Optional Adjunto As String = "-1",
|
||||
Optional DevolucionImportePagado As Decimal = 0, Optional EsGarantia As Boolean = False, Optional CveLineaAdicional As Integer = -1, Optional DescripcionVenta As String = "",
|
||||
Optional CveMedico As Integer = -1, Optional CveProcedimiento As Integer = -1, Optional CveTipoVenta As Integer = -1, Optional RequiereOS As Boolean = False,
|
||||
Optional FechaParaSurtir As DateTime = MinFecha, Optional Paciente As String = "-1", Optional Episodio As String = "-1", Optional EsFacturaGlobal As Boolean = False, Optional CveSATPeriodicidad As Integer = -1, Optional CveSATMes As Integer = -1, Optional SATAnio As Integer = -1, Optional CveMotivoDevolucion As Integer = -1) As Boolean
|
||||
Optional FechaParaSurtir As DateTime = MinFecha, Optional Paciente As String = "-1", Optional Episodio As String = "-1", Optional EsFacturaGlobal As Boolean = False, Optional CveSATPeriodicidad As Integer = -1, Optional CveSATMes As Integer = -1, Optional SATAnio As Integer = -1, Optional CveMotivoDevolucion As Integer = -1,
|
||||
Optional Addenda As String = "") As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_VentasAdd")
|
||||
@@ -569,6 +570,7 @@ Public Class ClsVentas
|
||||
.Add("@SATAnio", SqlDbType.Int).Value = SATAnio
|
||||
.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue
|
||||
.Add("@CveMotivoDevolucion", SqlDbType.Int).Value = CveMotivoDevolucion
|
||||
.Add("@Addenda", SqlDbType.VarChar).Value = Addenda
|
||||
End With
|
||||
'SqlTypes.SqlDateTime.Null
|
||||
Try
|
||||
|
||||
@@ -5,6 +5,7 @@ Imports System.Data
|
||||
Imports System.IO
|
||||
Imports System.Net.Http
|
||||
Imports System.Xml
|
||||
Imports System.Xml.Serialization
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
@@ -401,6 +402,25 @@ Namespace Modelos
|
||||
Public Property TipoFolio As String
|
||||
|
||||
Public Property Valido As Boolean
|
||||
|
||||
End Class
|
||||
|
||||
<Serializable(), System.Xml.Serialization.XmlRoot("REM")>
|
||||
Public Class M_REM
|
||||
<System.Xml.Serialization.XmlElement("NOS")>
|
||||
Public Property NOS As String
|
||||
<System.Xml.Serialization.XmlElement("OR")>
|
||||
Public Property _OR As String
|
||||
<System.Xml.Serialization.XmlElement("CLUES")>
|
||||
Public Property CLUES As String
|
||||
<System.Xml.Serialization.XmlElement("CONTRATO")>
|
||||
Public Property CONTRATO As String
|
||||
<System.Xml.Serialization.XmlElement("FEEX")>
|
||||
Public Property FEEX As String
|
||||
<System.Xml.Serialization.XmlElement("FEEN")>
|
||||
Public Property FEEN As String
|
||||
<System.Xml.Serialization.XmlElement("FERE")>
|
||||
Public Property FERE As String
|
||||
End Class
|
||||
Public Enum TipoMensajeRespuesta
|
||||
TextoLimpio = 0
|
||||
@@ -8037,6 +8057,7 @@ Namespace Modelos
|
||||
Public Property CveMotivoCancelacion As Integer = -1
|
||||
Public Property MotivoCancelacion As String = ""
|
||||
Public Property TipoContable As Integer = -1
|
||||
Public Property Addenda As String = ""
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
@@ -2237,6 +2237,13 @@ Public Class Timbrado
|
||||
GeneraAddendaFord(RutaCadena, FolioFactura, Ventas.FordASN, Ventas.FordGSDB)
|
||||
|
||||
End If
|
||||
|
||||
'Si tiene una addenda personalizada, agregarla al xml
|
||||
If Not String.IsNullOrEmpty(Ventas.Addenda) Then
|
||||
Dim RutaCadena As String = String.Format("{0}{1}.xml", RutaArchivo, NombreArchivoXML)
|
||||
GeneraAddenda(RutaCadena, Ventas.Addenda)
|
||||
End If
|
||||
|
||||
End If
|
||||
End Select
|
||||
'----------------------
|
||||
@@ -3013,6 +3020,12 @@ concep.DescripcionesEspecificas.NumeroSerie)
|
||||
|
||||
End If
|
||||
|
||||
'Si tiene una addenda personalizada, agregarla al xml
|
||||
If Not String.IsNullOrEmpty(Ventas.Addenda) Then
|
||||
Dim RutaCadena As String = String.Format("{0}{1}.xml", RutaArchivo, NombreArchivoXML)
|
||||
GeneraAddenda(RutaCadena, Ventas.Addenda)
|
||||
End If
|
||||
|
||||
End If
|
||||
End Select
|
||||
|
||||
@@ -3288,6 +3301,12 @@ concep.DescripcionesEspecificas.NumeroSerie)
|
||||
|
||||
End If
|
||||
|
||||
'Si tiene una addenda personalizada, agregarla al xml
|
||||
If Not String.IsNullOrEmpty(Ventas.Addenda) Then
|
||||
Dim RutaCadena As String = String.Format("{0}{1}.xml", RutaArchivo, NombreArchivoXML)
|
||||
GeneraAddenda(RutaCadena, Ventas.Addenda)
|
||||
End If
|
||||
|
||||
End If
|
||||
End Select
|
||||
|
||||
@@ -3502,7 +3521,7 @@ concep.DescripcionesEspecificas.NumeroSerie)
|
||||
End Using
|
||||
|
||||
End Sub
|
||||
Private Sub GeneraAddendaFord(Archivo As String, pFolio As String, LstFordASN As ListBox, FordGSDBM As String)
|
||||
Private Sub GeneraAddenda(Archivo As String, Addenda As String)
|
||||
Dim cfdi As String = ""
|
||||
Dim SB As New StringBuilder
|
||||
Try
|
||||
@@ -3513,28 +3532,13 @@ concep.DescripcionesEspecificas.NumeroSerie)
|
||||
End Using
|
||||
Catch e As Exception
|
||||
Alert("The file could not be read:", TipoMensaje.MsgError)
|
||||
|
||||
End Try
|
||||
|
||||
|
||||
cfdi = cfdi.Replace("</cfdi:Comprobante>", "")
|
||||
|
||||
SB.Append(cfdi)
|
||||
|
||||
SB.Append("<cfdi:Addenda><fomadd:addenda xmlns:fomadd="" http://www.ford.com.mx/cfdi/addenda"" xsi:schemaLocation=""http://www.ford.com.mx/cfdi/addenda http://www.ford.com.mx/cfdi/addenda/cfdiAddendaFord_1_0.xsd"">")
|
||||
SB.AppendFormat("<fomadd:FOMASN version="" 1.0""><fomadd:GSDB>{0}</fomadd:GSDB>", FordGSDBM.Trim.ToUpper)
|
||||
|
||||
If pFolio <> "" Then SB.AppendFormat("<fomadd:ASN>{0}</fomadd:ASN>", pFolio)
|
||||
'If TxtFordASN2.Text.Trim <> "" Then SB.AppendFormat("<fomadd:ASN>{0}</fomadd:ASN>", TxtFordASN2.Text.Trim)
|
||||
|
||||
For Each li As ListItem In LstFordASN.Items
|
||||
|
||||
SB.AppendFormat("<fomadd:ASN>{0}</fomadd:ASN>", li.Text)
|
||||
|
||||
Next
|
||||
|
||||
SB.Append("</fomadd:FOMASN></fomadd:addenda></cfdi:Addenda></cfdi:Comprobante>")
|
||||
|
||||
SB.AppendFormat("{0}", Addenda)
|
||||
SB.Append("</cfdi:Comprobante>")
|
||||
|
||||
Using outfile As New StreamWriter(Archivo)
|
||||
outfile.Write(SB.ToString())
|
||||
|
||||
1283
Ventas/Ventas.aspx
1283
Ventas/Ventas.aspx
File diff suppressed because it is too large
Load Diff
@@ -6255,6 +6255,38 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Dim Addenda = DbRowVenta("Addenda").ToString()
|
||||
If Not String.IsNullOrEmpty(Addenda) Then
|
||||
Try
|
||||
Dim ObjAddenda As New Modelos.M_REM
|
||||
|
||||
Addenda = Addenda.Replace("<cfdi:Addenda>", "")
|
||||
Addenda = Addenda.Replace("</cfdi:Addenda>", "")
|
||||
|
||||
Dim strAddenda As New StringBuilder()
|
||||
strAddenda.Append("<?xml version=""1.0""?>")
|
||||
strAddenda.Append(Addenda)
|
||||
|
||||
Dim serializer As System.Xml.Serialization.XmlSerializer = New System.Xml.Serialization.XmlSerializer(ObjAddenda.GetType())
|
||||
Dim string_reader As TextReader = New System.IO.StringReader(strAddenda.ToString())
|
||||
|
||||
ObjAddenda = DirectCast(serializer.Deserialize(string_reader), Modelos.M_REM)
|
||||
|
||||
If ObjAddenda IsNot Nothing Then
|
||||
TxtNOS.Text = ObjAddenda.NOS
|
||||
TxtOR.Text = ObjAddenda._OR
|
||||
TxtCLUES.Text = ObjAddenda.CLUES
|
||||
TxtContrato.Text = ObjAddenda.CONTRATO
|
||||
TxtFEEX.Text = ObjAddenda.FEEX
|
||||
TxtFERE.Text = ObjAddenda.FERE
|
||||
TxtFEEN.Text = ObjAddenda.FEEN
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al cargar los datos de la addenda", ex)
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
@@ -13624,6 +13656,48 @@ Partial Class Ventas
|
||||
}
|
||||
|
||||
End If
|
||||
|
||||
If Not String.IsNullOrEmpty(TxtNOS.Text.Trim()) Then
|
||||
Dim Obj_REM As New Modelos.M_REM
|
||||
Obj_REM.NOS = TxtNOS.Text
|
||||
Obj_REM._OR = TxtOR.Text
|
||||
Obj_REM.CLUES = TxtCLUES.Text
|
||||
Obj_REM.CONTRATO = TxtContrato.Text
|
||||
Obj_REM.FEEX = TxtFEEX.Text
|
||||
Obj_REM.FEEN = TxtFEEN.Text
|
||||
Obj_REM.FERE = TxtFERE.Text
|
||||
|
||||
Dim xmlRem As String = ""
|
||||
|
||||
Try
|
||||
Dim serializer As System.Xml.Serialization.XmlSerializer = New System.Xml.Serialization.XmlSerializer(Obj_REM.GetType)
|
||||
Dim string_writer As New System.IO.StringWriter
|
||||
serializer.Serialize(string_writer, Obj_REM)
|
||||
|
||||
xmlRem = string_writer.ToString()
|
||||
|
||||
'QUITAR NAMESPACES Y ETIQUETAS NO NECESARIAS
|
||||
If xmlRem <> "" Then
|
||||
xmlRem = xmlRem.Replace("<?xml version=""1.0"" encoding=""utf-16""?>", "")
|
||||
xmlRem = xmlRem.Replace("xmlns:xsd=""http://www.w3.org/2001/XMLSchema""", "")
|
||||
xmlRem = xmlRem.Replace("xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""", "")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
xmlRem = ""
|
||||
End Try
|
||||
|
||||
If Not String.IsNullOrEmpty(xmlRem) Then
|
||||
Dim SB As New StringBuilder
|
||||
SB.Append("<cfdi:Addenda>")
|
||||
SB.AppendFormat("{0}", xmlRem)
|
||||
SB.Append("</cfdi:Addenda>")
|
||||
|
||||
Obj.Addenda = SB.ToString()
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Return Timbre
|
||||
@@ -14163,7 +14237,7 @@ Partial Class Ventas
|
||||
FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible,
|
||||
CveLineaAdicional:=DdlLineaAdicional.SelectedValue.ToEntero(), DescripcionVenta:=DescripcionVenta,
|
||||
CveMedico:=CveMedico, CveProcedimiento:=CveProcedimiento, CveTipoVenta:=CveTipoVentaGuardar, RequiereOS:=ChkRequiereTecnico.Checked, FechaParaSurtir:=factura.FechaParaSurtir,
|
||||
Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text, CveMotivoDevolucion:=CveMotivoDevolucion) Then
|
||||
Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text, CveMotivoDevolucion:=CveMotivoDevolucion, Addenda:=factura.Addenda) Then
|
||||
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
Else
|
||||
If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 OrElse CveAnticipoPadre > 0 Then
|
||||
@@ -39177,6 +39251,5 @@ Partial Class Ventas
|
||||
' End Sub
|
||||
'End Class
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user