This commit is contained in:
rakcsle
2022-06-06 09:24:04 -07:00
24 changed files with 11141 additions and 6346 deletions

View File

@@ -395,7 +395,7 @@ End Class
<Serializable> <Serializable>
Public Class CFDIRetenciones Public Class CFDIRetenciones
Public Property Impuesto As String Public Property Impuesto As String
Public Property Importe As Decimal Public Property Importe As Decimal = 0.000000D
Public Property TasaOCuota As String Public Property TasaOCuota As String
End Class End Class
@@ -417,11 +417,11 @@ End Class
<Serializable> <Serializable>
Public Class CFDITraslados Public Class CFDITraslados
Public Property Impuesto As String Public Property Impuesto As String
Public Property Tasa As Decimal Public Property Tasa As Decimal = 0.000000D
Public Property TipoFactor As String Public Property TipoFactor As String
Public Property TasaOCuota As Decimal Public Property TasaOCuota As Decimal = 0.000000D
Public Property Importe As Decimal Public Property Importe As Decimal = 0.000000D
Public Property Base As Decimal Public Property Base As Decimal = 0.000000D
End Class End Class
@@ -456,11 +456,11 @@ Public Class CFDIComplementoPagos
Public ReadOnly Property Totales As CFDIComplementoPagosTotales Public ReadOnly Property Totales As CFDIComplementoPagosTotales
Get Get
Dim tRetorno As New CFDIComplementoPagosTotales Dim tRetorno As New CFDIComplementoPagosTotales
tRetorno.MontoTotalPagos = (From c In DocumentosRelacionados Select c.ImpPagado).Sum() tRetorno.MontoTotalPagos = (From c In DocumentosRelacionados Select c.ImpPagado * TipoCambioP).Sum()
tRetorno.TotalTrasladosBaseIVA0 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0 Select c.Base).Sum() tRetorno.TotalTrasladosBaseIVA0 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0 Select c.Base * TipoCambioP).Sum()
tRetorno.TotalTrasladosBaseIVA8 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0.08 Select c.Base).Sum() tRetorno.TotalTrasladosBaseIVA8 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0.08 Select c.Base * TipoCambioP).Sum()
tRetorno.TotalTrasladosBaseIVA16 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0.16 Select c.Base).Sum() tRetorno.TotalTrasladosBaseIVA16 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0.16 Select c.Base * TipoCambioP).Sum()
tRetorno.TotalTrasladosImpuestoIVA0 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0 Select c.Importe).Sum() tRetorno.TotalTrasladosImpuestoIVA0 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0 Select c.Importe).Sum()
tRetorno.TotalTrasladosImpuestoIVA8 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0.08 Select c.Importe).Sum() tRetorno.TotalTrasladosImpuestoIVA8 = (From c In Traslados Where c.Impuesto = "002" And c.TasaOCuota = 0.08 Select c.Importe).Sum()

View File

@@ -1087,6 +1087,7 @@ Public Class ClsBancos
Dim Timbre As CFDITimbre = Nothing Dim Timbre As CFDITimbre = Nothing
Dim Timbrado As New Timbrado Dim Timbrado As New Timbrado
Dim CFDIVersion As String = "4.0"
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
@@ -1100,6 +1101,7 @@ Public Class ClsBancos
UsuarioActual.Empresa.CP.ToString, CuentaBeneficiario, dr("TipoCambioPago").ToString.ToDecimal, dttpagos, dttpagosimpuestos, CFDIRelacionado:=CFDIRelacionado) UsuarioActual.Empresa.CP.ToString, CuentaBeneficiario, dr("TipoCambioPago").ToString.ToDecimal, dttpagos, dttpagosimpuestos, CFDIRelacionado:=CFDIRelacionado)
Else Else
CFDIVersion = "3.3"
Timbre = Timbrado.PreparaTimbrePago(RFCEmpresa, UsuarioActual.Empresa.Empresa, UsuarioActual.Empresa.CodigoRegimenFiscal, Timbre = Timbrado.PreparaTimbrePago(RFCEmpresa, UsuarioActual.Empresa.Empresa, UsuarioActual.Empresa.CodigoRegimenFiscal,
RFCCliente, dr("NombreCliente").ToString, Serie, Folio.ToString, FechaTimbrado, Cuentapago, RFCCliente, dr("NombreCliente").ToString, Serie, Folio.ToString, FechaTimbrado, Cuentapago,
dr("FechaDocumento").ToString.ToDate, dr("ClaveFormaPagoSAT").ToString, dr("AbreviaturaSAT").ToString, dr("VentasTotalPagado").ToString.ToDecimal, dr("FechaDocumento").ToString.ToDate, dr("ClaveFormaPagoSAT").ToString, dr("AbreviaturaSAT").ToString, dr("VentasTotalPagado").ToString.ToDecimal,
@@ -1137,7 +1139,7 @@ Public Class ClsBancos
' Dim StrRetorno As String = Modelos.TimbrarFactura(Ventas, UsuarioActual) ' Dim StrRetorno As String = Modelos.TimbrarFactura(Ventas, UsuarioActual)
If SeTimbro Then If SeTimbro Then
If UpdateComplementoPago(tCveComplementoPago, ObjTimbrado.UUID, UsuarioActual.Empresa.CvePAC, UsuarioActual.CveEmpresa) Then If UpdateComplementoPago(tCveComplementoPago, ObjTimbrado.UUID, UsuarioActual.Empresa.CvePAC, CFDIVersion, UsuarioActual.CveEmpresa) Then
CveComplementoPago = tCveComplementoPago CveComplementoPago = tCveComplementoPago
Retorno = True Retorno = True
End If End If
@@ -1201,8 +1203,7 @@ Public Class ClsBancos
'End Function 'End Function
Public Function UpdateComplementoPago(CveComplementoPago As Integer, FolioFiscal As String, CvePAC As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CvePACCancelacion As Integer = -1, Public Function UpdateComplementoPago(CveComplementoPago As Integer, FolioFiscal As String, CvePAC As Integer, CFDIVersion As String, CveEmpresa As Integer, Optional Estatus As Integer = -1) As Boolean
Optional FechaCancelacion As Date = MinFecha, Optional SelloCancelacion As String = "", Optional CveSATMotivoCancelacion As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Banc_ComplementoPagoUpdate") DataAdapter("PA_Banc_ComplementoPagoUpdate")
@@ -1213,11 +1214,37 @@ Public Class ClsBancos
.Add("@CvePAC", SqlDbType.Int).Value = CvePAC .Add("@CvePAC", SqlDbType.Int).Value = CvePAC
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@Estatus", SqlDbType.Int).Value = Estatus .Add("@Estatus", SqlDbType.Int).Value = Estatus
.Add("@CFDIVersion", SqlDbType.VarChar).Value = CFDIVersion
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function UpdateComplementoPagoCancelado(CveComplementoPago As Integer, CveEstatus As Integer, CvePACCancelacion As Integer, CveEmpresa As Integer, FechaCancelacion As DateTime, SelloCancelacion As String, CveSATMotivoCancelacion As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Banc_ComplementoPagoUpdateCancelado")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago
.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus
.Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion .Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion
.Add("@FechaCancelacion", SqlDbType.Date).Value = FechaCancelacion .Add("@FechaCancelacion", SqlDbType.Date).Value = FechaCancelacion
.Add("@SelloCancelacion", SqlDbType.VarChar).Value = SelloCancelacion .Add("@SelloCancelacion", SqlDbType.VarChar).Value = SelloCancelacion
.Add("@CveSATMotivoCancelacion", SqlDbType.Int).Value = CveSATMotivoCancelacion .Add("@CveSATMotivoCancelacion", SqlDbType.Int).Value = CveSATMotivoCancelacion
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With End With
Try Try
@@ -1227,7 +1254,7 @@ Public Class ClsBancos
If SelloCancelacion.Trim.Length > 0 Then If SelloCancelacion.Trim.Length > 0 Then
OnError($"Ocurrió un error al actualizar complemento de pago sello: {SelloCancelacion} ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError($"Ocurrió un error al actualizar complemento de pago sello: {SelloCancelacion} ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
Else Else
OnError("Ocurrió un error al actualizar complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un error al cancelar estatus complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End If End If
End Try End Try
@@ -1235,29 +1262,6 @@ Public Class ClsBancos
Return Retorno Return Retorno
End Function End Function
Public Function UpdateComplementoPagoCancelado(CveComplementoPago As Integer, CveEstatus As Integer, CvePACCancelacion As Integer, CveEmpresa As Integer, FechaCancelacion As DateTime) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Banc_ComplementoPagoUpdateCancelado")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago
.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus
.Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@FechaCancelacion", SqlDbType.DateTime).Value = FechaCancelacion
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al cancelar estatus complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function AddComplementoPagosSinc(cveUsuario As Int32, fechaInicio As String, cveEmpresa As Int32) As Boolean Public Function AddComplementoPagosSinc(cveUsuario As Int32, fechaInicio As String, cveEmpresa As Int32) As Boolean
Dim retorno As Boolean = False Dim retorno As Boolean = False
DataAdapter("PA_AddComplementoPagosSinc", CommandType.StoredProcedure) DataAdapter("PA_AddComplementoPagosSinc", CommandType.StoredProcedure)

View File

@@ -55,6 +55,16 @@ Public Class ClsPaginas
#Region "Propiedades" #Region "Propiedades"
Private Property SubReportData As Modelos.MSubReportData
Get
Return If(IsNothing(ViewState("SubReportData")), Nothing, DirectCast(ViewState("SubReportData"), Modelos.MSubReportData))
End Get
Set(value As Modelos.MSubReportData)
ViewState("SubReportData") = value
End Set
End Property
Public Shared ReadOnly Property UrlSitio As String Public Shared ReadOnly Property UrlSitio As String
Get Get
If IsNothing(System.Configuration.ConfigurationManager.AppSettings("UrlSitio")) Then If IsNothing(System.Configuration.ConfigurationManager.AppSettings("UrlSitio")) Then
@@ -4843,8 +4853,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Contabilidad2/RepCambiosSituacionFinanciera.aspx".ToUpper(), 585) PaginaDict.Add("/Contabilidad2/RepCambiosSituacionFinanciera.aspx".ToUpper(), 585)
PaginaDict.Add("/Contabilidad2/RepSituacionFinanciera.aspx".ToUpper(), 586) PaginaDict.Add("/Contabilidad2/RepSituacionFinanciera.aspx".ToUpper(), 586)
PaginaDict.Add("/Contabilidad2/RepMovimientosAuxiliaresCatalogo.aspx".ToUpper(), 587) PaginaDict.Add("/Contabilidad2/RepMovimientosAuxiliaresCatalogo.aspx".ToUpper(), 587)
' PaginaDict.Add("/Contabilidad2/RegPoliza.aspx".ToUpper(), 588)
'PaginaDict.Add("/Contabilidad2/PymeRegPoliza.aspx".ToUpper(), 588)
PaginaDict.Add("/Contabilidad2/RepAlmacenConta.aspx".ToUpper(), 539) PaginaDict.Add("/Contabilidad2/RepAlmacenConta.aspx".ToUpper(), 539)
PaginaDict.Add("/Contabilidad2/RepAnexoCatalogoMensual.aspx".ToUpper(), 589) PaginaDict.Add("/Contabilidad2/RepAnexoCatalogoMensual.aspx".ToUpper(), 589)
@@ -5586,29 +5595,8 @@ Public Class ClsPaginas
PaginaDict.Add("/ZDG/MensajeManual.aspx".ToUpper(), -1) PaginaDict.Add("/ZDG/MensajeManual.aspx".ToUpper(), -1)
PaginaDict.Add("/ZDG/MensajeAutomatico.aspx".ToUpper(), -1) PaginaDict.Add("/ZDG/MensajeAutomatico.aspx".ToUpper(), -1)
'PymeCharlie
PaginaDict.Add("/PyME/Contabilidad/CatCuentas.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/TiposPoliza.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/PlantillasPolizas.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/PlantillasPolizasDetalle.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/RegPoliza.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/RegPrePoliza.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/ContabilizacionVentas.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/ContabilizacionCompras.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/ContabilidadElectronica.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/CierreEjercicio.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/RepBalanceGeneral.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/RepAnexoCatalogo.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/RepMovimientosAuxiliaresCatalogo.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/RepBalanzaComprobacion.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Contabilidad/RepEstadoResultados.aspx".ToUpper(), -1)
PaginaDict.Add("/Planeacion/Presupuestos.aspx".ToUpper(), -1) PaginaDict.Add("/Planeacion/Presupuestos.aspx".ToUpper(), -1)
'Pyme 2017
PaginaDict.Add("/PyME/Sistemas/RegistroEmpresa.aspx".ToUpper(), -1)
PaginaDict.Add("/PyME/Sistemas/WizardRegistro.aspx".ToUpper(), -1)
PaginaDict.Add("/Contabilidad/OCDetalleAlmacen.aspx".ToUpper(), -1) PaginaDict.Add("/Contabilidad/OCDetalleAlmacen.aspx".ToUpper(), -1)
@@ -5927,17 +5915,17 @@ Public Class ClsPaginas
''' <param name="NombreArchivo">Opcional Nombre del archivo que se descarga</param> ''' <param name="NombreArchivo">Opcional Nombre del archivo que se descarga</param>
''' <param name="Formato">Optional, Formato de Generacion PDF o Excel</param> ''' <param name="Formato">Optional, Formato de Generacion PDF o Excel</param>
''' <remarks></remarks> ''' <remarks></remarks>
Public Sub ImprimirPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing, Optional Content_Disposition As String = "attachment") Public Sub ImprimirPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing, Optional Content_Disposition As String = "attachment", Optional SubReportData As Modelos.MSubReportData = Nothing)
'limpio ReportViwer 'limpio ReportViwer
ImprimirbytesPDF(StreamPDF(RutaReporte, DataSource, Parametros, NombreArchivo, Formato, MR), NombreArchivo, Formato, Content_Disposition:=Content_Disposition) ImprimirbytesPDF(StreamPDF(RutaReporte, DataSource, Parametros, NombreArchivo, Formato, MR, SubReportData), NombreArchivo, Formato, Content_Disposition:=Content_Disposition)
End Sub End Sub
Public Function StreamPDF(RutaReporte As String, DtDatos As DataTable, Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional RDSName As String = "DataSet1", Optional MR As ReportViewer = Nothing) As Byte() Public Function StreamPDF(RutaReporte As String, DtDatos As DataTable, Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional RDSName As String = "DataSet1", Optional MR As ReportViewer = Nothing, Optional SubReportData As Modelos.MSubReportData = Nothing) As Byte()
Dim lrds As New List(Of ReportDataSource) Dim lrds As New List(Of ReportDataSource)
Dim rds As New ReportDataSource Dim rds As New ReportDataSource
rds.Name = RDSName rds.Name = RDSName
rds.Value = DtDatos rds.Value = DtDatos
lrds.Add(rds) lrds.Add(rds)
Return StreamPDF(RutaReporte, lrds, Parametros, NombreArchivo, Formato, MR) Return StreamPDF(RutaReporte, lrds, Parametros, NombreArchivo, Formato, MR, SubReportData)
End Function End Function
'Public Function StreamPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing) As Byte() 'Public Function StreamPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing) As Byte()
' 'limpio ReportViwer ' 'limpio ReportViwer
@@ -5981,10 +5969,13 @@ Public Class ClsPaginas
' Return Bytes ' Return Bytes
'End Function 'End Function
Public Function StreamPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing) As Byte() Public Function StreamPDF(RutaReporte As String, DataSource As List(Of ReportDataSource), Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportViewer = Nothing, Optional SubReportData As Modelos.MSubReportData = Nothing) As Byte()
'limpio ReportViwer 'limpio ReportViwer
Dim sw As New System.Diagnostics.Stopwatch() Dim sw As New System.Diagnostics.Stopwatch()
sw.Start() sw.Start()
Me.SubReportData = Nothing
Dim Bytes As Byte() = Nothing Dim Bytes As Byte() = Nothing
Dim CveUsuario As Integer = 0 Dim CveUsuario As Integer = 0
@@ -6010,7 +6001,7 @@ Public Class ClsPaginas
RutaReporte = String.Format("{0}{1}", bdir, RutaReporte) RutaReporte = String.Format("{0}{1}", bdir, RutaReporte)
End If End If
If EsProduccion Then If EsProduccion AndAlso SubReportData Is Nothing Then
Dim wsreport As New WSRDLC.WebServiceSoapClient Dim wsreport As New WSRDLC.WebServiceSoapClient
Dim params As New List(Of WSRDLC.ReportParameter) Dim params As New List(Of WSRDLC.ReportParameter)
@@ -6030,12 +6021,21 @@ Public Class ClsPaginas
reportobjects.Add(ojext) reportobjects.Add(ojext)
End If End If
Next Next
For Each rpds As ReportParameter In Parametros For Each rpds As ReportParameter In Parametros
Dim param As New WSRDLC.ReportParameter Dim param As New WSRDLC.ReportParameter
param.Name = rpds.Name param.Name = rpds.Name
param.Values = {rpds.Values(0)}
'SI ES TEXTO, QUITAR TABS Y OTROS ESPACIOS QUE DEN PROBLEMAS AL MANDAR LA PETICION
If rpds IsNot Nothing AndAlso rpds.Values IsNot Nothing AndAlso rpds.Values.Count > 0 AndAlso rpds.Values(0) IsNot Nothing AndAlso rpds.Values(0).GetType() = GetType(String) Then
param.Values = {rpds.Values(0).Replace(vbVerticalTab, "")}
Else
param.Values = {rpds.Values(0)}
End If
params.Add(param) params.Add(param)
Next Next
Bytes = wsreport.StreamNEWPDFBytes(RutaReporte, ds, reportobjects.ToArray(), params.ToArray(), NombreArchivo, Formato, CveEmpresa, CveUsuario) Bytes = wsreport.StreamNEWPDFBytes(RutaReporte, ds, reportobjects.ToArray(), params.ToArray(), NombreArchivo, Formato, CveEmpresa, CveUsuario)
wsreport = Nothing wsreport = Nothing
params = Nothing params = Nothing
@@ -6050,9 +6050,16 @@ Public Class ClsPaginas
MR.LocalReport.ReportPath = RutaReporte MR.LocalReport.ReportPath = RutaReporte
MR.ProcessingMode = ProcessingMode.Local MR.ProcessingMode = ProcessingMode.Local
If SubReportData IsNot Nothing Then
Me.SubReportData = SubReportData
AddHandler MR.LocalReport.SubreportProcessing, AddressOf LocalReport_SubreportProcessing
End If
MR.LocalReport.EnableExternalImages = True MR.LocalReport.EnableExternalImages = True
MR.LocalReport.SetParameters(Parametros) MR.LocalReport.SetParameters(Parametros)
MR.LocalReport.Refresh() MR.LocalReport.Refresh()
Dim Warnings As Warning() = Nothing Dim Warnings As Warning() = Nothing
Dim StreamIds As String() = Nothing Dim StreamIds As String() = Nothing
Dim MimeType As String = Nothing Dim MimeType As String = Nothing
@@ -6121,6 +6128,14 @@ Public Class ClsPaginas
Return Bytes Return Bytes
End Function End Function
Private Sub LocalReport_SubreportProcessing(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
If SubReportData IsNot Nothing Then
For Each ds In SubReportData.DataSources
e.DataSources.Add(ds)
Next
End If
End Sub
Public Function ImprimirPDFCrystal(RutaReporte As String, DataSource As DataTable, Parametros As List(Of CrystalParametro), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportDocument = Nothing) As Byte() Public Function ImprimirPDFCrystal(RutaReporte As String, DataSource As DataTable, Parametros As List(Of CrystalParametro), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportDocument = Nothing) As Byte()
'limpio ReportViwer 'limpio ReportViwer
Dim sw As New System.Diagnostics.Stopwatch() Dim sw As New System.Diagnostics.Stopwatch()
@@ -6934,7 +6949,7 @@ Public Class ClsPaginas
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex)) GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
End Try End Try
End Sub End Sub
Public Function PdfFactura(ByRef Vta As Modelos.Factura, Optional AplicaPagare As String = "0", Optional Guardar As Boolean = True) As Byte() Public Function PdfFactura(ByRef Vta As Modelos.Factura, Optional AplicaPagare As String = "0", Optional Guardar As Boolean = True, Optional SubReportData As Modelos.MSubReportData = Nothing) As Byte()
Dim retorno As Byte() = Nothing Dim retorno As Byte() = Nothing
' Dim ObjVentas As New ClsVentas ' Dim ObjVentas As New ClsVentas
@@ -7136,7 +7151,7 @@ Public Class ClsPaginas
End If End If
'Si no tiene CBB, SE GENERA 'Si no tiene CBB, SE GENERA
If Not ImagenCBB.Exists AndAlso Vta.CveCliente.ToEntero > 0 Then If Not ImagenCBB.Exists AndAlso Vta.FolioFiscal <> "" Then
Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar()
CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total, Vta.FolioFiscal, RutaCBB) CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total, Vta.FolioFiscal, RutaCBB)
End If End If
@@ -7754,6 +7769,13 @@ Public Class ClsPaginas
'Next 'Next
'ast.ToString.GuardaLog() 'ast.ToString.GuardaLog()
'PASAR LOS PARAMETROS SI TIENE SUBREPORTE
If SubReportData IsNot Nothing Then
For Each parametro As ReportParameter In SubReportData.Parametros
params.Add(parametro)
Next
End If
Dim Archivo As New System.IO.FileInfo(RutaFormato) Dim Archivo As New System.IO.FileInfo(RutaFormato)
If Archivo.Exists Then If Archivo.Exists Then
'If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then 'If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
@@ -7762,7 +7784,7 @@ Public Class ClsPaginas
'Else 'Else
' retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing) ' retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing)
'End If 'End If
retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing) retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing, SubReportData:=SubReportData)
Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio)) Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio))
If Guardar Then If Guardar Then
@@ -7792,7 +7814,7 @@ Public Class ClsPaginas
'Else 'Else
' retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing) ' retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing)
'End If 'End If
retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing) retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing, SubReportData:=SubReportData)
End If End If
Catch ex As Exception Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex)) GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
@@ -7831,12 +7853,12 @@ Public Class ClsPaginas
End If End If
'SITIO DE PRUEBA EN IIS 'SITIO DE PRUEBA EN IIS
Dim Url = New Uri(String.Format("{0}{1}", "http://localhost:2202/", Opcion)) Dim Url = New Uri(String.Format("{0}{1}", "http://localhost:2202/", Opcion))
Try Try
Dim dataSourceArray As New JArray() Dim dataSourceArray As New JArray()
Dim paramsArray As New JArray() Dim paramsArray As New JArray()
For Each rds As ReportDataSource In DataSource For Each rds As ReportDataSource In DataSource
dataSourceArray.Add(New JObject(New JProperty("Nombre", rds.Name), New JProperty("Valor", JArray.Parse(JsonConvert.SerializeObject(rds.Value))))) dataSourceArray.Add(New JObject(New JProperty("Nombre", rds.Name), New JProperty("Valor", JArray.Parse(JsonConvert.SerializeObject(rds.Value)))))
Next Next
@@ -7850,10 +7872,10 @@ Public Class ClsPaginas
New JProperty("ruta", RutaReporte), New JProperty("ruta", RutaReporte),
New JProperty("parametros", paramsArray), New JProperty("parametros", paramsArray),
New JProperty("dataSource", dataSourceArray) New JProperty("dataSource", dataSourceArray)
) )
Dim data = New StringContent(payload.ToString(), Encoding.UTF8, "application/json") Dim data = New StringContent(payload.ToString(), Encoding.UTF8, "application/json")
Using httpClient = New HttpClient() Using httpClient = New HttpClient()
Using request = New HttpRequestMessage(HttpMethod.Post, Url) Using request = New HttpRequestMessage(HttpMethod.Post, Url)
'request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks))) 'request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks)))
@@ -7863,10 +7885,10 @@ Public Class ClsPaginas
Bytes = response.Content.ReadAsByteArrayAsync().Result Bytes = response.Content.ReadAsByteArrayAsync().Result
End If End If
End Using End Using
End Using End Using
Catch ex As Exception Catch ex As Exception
OnError("Ocurrió un error al descargar la factura", ex) OnError("Ocurrió un error al descargar la factura", ex)
End Try End Try
sw.Stop() sw.Stop()
@@ -8918,49 +8940,92 @@ Public Class ClsPaginas
Dim namespaces As New XmlNamespaceManager(XmlDoc.NameTable) Dim namespaces As New XmlNamespaceManager(XmlDoc.NameTable)
Dim Prefijo As String = If(XmlDoc.DocumentElement.Prefix = "", "cfd", XmlDoc.DocumentElement.Prefix) Dim Prefijo As String = If(XmlDoc.DocumentElement.Prefix = "", "cfd", XmlDoc.DocumentElement.Prefix)
Dim cfdVer As String = "" Dim cfdVer As String = ""
Dim PagoVersion As String = "pago20"
Dim validaElemento = XmlDoc.DocumentElement("cfdi:Complemento") Dim validaElemento = XmlDoc.DocumentElement("cfdi:Complemento")
Dim validaElementoPago = XmlDoc.DocumentElement("cfdi:Conceptos") Dim validaElementoPago = XmlDoc.DocumentElement("cfdi:Conceptos")
If Version = "3.3" Then If Version = "3.3" Then
cfdVer = "http://www.sat.gob.mx/cfd/3" cfdVer = "http://www.sat.gob.mx/cfd/3"
namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos10")
PagoVersion = "pago10"
Else ' se considera que es la version 4.0 Else ' se considera que es la version 4.0
cfdVer = "http://www.sat.gob.mx/cfd/4" cfdVer = "http://www.sat.gob.mx/cfd/4"
namespaces.AddNamespace("pago20", "http://www.sat.gob.mx/Pagos20")
End If End If
namespaces.AddNamespace(Prefijo, cfdVer) namespaces.AddNamespace(Prefijo, cfdVer)
namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital")
namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal")
namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal") namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal")
namespaces.AddNamespace("pago20", "http://www.sat.gob.mx/Pagos20")
'Datos Fiscales 'Datos Fiscales
If Not IsNothing(validaElemento) Then If Not IsNothing(validaElemento) Then
For i As Integer = 0 To XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes.Count - 1 Dim nodetfd As XmlNode = XmlDoc.SelectSingleNode(String.Format("{0}:Comprobante/{0}:Complemento/tfd:TimbreFiscalDigital", Prefijo), namespaces)
If XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Name = "tfd:TimbreFiscalDigital" Then If nodetfd Is Nothing Then
FolioFiscal = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("UUID").InnerText FolioFiscal = nodetfd.Attributes("UUID").InnerText
NoSerieCertificado = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("NoCertificadoSAT").InnerText NoSerieCertificado = nodetfd.Attributes("NoCertificadoSAT").InnerText
FechaCertificacion = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("FechaTimbrado").InnerText FechaCertificacion = nodetfd.Attributes("FechaTimbrado").InnerText
SelloCFDi = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("SelloCFD").InnerText SelloCFDi = nodetfd.Attributes("SelloCFD").InnerText
SelloSAT = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("SelloSAT").InnerText SelloSAT = nodetfd.Attributes("SelloSAT").InnerText
End If End If
Next
End If End If
'Pago 'Pago10
If Not IsNothing(validaElemento) Then If Version = "3.3" AndAlso Not IsNothing(validaElemento) Then
Dim PagosChild = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes.Cast(Of XmlNode).Where(Function(a) a.LocalName.Equals("Pagos", StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault() Dim PagosChild = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes.Cast(Of XmlNode).Where(Function(a) a.LocalName.Equals("Pagos", StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault()
For Each Pagos As XmlNode In PagosChild.ChildNodes
Dim Dr As DataRow = DTConceptosPago.NewRow
If Not Pagos.Attributes("CtaOrdenante") Is Nothing Then Dr("CtaOrdenante") = Pagos.Attributes("CtaOrdenante").Value Else Dr("CtaOrdenante") = ""
If Not Pagos.Attributes("TipoCambioP") Is Nothing Then Dr("TipoCambioP") = Pagos.Attributes("TipoCambioP").Value Else Dr("TipoCambioP") = ""
If Not Pagos.Attributes("RfcEmisorCtaOrd") Is Nothing Then
Dr("RfcEmisorCtaOrd") = Pagos.Attributes("RfcEmisorCtaOrd").Value
RFCOrdenante = Pagos.Attributes("RfcEmisorCtaOrd").Value
Else
Dr("RfcEmisorCtaOrd") = ""
End If
Dr("Monto") = Pagos.Attributes("Monto").Value
Dr("MonedaP") = Pagos.Attributes("MonedaP").Value
Dr("FormaDePagoP") = GlobalDTVtaFormaPago.FiltroPrimeroValor("FormaPagoSAT", $"ClaveFormaPagoSAT= '{Pagos.Attributes("FormaDePagoP").Value}'")
Dr("FechaPago") = Pagos.Attributes("FechaPago").Value
FechaRecibo = Pagos.Attributes("FechaPago").Value
TotalLetra = Pagos.Attributes("Monto").Value.ToString.ToDouble.Texto2Letras(CveMoneda)
DTConceptosPago.Rows.Add(Dr)
For Each Relacionado As XmlNode In Pagos.ChildNodes
Dim DrRelacionado As DataRow = DTConceptosPagoRelacionado.NewRow
If Not Relacionado.Attributes("Folio") Is Nothing Then DrRelacionado("Folio") = Relacionado.Attributes("Folio").Value Else DrRelacionado("Folio") = ""
If Not Relacionado.Attributes("Serie") Is Nothing Then DrRelacionado("Serie") = Relacionado.Attributes("Serie").Value Else DrRelacionado("Serie") = ""
If Not Relacionado.Attributes("TipoCambioDR") Is Nothing Then DrRelacionado("TipoCambioDR") = Relacionado.Attributes("TipoCambioDR").Value Else DrRelacionado("TipoCambioDR") = ""
DrRelacionado("IdDocumento") = Relacionado.Attributes("IdDocumento").Value
DrRelacionado("ImpPagado") = Relacionado.Attributes("ImpPagado").Value
DrRelacionado("ImpSaldoAnt") = Relacionado.Attributes("ImpSaldoAnt").Value
DrRelacionado("NumParcialidad") = Relacionado.Attributes("NumParcialidad").Value
DrRelacionado("MetodoDePagoDR") = Relacionado.Attributes("MetodoDePagoDR").Value
DrRelacionado("MonedaDR") = Relacionado.Attributes("MonedaDR").Value
DTConceptosPagoRelacionado.Rows.Add(DrRelacionado)
Next
Next
End If
'Pago20
If Version = "4.0" Then
Dim nodePagos As XmlNodeList Dim nodePagos As XmlNodeList
If Version = "3.3" Then nodePagos = XmlDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Complemento/pago20:Pagos/pago20:Pago", Prefijo), namespaces)
nodePagos = XmlDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Complemento/pago10:Pago", Prefijo), namespaces)
Else
nodePagos = XmlDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Complemento/pago20:Pagos/pago20:Pago", Prefijo), namespaces)
End If
For Each Pagos As XmlNode In nodePagos For Each Pagos As XmlNode In nodePagos
If Version = "4.0" AndAlso Pagos.Name = "pago20:Totales" Then If Version = "4.0" AndAlso Pagos.Name = "pago20:Totales" Then
Dim a As String = "a" Dim a As String = "a"
Else Else
Dim Dr As DataRow = DTConceptosPago.NewRow Dim Dr As DataRow = DTConceptosPago.NewRow
If Not Pagos.Attributes("CtaOrdenante") Is Nothing Then Dr("CtaOrdenante") = Pagos.Attributes("CtaOrdenante").Value Else Dr("CtaOrdenante") = "" If Not Pagos.Attributes("CtaOrdenante") Is Nothing Then Dr("CtaOrdenante") = Pagos.Attributes("CtaOrdenante").Value Else Dr("CtaOrdenante") = ""
@@ -8983,7 +9048,7 @@ Public Class ClsPaginas
DTConceptosPago.Rows.Add(Dr) DTConceptosPago.Rows.Add(Dr)
For Each Relacionado As XmlNode In Pagos.SelectNodes("//pago20:DoctoRelacionado", namespaces) For Each Relacionado As XmlNode In Pagos.SelectNodes(String.Format("//{0}:DoctoRelacionado", PagoVersion), namespaces)
Dim DrRelacionado As DataRow = DTConceptosPagoRelacionado.NewRow Dim DrRelacionado As DataRow = DTConceptosPagoRelacionado.NewRow
If Not Relacionado.Attributes("Folio") Is Nothing Then DrRelacionado("Folio") = Relacionado.Attributes("Folio").Value Else DrRelacionado("Folio") = "" If Not Relacionado.Attributes("Folio") Is Nothing Then DrRelacionado("Folio") = Relacionado.Attributes("Folio").Value Else DrRelacionado("Folio") = ""
@@ -8994,7 +9059,7 @@ Public Class ClsPaginas
DrRelacionado("ImpPagado") = Relacionado.Attributes("ImpPagado").Value DrRelacionado("ImpPagado") = Relacionado.Attributes("ImpPagado").Value
DrRelacionado("ImpSaldoAnt") = Relacionado.Attributes("ImpSaldoAnt").Value DrRelacionado("ImpSaldoAnt") = Relacionado.Attributes("ImpSaldoAnt").Value
DrRelacionado("NumParcialidad") = Relacionado.Attributes("NumParcialidad").Value DrRelacionado("NumParcialidad") = Relacionado.Attributes("NumParcialidad").Value
If Version = "3.3" Then DrRelacionado("MetodoDePagoDR") = Relacionado.Attributes("MetodoDePagoDR").Value ' If Version = "3.3" Then DrRelacionado("MetodoDePagoDR") = Relacionado.Attributes("MetodoDePagoDR").Value
If Version = "4.0" Then DrRelacionado("ObjetoImpDR") = Relacionado.Attributes("ObjetoImpDR").Value If Version = "4.0" Then DrRelacionado("ObjetoImpDR") = Relacionado.Attributes("ObjetoImpDR").Value
DrRelacionado("MonedaDR") = Relacionado.Attributes("MonedaDR").Value DrRelacionado("MonedaDR") = Relacionado.Attributes("MonedaDR").Value
@@ -9008,16 +9073,18 @@ Public Class ClsPaginas
End If End If
If Not IsNothing(validaElementoPago) Then If Not IsNothing(validaElementoPago) Then
For i As Integer = 0 To XmlDoc.DocumentElement("cfdi:Conceptos").ChildNodes.Count - 1
If XmlDoc.DocumentElement("cfdi:Conceptos").ChildNodes(i).Name = "cfdi:Concepto" Then Dim nodeconceptos As XmlNode = XmlDoc.SelectSingleNode(String.Format("//{0}:Comprobante/{0}:Conceptos", Prefijo), namespaces)
Importe = XmlDoc.DocumentElement("cfdi:Conceptos").ChildNodes(i).Attributes("Importe").InnerText If nodeconceptos.HasChildNodes Then
PU = XmlDoc.DocumentElement("cfdi:Conceptos").ChildNodes(i).Attributes("ValorUnitario").InnerText Dim nodeconcepto As XmlNode = nodeconceptos.ChildNodes(0)
Descripcion = XmlDoc.DocumentElement("cfdi:Conceptos").ChildNodes(i).Attributes("Descripcion").InnerText Importe = nodeconcepto.Attributes("Importe").InnerText
CveUnidad = XmlDoc.DocumentElement("cfdi:Conceptos").ChildNodes(i).Attributes("ClaveUnidad").InnerText PU = nodeconcepto.Attributes("ValorUnitario").InnerText
Cantidad = XmlDoc.DocumentElement("cfdi:Conceptos").ChildNodes(i).Attributes("Cantidad").InnerText Descripcion = nodeconcepto.Attributes("Descripcion").InnerText
CvePS = XmlDoc.DocumentElement("cfdi:Conceptos").ChildNodes(i).Attributes("ClaveProdServ").InnerText CveUnidad = nodeconcepto.Attributes("ClaveUnidad").InnerText
End If Cantidad = nodeconcepto.Attributes("Cantidad").InnerText
Next CvePS = nodeconcepto.Attributes("ClaveProdServ").InnerText
End If
End If End If
Dim CadenaOriginal As String = $"||1.0| {FolioFiscal} | {FechaCertificacion.ToDate.ToShortDateString} T {FechaCertificacion.ToDateTime.ToShortTimeString} | {SelloCFDi} | {NoSerieCertificado} ||" Dim CadenaOriginal As String = $"||1.0| {FolioFiscal} | {FechaCertificacion.ToDate.ToShortDateString} T {FechaCertificacion.ToDateTime.ToShortTimeString} | {SelloCFDi} | {NoSerieCertificado} ||"
@@ -9055,32 +9122,21 @@ Public Class ClsPaginas
'LOGO 'LOGO
Dim LogoRuta As String = "" Dim LogoRuta As String = ""
'LogoRuta = String.Format("{0}Logo.png", UsuarioActual.Empresa.Ruta)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
If Imagen.Exists Then If Imagen.Exists Then ''POR EMPRESA
'If File.Exists(LogoRuta) Then
' LogoRuta = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
'End If
''POR EMPRESA
params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}")) params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
Else Else
params.Add(New ReportParameter("LogoPath", "")) params.Add(New ReportParameter("LogoPath", ""))
End If End If
If File.Exists($"{UsuarioActual.Empresa.Ruta}Formatos\ReciboDePago.rdlc") Then If File.Exists($"{UsuarioActual.Empresa.Ruta}Formatos\ReciboDePago.rdlc") Then
rutaArchivo = $"{UsuarioActual.Empresa.Ruta}Formatos\ReciboDePago.rdlc" rutaArchivo = $"{UsuarioActual.Empresa.Ruta}Formatos\ReciboDePago.rdlc"
Else Else
rutaArchivo = " \Empresas\Grales\Formatos\ReciboDePago.rdlc" rutaArchivo = " \Empresas\Grales\Formatos\ReciboDePago.rdlc"
End If End If
If Not Directory.Exists($"{UsuarioActual.Empresa.Ruta}\PDF\Pag\") Then If Not Directory.Exists($"{UsuarioActual.Empresa.Ruta}\PDF\Pag\") Then Directory.CreateDirectory($"{UsuarioActual.Empresa.Ruta}\PDF\Pag\")
Directory.CreateDirectory($"{UsuarioActual.Empresa.Ruta}\PDF\Pag\")
End If
Dim ArchivoPDF As New System.IO.FileInfo($"{Ruta}PDF\Pag\{Serie}-{Folio}.pdf") Dim ArchivoPDF As New System.IO.FileInfo($"{Ruta}PDF\Pag\{Serie}-{Folio}.pdf")
If ArchivoPDF.Exists Then If ArchivoPDF.Exists Then
@@ -9104,6 +9160,7 @@ Public Class ClsPaginas
ObjClientes.Dispose() ObjClientes.Dispose()
End Sub End Sub
#End Region #End Region
Public Sub CargarCentrosDeCosto(DdlProyecto As DropDownList, DdlSubProyecto As DropDownList, LthProyectoP As Label, LblSubProyecto As Label, Optional AplicaTodos As String = "Todos", Optional DdlSubProyectoMultiple As ListBox = Nothing) Public Sub CargarCentrosDeCosto(DdlProyecto As DropDownList, DdlSubProyecto As DropDownList, LthProyectoP As Label, LblSubProyecto As Label, Optional AplicaTodos As String = "Todos", Optional DdlSubProyectoMultiple As ListBox = Nothing)

View File

@@ -35,6 +35,20 @@ Namespace Modelos
Public Property CveEmpresa As Integer Public Property CveEmpresa As Integer
End Class End Class
<Serializable>
Public Class MSubReportData
Public Sub New()
Me.Nombre = ""
Me.SerieFolio = ""
Me.Parametros = New List(Of ReportParameter)
Me.DataSources = New List(Of ReportDataSource)
End Sub
Public Property Nombre As String
Public Property SerieFolio As String
Public Property Parametros As List(Of ReportParameter)
Public Property DataSources As List(Of ReportDataSource)
End Class
Public Class Evento Public Class Evento
Public Sub New() Public Sub New()

View File

@@ -3833,7 +3833,7 @@ Public Class Timbrado
y += 1 y += 1
Next Next
comprobante.Impuestos.TotalImpuestosTrasladados = ObjCFDITimbre.TotalImpuestosTrasladados comprobante.Impuestos.TotalImpuestosTrasladados = ObjCFDITimbre.TotalImpuestosTrasladados.RoundSQL(6)
comprobante.Impuestos.TotalImpuestosTrasladadosSpecified = True comprobante.Impuestos.TotalImpuestosTrasladadosSpecified = True
If ObjCFDITimbre.TotalImpuestosRetenidos > 0 Then If ObjCFDITimbre.TotalImpuestosRetenidos > 0 Then
@@ -3940,8 +3940,8 @@ Public Class Timbrado
End If End If
ComExt.Emisor.Domicilio.MunicipioSpecified = True ComExt.Emisor.Domicilio.MunicipioSpecified = True
ComExt.Emisor.Domicilio.Municipio = ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Municipio ComExt.Emisor.Domicilio.Municipio = ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Municipio
ComExt.Emisor.Domicilio.NumeroExterior = ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroExterior If ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroExterior <> "" Then ComExt.Emisor.Domicilio.NumeroExterior = ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroExterior
ComExt.Emisor.Domicilio.NumeroInterior = ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroInterior If ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroInterior <> "" Then ComExt.Emisor.Domicilio.NumeroInterior = ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroInterior
ComExt.Emisor.Domicilio.Pais = ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Pais ComExt.Emisor.Domicilio.Pais = ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Pais
If ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Referencia <> "" Then If ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Referencia <> "" Then
ComExt.Emisor.Domicilio.Referencia = ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Referencia ComExt.Emisor.Domicilio.Referencia = ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Referencia
@@ -4108,19 +4108,19 @@ Public Class Timbrado
Dim Totales As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosTotales() Dim Totales As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosTotales()
'Totales Generales 'Totales Generales
Totales.MontoTotalPagos = ObjCFDITimbre.ComplementoPagos.Totales.MontoTotalPagos Totales.MontoTotalPagos = ObjCFDITimbre.ComplementoPagos.Totales.MontoTotalPagos.RoundSQL
Totales.TotalTrasladosBaseIVA16 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA16 Totales.TotalTrasladosBaseIVA16 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA16.RoundSQL
Totales.TotalTrasladosBaseIVA16Specified = Totales.TotalTrasladosBaseIVA16 > 0 Totales.TotalTrasladosBaseIVA16Specified = Totales.TotalTrasladosBaseIVA16 > 0
Totales.TotalTrasladosImpuestoIVA16 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosImpuestoIVA16.RoundSQL Totales.TotalTrasladosImpuestoIVA16 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosImpuestoIVA16.RoundSQL
Totales.TotalTrasladosImpuestoIVA16Specified = Totales.TotalTrasladosBaseIVA16 > 0 Totales.TotalTrasladosImpuestoIVA16Specified = Totales.TotalTrasladosBaseIVA16 > 0
Totales.TotalTrasladosBaseIVA8 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA8 Totales.TotalTrasladosBaseIVA8 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA8.RoundSQL
Totales.TotalTrasladosBaseIVA8Specified = Totales.TotalTrasladosBaseIVA8 > 0 Totales.TotalTrasladosBaseIVA8Specified = Totales.TotalTrasladosBaseIVA8 > 0
Totales.TotalTrasladosImpuestoIVA8 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA8.RoundSQL Totales.TotalTrasladosImpuestoIVA8 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA8.RoundSQL
Totales.TotalTrasladosImpuestoIVA8Specified = Totales.TotalTrasladosBaseIVA8 > 0 Totales.TotalTrasladosImpuestoIVA8Specified = Totales.TotalTrasladosBaseIVA8 > 0
Totales.TotalTrasladosBaseIVA0 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA0 Totales.TotalTrasladosBaseIVA0 = ObjCFDITimbre.ComplementoPagos.Totales.TotalTrasladosBaseIVA0.RoundSQL
Totales.TotalTrasladosBaseIVA0Specified = Totales.TotalTrasladosBaseIVA0 > 0 Totales.TotalTrasladosBaseIVA0Specified = Totales.TotalTrasladosBaseIVA0 > 0
Totales.TotalTrasladosImpuestoIVA0 = 0 Totales.TotalTrasladosImpuestoIVA0 = 0
Totales.TotalTrasladosImpuestoIVA0Specified = Totales.TotalTrasladosBaseIVA0 > 0 Totales.TotalTrasladosImpuestoIVA0Specified = Totales.TotalTrasladosBaseIVA0 > 0
@@ -4150,26 +4150,6 @@ Public Class Timbrado
If doc.Impuestos IsNot Nothing Then If doc.Impuestos IsNot Nothing Then
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDR ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDR
''traslados
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then
Dim j As Integer = 0
For Each docimp As CFDIConceptosImpuestos In doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "T")
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.TrasladosDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "T").Count - 1) {}
If docimp.TrasladooRetencion = "T" Then
Dim Tra As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR
Tra.BaseDR = docimp.Base
Tra.ImporteDRSpecified = True
Tra.ImporteDR = docimp.Importe
Tra.ImpuestoDR = docimp.Impuesto
Tra.TipoFactorDR = docimp.TipoFactor
Tra.TasaOCuotaDRSpecified = True
Tra.TasaOCuotaDR = docimp.TasaOCuota
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.TrasladosDR(j) = Tra
End If
j += 1
Next
End If
''retenciones ''retenciones
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then
@@ -4178,36 +4158,41 @@ Public Class Timbrado
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.RetencionesDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRRetencionDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "R").Count - 1) {} ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.RetencionesDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRRetencionDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "R").Count - 1) {}
If docimp.TrasladooRetencion = "R" Then If docimp.TrasladooRetencion = "R" Then
Dim Tra As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRRetencionDR Dim Tra As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRRetencionDR
Tra.BaseDR = docimp.Base Tra.BaseDR = docimp.Base.RoundSQL(6)
Tra.ImporteDR = docimp.Importe Tra.ImporteDR = docimp.Importe.RoundSQL(6)
Tra.ImpuestoDR = docimp.Impuesto Tra.ImpuestoDR = docimp.Impuesto
Tra.TipoFactorDR = docimp.TipoFactor Tra.TipoFactorDR = docimp.TipoFactor
Tra.TasaOCuotaDR = docimp.TasaOCuota Tra.TasaOCuotaDR = docimp.TasaOCuota.RoundSQL(6)
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.RetencionesDR(j) = Tra ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.RetencionesDR(j) = Tra
End If End If
j += 1 j += 1
Next Next
End If End If
''traslados
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then
Dim j As Integer = 0
For Each docimp As CFDIConceptosImpuestos In doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "T")
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.TrasladosDR = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR(doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "T").Count - 1) {}
If docimp.TrasladooRetencion = "T" Then
Dim Tra As New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoDoctoRelacionadoImpuestosDRTrasladoDR
Tra.BaseDR = docimp.Base.RoundSQL(6)
Tra.ImporteDRSpecified = True
Tra.ImporteDR = docimp.Importe.RoundSQL(6)
Tra.ImpuestoDR = docimp.Impuesto
Tra.TipoFactorDR = docimp.TipoFactor
Tra.TasaOCuotaDRSpecified = True
Tra.TasaOCuotaDR = docimp.TasaOCuota.RoundSQL(6)
ComPag.Pago(0).DoctoRelacionado(i).ImpuestosDR.TrasladosDR(j) = Tra
End If
j += 1
Next
End If
End If End If
i += 1 i += 1
Next Next
If ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then
Dim x As Integer
ComPag.Pago(0).ImpuestosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP(0) {}
ComPag.Pago(0).ImpuestosP(0) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP()
ComPag.Pago(0).ImpuestosP(0).TrasladosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP((ObjCFDITimbre.ComplementoPagos.Traslados).Count - 1) {}
For Each Tra As CFDITraslados In (ObjCFDITimbre.ComplementoPagos.Traslados)
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP()
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImpuestoP = Tra.Impuesto
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TipoFactorP = Tra.TipoFactor
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TasaOCuotaP = Tra.TasaOCuota
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImporteP = Tra.Importe
ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).BaseP = Tra.Base
x += 1
Next
End If
If (ObjCFDITimbre.ComplementoPagos.Retenciones).Count > 0 Then If (ObjCFDITimbre.ComplementoPagos.Retenciones).Count > 0 Then
Dim x As Integer Dim x As Integer
If ComPag.Pago(0).ImpuestosP(0) Is Nothing Then ComPag.Pago(0).ImpuestosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP(0) {} If ComPag.Pago(0).ImpuestosP(0) Is Nothing Then ComPag.Pago(0).ImpuestosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP(0) {}
@@ -4220,41 +4205,59 @@ Public Class Timbrado
Next Next
End If End If
If ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then
''Estos impuestos aplicarían para anticipos Dim x As Integer
'If ObjCFDITimbre.ComplementoPagos.tota > 0 OrElse ObjCFDITimbre.ComplementoPagos.TotalImpuestosTrasladados > 0 Then ComPag.Pago(0).ImpuestosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP(0) {}
' ComPag.Pago(0).ImpuestosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP(0) {} ComPag.Pago(0).ImpuestosP(0) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP()
' ComPag.Pago(0).ImpuestosP(0) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP() ComPag.Pago(0).ImpuestosP(0).TrasladosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP((ObjCFDITimbre.ComplementoPagos.Traslados).Count - 1) {}
For Each Tra As CFDITraslados In (ObjCFDITimbre.ComplementoPagos.Traslados)
' If (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then ComPag.Pago(0).ImpuestosP(0).TrasladosP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP()
' Dim x As Integer ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImpuestoP = Tra.Impuesto
' ComPag.Pago(0).ImpuestosP(0).TrasladosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP((ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "T").Count - 1) {} ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TipoFactorP = Tra.TipoFactor
' For Each Tra As CFDIConceptosImpuestos In (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "T") ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TasaOCuotaP = Tra.TasaOCuota.RoundSQL(6)
' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP() ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImporteP = Tra.Importe.RoundSQL(6)
' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImpuestoP = Tra.Impuesto ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).BaseP = Tra.Base.RoundSQL(6)
' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TipoFactorP = Tra.TipoFactor x += 1
' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TasaOCuotaP = Tra.TasaOCuota Next
' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImporteP = Tra.Importe End If
' x += 1
' Next
' End If
' If (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then
' Dim x As Integer
' ComPag.Pago(0).ImpuestosP(0).RetencionesP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP((ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "R").Count - 1) {}
' For Each Ret As CFDIConceptosImpuestos In (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "R")
' ComPag.Pago(0).ImpuestosP(0).RetencionesP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP()
' ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImpuestoP = Ret.Impuesto
' ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImporteP = Ret.Importe
' x += 1
' Next
' End If
'End If
Dim nsComp As New System.Xml.Serialization.XmlSerializerNamespaces() ''Estos impuestos aplicarían para anticipos
'If ObjCFDITimbre.ComplementoPagos.tota > 0 OrElse ObjCFDITimbre.ComplementoPagos.TotalImpuestosTrasladados > 0 Then
' ComPag.Pago(0).ImpuestosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP(0) {}
' ComPag.Pago(0).ImpuestosP(0) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosP()
' If (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then
' Dim x As Integer
' ComPag.Pago(0).ImpuestosP(0).TrasladosP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP((ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "T").Count - 1) {}
' For Each Tra As CFDIConceptosImpuestos In (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "T")
' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPTrasladoP()
' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImpuestoP = Tra.Impuesto
' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TipoFactorP = Tra.TipoFactor
' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).TasaOCuotaP = Tra.TasaOCuota
' ComPag.Pago(0).ImpuestosP(0).TrasladosP(x).ImporteP = Tra.Importe
' x += 1
' Next
' End If
' If (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then
' Dim x As Integer
' ComPag.Pago(0).ImpuestosP(0).RetencionesP = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP((ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "R").Count - 1) {}
' For Each Ret As CFDIConceptosImpuestos In (ObjCFDITimbre.ComplementoPagos.Impuestos).Where(Function(w) w.TrasladooRetencion = "R")
' ComPag.Pago(0).ImpuestosP(0).RetencionesP(x) = New Profact.TimbraCFDI40.Complementos.Pagos20.PagosPagoImpuestosPRetencionP()
' ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImpuestoP = Ret.Impuesto
' ComPag.Pago(0).ImpuestosP(0).RetencionesP(x).ImporteP = Ret.Importe
' x += 1
' Next
' End If
'End If
Dim nsComp As New System.Xml.Serialization.XmlSerializerNamespaces()
nsComp.Add("pago20", "http://www.sat.gob.mx/Pagos20") nsComp.Add("pago20", "http://www.sat.gob.mx/Pagos20")
Dim xmlComp As String = Profact.TimbraCFDI.XMLUtilerias.SerializaObjeto(ComPag, GetType(Profact.TimbraCFDI40.Complementos.Pagos20.Pagos), nsComp) Dim xmlComp As String = Profact.TimbraCFDI.XMLUtilerias.SerializaObjeto(ComPag, GetType(Profact.TimbraCFDI40.Complementos.Pagos20.Pagos), nsComp)
Dim docComp As New XmlDocument() Dim docComp As New XmlDocument()
@@ -4294,7 +4297,7 @@ Public Class Timbrado
ComCartaPorte.Ubicaciones(i).IDUbicacion = ubica.IDUbicacion ComCartaPorte.Ubicaciones(i).IDUbicacion = ubica.IDUbicacion
ComCartaPorte.Ubicaciones(i).RFCRemitenteDestinatario = ubica.RFCRemitenteDestinatario ComCartaPorte.Ubicaciones(i).RFCRemitenteDestinatario = ubica.RFCRemitenteDestinatario
ComCartaPorte.Ubicaciones(i).NombreRemitenteDestinatario = ubica.NombreRemitenteDestinatario ComCartaPorte.Ubicaciones(i).NombreRemitenteDestinatario = ubica.NombreRemitenteDestinatario
ComCartaPorte.Ubicaciones(i).NumRegIdTrib = ubica.NumRegIdTrib If ubica.NumRegIdTrib <> "" Then ComCartaPorte.Ubicaciones(i).NumRegIdTrib = ubica.NumRegIdTrib
'ComCartaPorte.Ubicaciones(i).ResidenciaFiscal = ubica.ResidenciaFiscal 'ComCartaPorte.Ubicaciones(i).ResidenciaFiscal = ubica.ResidenciaFiscal
'ComCartaPorte.Ubicaciones(i).NumEstacion = ubica.NumEstacion 'ComCartaPorte.Ubicaciones(i).NumEstacion = ubica.NumEstacion
'ComCartaPorte.Ubicaciones(i).NavegacionTrafico = ubica.NavegacionTrafico 'ComCartaPorte.Ubicaciones(i).NavegacionTrafico = ubica.NavegacionTrafico
@@ -4302,16 +4305,17 @@ Public Class Timbrado
ComCartaPorte.Ubicaciones(i).DistanciaRecorrida = ubica.DistanciaRecorrida ComCartaPorte.Ubicaciones(i).DistanciaRecorrida = ubica.DistanciaRecorrida
ComCartaPorte.Ubicaciones(i).Domicilio = New ProfactCartaPorte.CartaPorteUbicacionDomicilio With {.Calle = ubica.Domicilio.Calle, ComCartaPorte.Ubicaciones(i).Domicilio = New ProfactCartaPorte.CartaPorteUbicacionDomicilio With {.Calle = ubica.Domicilio.Calle,
.NumeroExterior = ubica.Domicilio.NumeroExterior,
.NumeroInterior = ubica.Domicilio.NumeroInterior,
.Colonia = ubica.Domicilio.Colonia, .Colonia = ubica.Domicilio.Colonia,
.Localidad = ubica.Domicilio.Localidad, .Localidad = ubica.Domicilio.Localidad,
.Referencia = ubica.Domicilio.Referencia,
.Municipio = ubica.Domicilio.Municipio, .Municipio = ubica.Domicilio.Municipio,
.Estado = ubica.Domicilio.Estado, .Estado = ubica.Domicilio.Estado,
.CodigoPostal = ubica.Domicilio.CP, .CodigoPostal = ubica.Domicilio.CP,
.Pais = CType([Enum].Parse(GetType(ProfactCartaPorte.c_Pais), ubica.Domicilio.Pais), ProfactCartaPorte.c_Pais)} .Pais = CType([Enum].Parse(GetType(ProfactCartaPorte.c_Pais), ubica.Domicilio.Pais), ProfactCartaPorte.c_Pais)}
If ubica.Domicilio.Referencia <> "" Then ComCartaPorte.Ubicaciones(i).Domicilio.Referencia = ubica.Domicilio.Referencia
If ubica.Domicilio.NumeroExterior <> "" Then ComCartaPorte.Ubicaciones(i).Domicilio.NumeroExterior = ubica.Domicilio.NumeroExterior
If ubica.Domicilio.NumeroInterior <> "" Then ComCartaPorte.Ubicaciones(i).Domicilio.NumeroInterior = ubica.Domicilio.NumeroInterior
i += 1
Next Next
End If End If
@@ -4338,7 +4342,7 @@ Public Class Timbrado
ComCartaPorte.Mercancias.Mercancia(i).Descripcion = concep.Descripción ComCartaPorte.Mercancias.Mercancia(i).Descripcion = concep.Descripción
ComCartaPorte.Mercancias.Mercancia(i).Cantidad = concep.Cantidad ComCartaPorte.Mercancias.Mercancia(i).Cantidad = concep.Cantidad
ComCartaPorte.Mercancias.Mercancia(i).Unidad = concep.Unidad ComCartaPorte.Mercancias.Mercancia(i).Unidad = concep.Unidad
ComCartaPorte.Mercancias.Mercancia(i).Dimensiones = concep.Dimensiones If concep.Dimensiones <> "" Then ComCartaPorte.Mercancias.Mercancia(i).Dimensiones = concep.Dimensiones
If concep.ClaveMaterialPeligroso <> "" Then If concep.ClaveMaterialPeligroso <> "" Then
ComCartaPorte.Mercancias.Mercancia(i).MaterialPeligrosoSpecified = True ComCartaPorte.Mercancias.Mercancia(i).MaterialPeligrosoSpecified = True
ComCartaPorte.Mercancias.Mercancia(i).CveMaterialPeligrosoSpecified = True ComCartaPorte.Mercancias.Mercancia(i).CveMaterialPeligrosoSpecified = True
@@ -4353,7 +4357,7 @@ Public Class Timbrado
ComCartaPorte.Mercancias.Mercancia(i).ValorMercanciaSpecified = False ComCartaPorte.Mercancias.Mercancia(i).ValorMercanciaSpecified = False
ComCartaPorte.Mercancias.Mercancia(i).MonedaSpecified = False ComCartaPorte.Mercancias.Mercancia(i).MonedaSpecified = False
ComCartaPorte.Mercancias.Mercancia(i).FraccionArancelariaSpecified = False ComCartaPorte.Mercancias.Mercancia(i).FraccionArancelariaSpecified = False
ComCartaPorte.Mercancias.Mercancia(i).UUIDComercioExt = concep.UUIDComercioExt If concep.UUIDComercioExt <> "" Then ComCartaPorte.Mercancias.Mercancia(i).UUIDComercioExt = concep.UUIDComercioExt
Dim j As Integer = 0 Dim j As Integer = 0
ComCartaPorte.Mercancias.Mercancia(i).CantidadTransporta = New ProfactCartaPorte.CartaPorteMercanciasMercanciaCantidadTransporta(Carta.Mercancias.Mercancias.Count - 1) {} ComCartaPorte.Mercancias.Mercancia(i).CantidadTransporta = New ProfactCartaPorte.CartaPorteMercanciasMercanciaCantidadTransporta(Carta.Mercancias.Mercancias.Count - 1) {}
@@ -4370,43 +4374,6 @@ Public Class Timbrado
End If End If
End If End If
'If Carta.FiguraTransporte IsNot Nothing Then
' If Carta.FiguraTransporte.AutoTransporte IsNot Nothing Then
' cfdi.CartaPorteAutotransporte(Carta.FiguraTransporte.AutoTransporte.PermisoSCT, Carta.FiguraTransporte.AutoTransporte.NumPermisoSCT)
' cfdi.CartaPorteIdentificacionVehicular(Carta.FiguraTransporte.AutoTransporte.Vehiculo.ConfigVehicular, Carta.FiguraTransporte.AutoTransporte.Vehiculo.PlacaVM, Carta.FiguraTransporte.AutoTransporte.Vehiculo.AnioModeloVM)
' cfdi.CartaPorteSeguros(Carta.FiguraTransporte.AutoTransporte.NombreSeguroResponsabilidadCivil, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroResponsabilidadCivil,
' Carta.FiguraTransporte.AutoTransporte.NombreSeguroMedioAmbiente, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroMedioAmbiente,
' Carta.FiguraTransporte.AutoTransporte.NombreSeguroCarga, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroCarga,
' Carta.FiguraTransporte.AutoTransporte.PrimaSeguro)
' If Carta.FiguraTransporte.AutoTransporte.Remolques IsNot Nothing AndAlso Carta.FiguraTransporte.AutoTransporte.Remolques.Count > 0 Then
' For Each concep As CFDICartaPorteRemolque In Carta.FiguraTransporte.AutoTransporte.Remolques
' cfdi.CartaPorteRemolque(concep.SubTipoRemolque, concep.Placa)
' Next
' End If
' End If
' If Carta.FiguraTransporte.Operadores IsNot Nothing AndAlso Carta.FiguraTransporte.Operadores.Count > 0 Then
' For Each concep As CFDICartaPorteOperador In Carta.FiguraTransporte.Operadores
' cfdi.CartaPorteTiposFigura(concep.TipoFigura, concep.RFCFigura, concep.NumLicencia, concep.NombreFigura, concep.NumRegidTribFigura, If(concep.ResidenciaFiscalFigura <> "MEX", concep.ResidenciaFiscalFigura, ""))
' If concep.TipoFigura.Contiene("02", "03") Then ' “02”- Propietario o “03” -Arrendador
' cfdi.CartaPortePartesTransporte("PT01")
' cfdi.CartaPortePartesTransporteDomicilio(concep.Domicilio.Calle, concep.Domicilio.NumeroExterior, concep.Domicilio.NumeroInterior, concep.Domicilio.Colonia, concep.Domicilio.Localidad, concep.Domicilio.Referencia, concep.Domicilio.Municipio, concep.Domicilio.Estado, concep.Domicilio.Pais, concep.Domicilio.CP)
' End If
' Next
' End If
'End If
' '
If Carta.FiguraTransporte IsNot Nothing Then If Carta.FiguraTransporte IsNot Nothing Then
@@ -4419,9 +4386,6 @@ Public Class Timbrado
ComCartaPorte.Mercancias.Autotransporte.PermSCT = CType([Enum].Parse(GetType(ProfactCartaPorte.c_TipoPermiso), Carta.FiguraTransporte.AutoTransporte.PermisoSCT), ProfactCartaPorte.c_TipoPermiso) ComCartaPorte.Mercancias.Autotransporte.PermSCT = CType([Enum].Parse(GetType(ProfactCartaPorte.c_TipoPermiso), Carta.FiguraTransporte.AutoTransporte.PermisoSCT), ProfactCartaPorte.c_TipoPermiso)
End If End If
ComCartaPorte.Mercancias.Autotransporte.NumPermisoSCT = Carta.FiguraTransporte.AutoTransporte.NumPermisoSCT ComCartaPorte.Mercancias.Autotransporte.NumPermisoSCT = Carta.FiguraTransporte.AutoTransporte.NumPermisoSCT
'pendiente RMF
'ComCartaPorte.Mercancias.AutotransporteFederal.NombreAseg = Carta.FiguraTransporte.AutoTransporte.NombreAseg
'ComCartaPorte.Mercancias.AutotransporteFederal.NumPolizaSeguro = Carta.FiguraTransporte.AutoTransporte.NumPolizaSeguro
Dim ConfigVehicular As New ProfactCartaPorte.CartaPorteMercanciasAutotransporteIdentificacionVehicular Dim ConfigVehicular As New ProfactCartaPorte.CartaPorteMercanciasAutotransporteIdentificacionVehicular
ConfigVehicular.ConfigVehicular = CType([Enum].Parse(GetType(ProfactCartaPorte.c_ConfigAutotransporte), Carta.FiguraTransporte.AutoTransporte.Vehiculo.ConfigVehicular), ProfactCartaPorte.c_ConfigAutotransporte) ConfigVehicular.ConfigVehicular = CType([Enum].Parse(GetType(ProfactCartaPorte.c_ConfigAutotransporte), Carta.FiguraTransporte.AutoTransporte.Vehiculo.ConfigVehicular), ProfactCartaPorte.c_ConfigAutotransporte)
@@ -4443,6 +4407,8 @@ Public Class Timbrado
ConfigVehicularSeguros.PrimaSeguroSpecified = True ConfigVehicularSeguros.PrimaSeguroSpecified = True
End If End If
ComCartaPorte.Mercancias.Autotransporte.Seguros = ConfigVehicularSeguros
If Carta.FiguraTransporte.AutoTransporte.Remolques IsNot Nothing AndAlso Carta.FiguraTransporte.AutoTransporte.Remolques.Count > 0 Then If Carta.FiguraTransporte.AutoTransporte.Remolques IsNot Nothing AndAlso Carta.FiguraTransporte.AutoTransporte.Remolques.Count > 0 Then
Dim i As Integer = 0 Dim i As Integer = 0
ComCartaPorte.Mercancias.Autotransporte.Remolques = New ProfactCartaPorte.CartaPorteMercanciasAutotransporteRemolque(Carta.FiguraTransporte.AutoTransporte.Remolques.Count - 1) {} ComCartaPorte.Mercancias.Autotransporte.Remolques = New ProfactCartaPorte.CartaPorteMercanciasAutotransporteRemolque(Carta.FiguraTransporte.AutoTransporte.Remolques.Count - 1) {}
@@ -4465,7 +4431,7 @@ Public Class Timbrado
ComCartaPorte.FiguraTransporte(i).RFCFigura = concep.RFCFigura ComCartaPorte.FiguraTransporte(i).RFCFigura = concep.RFCFigura
ComCartaPorte.FiguraTransporte(i).NumLicencia = concep.NumLicencia ComCartaPorte.FiguraTransporte(i).NumLicencia = concep.NumLicencia
ComCartaPorte.FiguraTransporte(i).NombreFigura = concep.NombreFigura ComCartaPorte.FiguraTransporte(i).NombreFigura = concep.NombreFigura
ComCartaPorte.FiguraTransporte(i).NumRegIdTribFigura = concep.NumRegidTribFigura If concep.NumRegidTribFigura <> "" Then ComCartaPorte.FiguraTransporte(i).NumRegIdTribFigura = concep.NumRegidTribFigura
'OComCartaPorte.FiguraTransporte.Operadores(i)(0) = concep.ResidenciaFiscalOperador 'falta 'OComCartaPorte.FiguraTransporte.Operadores(i)(0) = concep.ResidenciaFiscalOperador 'falta
ComCartaPorte.FiguraTransporte(i).Domicilio = New ProfactCartaPorte.CartaPorteTiposFiguraDomicilio() ComCartaPorte.FiguraTransporte(i).Domicilio = New ProfactCartaPorte.CartaPorteTiposFiguraDomicilio()
@@ -4473,9 +4439,9 @@ Public Class Timbrado
ComCartaPorte.FiguraTransporte(i).Domicilio.CodigoPostal = concep.Domicilio.CP ComCartaPorte.FiguraTransporte(i).Domicilio.CodigoPostal = concep.Domicilio.CP
ComCartaPorte.FiguraTransporte(i).Domicilio.Colonia = concep.Domicilio.Colonia ComCartaPorte.FiguraTransporte(i).Domicilio.Colonia = concep.Domicilio.Colonia
ComCartaPorte.FiguraTransporte(i).Domicilio.Estado = concep.Domicilio.Estado ComCartaPorte.FiguraTransporte(i).Domicilio.Estado = concep.Domicilio.Estado
ComCartaPorte.FiguraTransporte(i).Domicilio.Localidad = concep.Domicilio.Localidad If concep.Domicilio.Localidad <> "" Then ComCartaPorte.FiguraTransporte(i).Domicilio.Localidad = concep.Domicilio.Localidad
ComCartaPorte.FiguraTransporte(i).Domicilio.Municipio = concep.Domicilio.Municipio ComCartaPorte.FiguraTransporte(i).Domicilio.Municipio = concep.Domicilio.Municipio
ComCartaPorte.FiguraTransporte(i).Domicilio.NumeroExterior = concep.Domicilio.NumeroExterior If concep.Domicilio.NumeroExterior <> "" Then ComCartaPorte.FiguraTransporte(i).Domicilio.NumeroExterior = concep.Domicilio.NumeroExterior
ComCartaPorte.FiguraTransporte(i).Domicilio.Pais = ProfactCartaPorte.c_Pais.MEX ComCartaPorte.FiguraTransporte(i).Domicilio.Pais = ProfactCartaPorte.c_Pais.MEX
i += 1 i += 1
@@ -4662,191 +4628,7 @@ Public Class Timbrado
#End Region #End Region
'#Region "Detallista"
' If Ventas.Cliente.AplicaDetallista Then
' Dim detallista As Profact.TimbraCFDI40.Complementos.Detallista.detallista = New Profact.TimbraCFDI40.Complementos.Detallista.detallista
' detallista.type = "SimpleInvoiceType"
' detallista.contentVersion = "1.3.1"
' detallista.documentStructureVersion = "AMC8.1"
' detallista.documentStatus = Profact.TimbraCFDI40.Complementos.Detallista.detallistaDocumentStatus.ORIGINAL
' detallista.DeliveryNote = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaDeliveryNote
' detallista.DeliveryNote.referenceIdentification = New String((1)) {}
' detallista.DeliveryNote.referenceIdentification(0) = "1"
' detallista.DeliveryNote.ReferenceDate = New DateTime
' detallista.DeliveryNote.ReferenceDate = comprobante.Fecha
' detallista.DeliveryNote.ReferenceDateSpecified = True
' detallista.requestForPaymentIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaRequestForPaymentIdentification
' detallista.requestForPaymentIdentification.entityType = Profact.TimbraCFDI40.Complementos.Detallista.detallistaRequestForPaymentIdentificationEntityType.INVOICE
' detallista.specialInstruction = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaSpecialInstruction((1)) {}
' detallista.specialInstruction(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaSpecialInstruction
' detallista.specialInstruction(0).code = Profact.TimbraCFDI40.Complementos.Detallista.detallistaSpecialInstructionCode.ZZZ
' Dim TotalTexto = New String() {Ventas.TotalTC.ToString.ToDouble.Texto2Letras.ToUpper()}
' Dim propertyInfo = detallista.specialInstruction(0).GetType().GetProperty("text")
' propertyInfo.SetValue(detallista.specialInstruction(0), Convert.ChangeType(TotalTexto, propertyInfo.PropertyType), Nothing)
' detallista.orderIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaOrderIdentification
' detallista.orderIdentification.referenceIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaOrderIdentificationReferenceIdentification((1)) {}
' detallista.orderIdentification.referenceIdentification(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaOrderIdentificationReferenceIdentification
' detallista.orderIdentification.referenceIdentification(0).type = Profact.TimbraCFDI40.Complementos.Detallista.detallistaOrderIdentificationReferenceIdentificationType.ON
' detallista.orderIdentification.referenceIdentification(0).Value = Ventas.Det_OrdenCompra
' detallista.orderIdentification.ReferenceDateSpecified = True
' detallista.orderIdentification.ReferenceDate = Ventas.Det_FechaOrdenCompra.ToDate()
' detallista.AdditionalInformation = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaReferenceIdentification((1)) {}
' detallista.AdditionalInformation(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaReferenceIdentification
' detallista.AdditionalInformation(0).type = Profact.TimbraCFDI40.Complementos.Detallista.detallistaReferenceIdentificationType.ATZ
' detallista.AdditionalInformation(0).Value = Ventas.Det_ContraRecibo
' detallista.DeliveryNote = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaDeliveryNote
' detallista.DeliveryNote.ReferenceDate = Ventas.Det_FechaOrdenCompra.ToDate
' detallista.DeliveryNote.referenceIdentification = New String((1)) {}
' detallista.DeliveryNote.referenceIdentification(0) = Ventas.Det_ContraRecibo
' detallista.buyer = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaBuyer
' detallista.buyer.gln = Ventas.Cliente.Detallista_GLNComprador
' detallista.buyer.contactInformation = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaBuyerContactInformation
' detallista.buyer.contactInformation.personOrDepartmentName = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaBuyerContactInformationPersonOrDepartmentName
' detallista.buyer.contactInformation.personOrDepartmentName.text = Ventas.Cliente.Detallista_Departamento
' detallista.seller = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaSeller
' detallista.seller.gln = Ventas.Cliente.Detallista_GLNVendedor
' detallista.seller.alternatePartyIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaSellerAlternatePartyIdentification
' detallista.seller.alternatePartyIdentification.type = Profact.TimbraCFDI40.Complementos.Detallista.detallistaSellerAlternatePartyIdentificationType.SELLER_ASSIGNED_IDENTIFIER_FOR_A_PARTY
' detallista.seller.alternatePartyIdentification.Value = Ventas.Cliente.Detallista_NumProveedor
' 'detallista.shipTo = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaShipTo
' 'detallista.shipTo.gln = "0000000000000"
' 'detallista.shipTo.nameAndAddress = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaShipToNameAndAddress
' 'detallista.shipTo.nameAndAddress.name = New String((1)) {}
' 'detallista.shipTo.nameAndAddress.name(0) = Ventas.Cliente.Direccion
' 'detallista.shipTo.nameAndAddress.streetAddressOne = New String((1)) {}
' 'detallista.shipTo.nameAndAddress.streetAddressOne(0) = Ventas.Cliente.NoInt
' 'detallista.shipTo.nameAndAddress.city = New String((1)) {}
' 'detallista.shipTo.nameAndAddress.city(0) = Ventas.Cliente.Ciudad
' 'detallista.shipTo.nameAndAddress.postalCode = New String((1)) {}
' 'detallista.shipTo.nameAndAddress.postalCode(0) = Ventas.Cliente.CP
' detallista.paymentTerms = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTerms
' detallista.paymentTerms.netPayment = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTermsNetPayment
' detallista.paymentTerms.netPayment.paymentTimePeriod = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriod
' detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriodTimePeriodDue
' detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue.timePeriod = Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTermsNetPaymentPaymentTimePeriodTimePeriodDueTimePeriod.DAYS
' detallista.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue.value = "0"
' detallista.paymentTerms.discountPayment = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaPaymentTermsDiscountPayment
' detallista.paymentTerms.discountPayment.percentage = If(Ventas.DescuentoTC > 0 AndAlso Ventas.SubTotalTC > 0, (Ventas.DescuentoTC * 100) / Ventas.SubTotalTC, 0).ToString().FormatoNumero()
' detallista.currency = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrency((1)) {}
' detallista.currency(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrency
' detallista.currency(0).currencyISOCode = If(Ventas.CveMoneda = 1, Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrencyCurrencyISOCode.MXN, Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrencyCurrencyISOCode.USD)
' detallista.currency(0).currencyFunction = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrencyCurrencyFunction((1)) {}
' detallista.currency(0).currencyFunction(0) = Profact.TimbraCFDI40.Complementos.Detallista.detallistaCurrencyCurrencyFunction.BILLING_CURRENCY
' detallista.currency(0).rateOfChangeSpecified = True
' detallista.currency(0).rateOfChange = 1
' detallista.allowanceCharge = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaAllowanceCharge(1) {}
' detallista.allowanceCharge(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaAllowanceCharge
' detallista.allowanceCharge(0).monetaryAmountOrPercentage = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaAllowanceChargeMonetaryAmountOrPercentage
' detallista.allowanceCharge(0).monetaryAmountOrPercentage.rate = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaAllowanceChargeMonetaryAmountOrPercentageRate
' detallista.allowanceCharge(0).monetaryAmountOrPercentage.rate.base = Profact.TimbraCFDI40.Complementos.Detallista.detallistaAllowanceChargeMonetaryAmountOrPercentageRateBase.INVOICE_VALUE
' detallista.allowanceCharge(0).monetaryAmountOrPercentage.rate.percentage = If(Ventas.DescuentoTC > 0 AndAlso Ventas.SubTotalTC > 0, (Ventas.DescuentoTC * 100) / Ventas.SubTotalTC, 0)
' Dim articuloCounter As Integer = 0
' For Each concepto As Profact.TimbraCFDI40.ComprobanteConcepto In comprobante.Conceptos
' articuloCounter = (articuloCounter + 1)
' Next
' detallista.lineItem = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItem((articuloCounter)) {}
' Dim counter As Integer = 0
' For Each concepto As Profact.TimbraCFDI40.ComprobanteConcepto In comprobante.Conceptos
' detallista.lineItem(counter) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItem
' detallista.lineItem(counter).type = "SimpleInvoiceLineItemType"
' detallista.lineItem(counter).number = (counter + 1).ToString
' detallista.lineItem(counter).tradeItemIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemIdentification
' detallista.lineItem(counter).tradeItemIdentification.gtin = comprobante.Conceptos(counter).NoIdentificacion
' detallista.lineItem(counter).alternateTradeItemIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentification(1) {}
' detallista.lineItem(counter).alternateTradeItemIdentification(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentification
' detallista.lineItem(counter).alternateTradeItemIdentification(0).type = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentificationType
' detallista.lineItem(counter).alternateTradeItemIdentification(0).type = Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAlternateTradeItemIdentificationType.BUYER_ASSIGNED
' detallista.lineItem(counter).tradeItemDescriptionInformation = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemDescriptionInformation
' If (comprobante.Conceptos(counter).Descripcion.Length > 34) Then
' detallista.lineItem(counter).tradeItemDescriptionInformation.longText = comprobante.Conceptos(counter).Descripcion.Substring(0, 34)
' Else
' detallista.lineItem(counter).tradeItemDescriptionInformation.longText = comprobante.Conceptos(counter).Descripcion
' End If
' detallista.lineItem(counter).invoicedQuantity = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemInvoicedQuantity
' detallista.lineItem(counter).invoicedQuantity.unitOfMeasure = comprobante.Conceptos(counter).Unidad
' detallista.lineItem(counter).invoicedQuantity.Text = New String((1)) {}
' detallista.lineItem(counter).invoicedQuantity.Text(0) = comprobante.Conceptos(counter).Cantidad.ToString
' detallista.lineItem(counter).aditionalQuantity = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAditionalQuantity(1) {}
' detallista.lineItem(counter).aditionalQuantity(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAditionalQuantity
' detallista.lineItem(counter).aditionalQuantity(0).QuantityType = Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAditionalQuantityQuantityType.NUM_CONSUMER_UNITS
' detallista.lineItem(counter).aditionalQuantity(0).Text = New String((1)) {}
' detallista.lineItem(counter).aditionalQuantity(0).Text(0) = "1"
' detallista.lineItem(counter).grossPrice = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemGrossPrice
' detallista.lineItem(counter).grossPrice.Amount = comprobante.Conceptos(counter).ValorUnitario
' detallista.lineItem(counter).netPrice = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemNetPrice
' detallista.lineItem(counter).netPrice.Amount = comprobante.Conceptos(counter).ValorUnitario
' detallista.lineItem(counter).AdditionalInformation = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAdditionalInformation
' detallista.lineItem(counter).AdditionalInformation.referenceIdentification = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAdditionalInformationReferenceIdentification
' detallista.lineItem(counter).AdditionalInformation.referenceIdentification.type = Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemAdditionalInformationReferenceIdentificationType.ON
' detallista.lineItem(counter).AdditionalInformation.referenceIdentification.Value = "1587"
' 'Impuestos
' Dim tasa As Decimal = 0
' Dim importeImp As Decimal = 0
' Try
' If (Not (comprobante.Impuestos.Traslados) Is Nothing) Then
' For Each traslado As Profact.TimbraCFDI40.ComprobanteImpuestosTraslado In comprobante.Impuestos.Traslados
' tasa = Decimal.Parse(traslado.TasaOCuota)
' importeImp = (comprobante.Conceptos(counter).Importe * (tasa / 100))
' Next
' End If
' Catch ex As System.Exception
' End Try
' detallista.lineItem(counter).tradeItemTaxInformation = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemTaxInformation(1) {}
' detallista.lineItem(counter).tradeItemTaxInformation(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemTaxInformation
' detallista.lineItem(counter).tradeItemTaxInformation(0).taxTypeDescription = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemTaxInformationTaxTypeDescription
' detallista.lineItem(counter).tradeItemTaxInformation(0).taxTypeDescription = Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemTaxInformationTaxTypeDescription.VAT
' detallista.lineItem(counter).tradeItemTaxInformation(0).tradeItemTaxAmount = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTradeItemTaxInformationTradeItemTaxAmount
' detallista.lineItem(counter).tradeItemTaxInformation(0).tradeItemTaxAmount.taxPercentage = tasa
' detallista.lineItem(counter).tradeItemTaxInformation(0).tradeItemTaxAmount.taxAmount = importeImp
' detallista.lineItem(counter).totalLineAmount = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTotalLineAmount
' detallista.lineItem(counter).totalLineAmount.grossAmount = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTotalLineAmountGrossAmount
' detallista.lineItem(counter).totalLineAmount.grossAmount.Amount = comprobante.Conceptos(counter).Importe
' detallista.lineItem(counter).totalLineAmount.netAmount = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaLineItemTotalLineAmountNetAmount
' detallista.lineItem(counter).totalLineAmount.netAmount.Amount = comprobante.Conceptos(counter).Importe
' counter = (counter + 1)
' Next
' detallista.totalAmount = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaTotalAmount
' detallista.totalAmount.Amount = comprobante.SubTotal
' detallista.TotalAllowanceCharge = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaTotalAllowanceCharge(1) {}
' detallista.TotalAllowanceCharge(0) = New Profact.TimbraCFDI40.Complementos.Detallista.detallistaTotalAllowanceCharge
' detallista.TotalAllowanceCharge(0).allowanceOrChargeType = Profact.TimbraCFDI40.Complementos.Detallista.detallistaTotalAllowanceChargeAllowanceOrChargeType.ALLOWANCE
' detallista.TotalAllowanceCharge(0).Amount = Ventas.DescuentoTC
' Dim nombres As System.Xml.Serialization.XmlSerializerNamespaces = New System.Xml.Serialization.XmlSerializerNamespaces
' nombres.Add("detallista", "http://www.sat.gob.mx/detallista")
' Dim xmlDetallista As String = Profact.TimbraCFDI.XMLUtilerias.SerializaObjeto(detallista, GetType(Profact.TimbraCFDI40.Complementos.Detallista.detallista), nombres)
' Dim docDetallista As XmlDocument = New XmlDocument
' docDetallista.LoadXml(xmlDetallista)
' comprobante.DetallistaSpecified = True
' LXmlComplementos.Add(docDetallista.DocumentElement)
' TieneComplemento = True
' End If
'#End Region
If TieneComplemento Then If TieneComplemento Then
comprobante.Complemento = New Profact.TimbraCFDI40.ComprobanteComplemento comprobante.Complemento = New Profact.TimbraCFDI40.ComprobanteComplemento
@@ -5255,6 +5037,7 @@ Public Class Timbrado
cfdi.CartaPorteMercancias(Carta.Mercancias.PesoBrutoTotal, Carta.Mercancias.UnidadPeso, Carta.Mercancias.PesoNetoTotal, Carta.Mercancias.NumTotalMercancias, Carta.Mercancias.CargoporTasacion) cfdi.CartaPorteMercancias(Carta.Mercancias.PesoBrutoTotal, Carta.Mercancias.UnidadPeso, Carta.Mercancias.PesoNetoTotal, Carta.Mercancias.NumTotalMercancias, Carta.Mercancias.CargoporTasacion)
If Carta.Mercancias IsNot Nothing AndAlso Carta.Mercancias.Mercancias.Count > 0 Then If Carta.Mercancias IsNot Nothing AndAlso Carta.Mercancias.Mercancias.Count > 0 Then
For Each concep As CFDICartaPorteMercancia In Carta.Mercancias.Mercancias For Each concep As CFDICartaPorteMercancia In Carta.Mercancias.Mercancias
If concep.ValorMercancia <= 0 Then concep.Moneda = ""
cfdi.CartaPorteMercancia(concep.BienesTransp, concep.ClaveSTCC, concep.Descripción, concep.Cantidad, concep.ClaveUnidad, concep.Unidad, concep.Dimensiones, concep.MaterialPeligroso, concep.ClaveMaterialPeligroso, If(concep.ClaveMaterialPeligroso <> "", concep.Embalaje, ""), If(concep.ClaveMaterialPeligroso <> "", concep.DescripEmbalaje, ""), concep.PesoenKg, concep.ValorMercancia, concep.Moneda, concep.FraccionArrancelaria, concep.UUIDComercioExt) cfdi.CartaPorteMercancia(concep.BienesTransp, concep.ClaveSTCC, concep.Descripción, concep.Cantidad, concep.ClaveUnidad, concep.Unidad, concep.Dimensiones, concep.MaterialPeligroso, concep.ClaveMaterialPeligroso, If(concep.ClaveMaterialPeligroso <> "", concep.Embalaje, ""), If(concep.ClaveMaterialPeligroso <> "", concep.DescripEmbalaje, ""), concep.PesoenKg, concep.ValorMercancia, concep.Moneda, concep.FraccionArrancelaria, concep.UUIDComercioExt)
For Each transp In concep.MercanciasCantidadTransporta For Each transp In concep.MercanciasCantidadTransporta
cfdi.CartaPorteCantidadTransporta(transp.Cantidad, transp.IDOrigen, transp.IDDestino, transp.CvesTransportes) cfdi.CartaPorteCantidadTransporta(transp.Cantidad, transp.IDOrigen, transp.IDDestino, transp.CvesTransportes)
@@ -5351,6 +5134,17 @@ Public Class Timbrado
doc.ObjetoImpuesto) doc.ObjetoImpuesto)
If doc.Impuestos IsNot Nothing Then If doc.Impuestos IsNot Nothing Then
''retenciones
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then
Dim j As Integer = 0
For Each docimp As CFDIConceptosImpuestos In doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "R")
If docimp.TrasladooRetencion = "R" Then
cfdi.Pago20RetencionDR(docimp.Base, docimp.Impuesto, docimp.TipoFactor, docimp.TasaOCuota, docimp.Importe)
End If
j += 1
Next
End If
''traslados ''traslados
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "T").Count > 0 Then
Dim j As Integer = 0 Dim j As Integer = 0
@@ -5362,33 +5156,22 @@ Public Class Timbrado
j += 1 j += 1
Next Next
End If End If
''retenciones
If (doc.Impuestos).Where(Function(x) x.TrasladooRetencion = "R").Count > 0 Then
Dim j As Integer = 0
For Each docimp As CFDIConceptosImpuestos In doc.Impuestos.Where(Function(x) x.TrasladooRetencion = "R")
If docimp.TrasladooRetencion = "R" Then
cfdi.Pago20RetencionDR(docimp.Base, docimp.Impuesto, docimp.TipoFactor, docimp.TasaOCuota, docimp.Importe)
End If
j += 1
Next
End If
End If End If
Next Next
If (ObjCFDITimbre.ComplementoPagos.Retenciones).Count > 0 Then
For Each Ret As CFDIRetenciones In ObjCFDITimbre.ComplementoPagos.Retenciones
cfdi.Pago20RetencionP(Ret.Impuesto, Ret.Importe)
Next
End If
If ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then If ObjCFDITimbre.ComplementoPagos.Traslados.Count > 0 Then
For Each Tra As CFDITraslados In (ObjCFDITimbre.ComplementoPagos.Traslados) For Each Tra As CFDITraslados In (ObjCFDITimbre.ComplementoPagos.Traslados)
cfdi.Pago20TrasladoP(Tra.Base, Tra.Impuesto, Tra.TipoFactor, Tra.TasaOCuota, Tra.Importe) cfdi.Pago20TrasladoP(Tra.Base, Tra.Impuesto, Tra.TipoFactor, Tra.TasaOCuota, Tra.Importe)
Next Next
End If End If
If (ObjCFDITimbre.ComplementoPagos.Retenciones).Count > 0 Then
For Each Ret As CFDIRetenciones In ObjCFDITimbre.ComplementoPagos.Retenciones
cfdi.Pago20RetencionP(Ret.Impuesto, Ret.Importe)
Next
End If
End If End If
End If End If
#End Region #End Region
@@ -6740,12 +6523,12 @@ Public Class Timbrado
End If End If
ComCartaPorte.Mercancias.Mercancia(i).DescripEmbalaje = concep.DescripEmbalaje If concep.DescripEmbalaje <> "" Then ComCartaPorte.Mercancias.Mercancia(i).DescripEmbalaje = concep.DescripEmbalaje
ComCartaPorte.Mercancias.Mercancia(i).PesoEnKg = concep.PesoenKg ComCartaPorte.Mercancias.Mercancia(i).PesoEnKg = concep.PesoenKg
ComCartaPorte.Mercancias.Mercancia(i).ValorMercanciaSpecified = False ComCartaPorte.Mercancias.Mercancia(i).ValorMercanciaSpecified = False
ComCartaPorte.Mercancias.Mercancia(i).MonedaSpecified = False ComCartaPorte.Mercancias.Mercancia(i).MonedaSpecified = False
ComCartaPorte.Mercancias.Mercancia(i).FraccionArancelariaSpecified = False ComCartaPorte.Mercancias.Mercancia(i).FraccionArancelariaSpecified = False
ComCartaPorte.Mercancias.Mercancia(i).UUIDComercioExt = concep.UUIDComercioExt If concep.UUIDComercioExt <> "" Then ComCartaPorte.Mercancias.Mercancia(i).UUIDComercioExt = concep.UUIDComercioExt
Dim j As Integer = 0 Dim j As Integer = 0
ComCartaPorte.Mercancias.Mercancia(i).CantidadTransporta = New ProfactCartaPorte.CartaPorteMercanciasMercanciaCantidadTransporta(Carta.Mercancias.Mercancias.Count - 1) {} ComCartaPorte.Mercancias.Mercancia(i).CantidadTransporta = New ProfactCartaPorte.CartaPorteMercanciasMercanciaCantidadTransporta(Carta.Mercancias.Mercancias.Count - 1) {}
@@ -6763,43 +6546,6 @@ Public Class Timbrado
End If End If
'If Carta.FiguraTransporte IsNot Nothing Then
' If Carta.FiguraTransporte.AutoTransporte IsNot Nothing Then
' cfdi.CartaPorteAutotransporte(Carta.FiguraTransporte.AutoTransporte.PermisoSCT, Carta.FiguraTransporte.AutoTransporte.NumPermisoSCT)
' cfdi.CartaPorteIdentificacionVehicular(Carta.FiguraTransporte.AutoTransporte.Vehiculo.ConfigVehicular, Carta.FiguraTransporte.AutoTransporte.Vehiculo.PlacaVM, Carta.FiguraTransporte.AutoTransporte.Vehiculo.AnioModeloVM)
' cfdi.CartaPorteSeguros(Carta.FiguraTransporte.AutoTransporte.NombreSeguroResponsabilidadCivil, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroResponsabilidadCivil,
' Carta.FiguraTransporte.AutoTransporte.NombreSeguroMedioAmbiente, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroMedioAmbiente,
' Carta.FiguraTransporte.AutoTransporte.NombreSeguroCarga, Carta.FiguraTransporte.AutoTransporte.PolizaSeguroCarga,
' Carta.FiguraTransporte.AutoTransporte.PrimaSeguro)
' If Carta.FiguraTransporte.AutoTransporte.Remolques IsNot Nothing AndAlso Carta.FiguraTransporte.AutoTransporte.Remolques.Count > 0 Then
' For Each concep As CFDICartaPorteRemolque In Carta.FiguraTransporte.AutoTransporte.Remolques
' cfdi.CartaPorteRemolque(concep.SubTipoRemolque, concep.Placa)
' Next
' End If
' End If
' If Carta.FiguraTransporte.Operadores IsNot Nothing AndAlso Carta.FiguraTransporte.Operadores.Count > 0 Then
' For Each concep As CFDICartaPorteOperador In Carta.FiguraTransporte.Operadores
' cfdi.CartaPorteTiposFigura(concep.TipoFigura, concep.RFCFigura, concep.NumLicencia, concep.NombreFigura, concep.NumRegidTribFigura, If(concep.ResidenciaFiscalFigura <> "MEX", concep.ResidenciaFiscalFigura, ""))
' If concep.TipoFigura.Contiene("02", "03") Then ' “02”- Propietario o “03” -Arrendador
' cfdi.CartaPortePartesTransporte("PT01")
' cfdi.CartaPortePartesTransporteDomicilio(concep.Domicilio.Calle, concep.Domicilio.NumeroExterior, concep.Domicilio.NumeroInterior, concep.Domicilio.Colonia, concep.Domicilio.Localidad, concep.Domicilio.Referencia, concep.Domicilio.Municipio, concep.Domicilio.Estado, concep.Domicilio.Pais, concep.Domicilio.CP)
' End If
' Next
' End If
'End If
'
If Carta.FiguraTransporte IsNot Nothing Then If Carta.FiguraTransporte IsNot Nothing Then
If Carta.FiguraTransporte.AutoTransporte IsNot Nothing Then If Carta.FiguraTransporte.AutoTransporte IsNot Nothing Then

View File

@@ -381,7 +381,7 @@ Public Class Timbres
Public Property CartaPorte As CFDICartaPorte Public Property CartaPorte As CFDICartaPorte
End Class End Class
Public Shared Function PreParaCartaPorteFactura(CveTimbre As Integer, Obj As Modelos.Factura, UsuarioActual As Usuario) As MMensajeCartaPorte Public Shared Function PreParaCartaPorteFactura(CveTimbre As Integer, UsuarioActual As Usuario) As MMensajeCartaPorte
Dim Retorno As New MMensajeCartaPorte Dim Retorno As New MMensajeCartaPorte
Try Try
@@ -405,7 +405,7 @@ Public Class Timbres
Dim ObjGrales As New ClsGenerales Dim ObjGrales As New ClsGenerales
If ObjGrales.GetGralTimbre(CveTimbre, "Man", FI, FF, -1, UsuarioActual.CveEmpresa, -1) Then If ObjGrales.GetGralTimbre(CveTimbre, "Ing", FI, FF, -1, UsuarioActual.CveEmpresa, -1) Then
If ObjGrales.DtResultados.Rows.Count = 1 Then If ObjGrales.DtResultados.Rows.Count = 1 Then
Dim DtMovimientos As DataTable = Nothing Dim DtMovimientos As DataTable = Nothing
@@ -472,16 +472,6 @@ Public Class Timbres
End If End If
If drT("ClaveTipoRemolque1").ToString <> "" Then
Dim Rem1 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque1"), .Placa = drT("PlacaRemolque1")}
CartaPorte.FiguraTransporte.AutoTransporte.Remolques.Add(Rem1)
End If
If drT("ClaveTipoRemolque2").ToString <> "" Then
Dim Rem2 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque2"), .Placa = drT("PlacaRemolque2")}
CartaPorte.FiguraTransporte.AutoTransporte.Remolques.Add(Rem2)
End If
Dim DomOrigen As CFDICartaPorteDomicilio = Nothing Dim DomOrigen As CFDICartaPorteDomicilio = Nothing
DomOrigen = New CFDICartaPorteDomicilio With {.Calle = drT("DirOriCalle").ToString, DomOrigen = New CFDICartaPorteDomicilio With {.Calle = drT("DirOriCalle").ToString,
@@ -575,7 +565,7 @@ Public Class Timbres
.ClaveUnidad = drr("SATClaveUM").ToString, .ClaveUnidad = drr("SATClaveUM").ToString,
.Unidad = drr("UM").ToString, .Unidad = drr("UM").ToString,
.Dimensiones = drr("Dimensiones").ToString, .Dimensiones = drr("Dimensiones").ToString,
.PesoenKg = drr("PesoKg").ToString.ToDecimal, .PesoenKg = drr("PesoKg").ToString.ToDecimal * drr("Cantidad").ToString.ToDecimal,
.MaterialPeligroso = If(drr("ClaveMaterialPeligroso").ToString <> "", "Sí", ""), .MaterialPeligroso = If(drr("ClaveMaterialPeligroso").ToString <> "", "Sí", ""),
.ClaveMaterialPeligroso = drr("ClaveMaterialPeligroso").ToString, .ClaveMaterialPeligroso = drr("ClaveMaterialPeligroso").ToString,
.Embalaje = drr("ClaveEmbalaje").ToString, .Embalaje = drr("ClaveEmbalaje").ToString,
@@ -586,7 +576,7 @@ Public Class Timbres
.UUIDComercioExt = "" .UUIDComercioExt = ""
} }
Dim DetalleMercancia As New CFDICartaPorteMercanciaDetalleMercancia With {.PesoNeto = drr("PesoKg").ToString.ToDecimal, .NumPiezas = drr("Cantidad").ToString.ToDecimal} Dim DetalleMercancia As New CFDICartaPorteMercanciaDetalleMercancia With {.PesoNeto = drr("PesoKg").ToString.ToDecimal * drr("Cantidad").ToString.ToDecimal, .NumPiezas = drr("Cantidad").ToString.ToDecimal}
conceptoCarta.DetalleMercancia = DetalleMercancia conceptoCarta.DetalleMercancia = DetalleMercancia
Dim MercanciaTransporta As New CFDICartaPorteMercanciaTransporta With {.Cantidad = drr("Cantidad").ToString.ToDecimal, .IDOrigen = "OR000001", .IDDestino = "DE000001"} Dim MercanciaTransporta As New CFDICartaPorteMercanciaTransporta With {.Cantidad = drr("Cantidad").ToString.ToDecimal, .IDOrigen = "OR000001", .IDDestino = "DE000001"}

View File

@@ -131,7 +131,7 @@ Namespace SIG
CveComplementoPagoTimbre = objbancos.AddComplementoPago(dr("CveIE").ToString().ToEntero(), -1, "Pag", dr("FolioTimbre"), Me.CveUsuario, CveEmpresa, CvePrePoliza:=-1, Estatus:=1) CveComplementoPagoTimbre = objbancos.AddComplementoPago(dr("CveIE").ToString().ToEntero(), -1, "Pag", dr("FolioTimbre"), Me.CveUsuario, CveEmpresa, CvePrePoliza:=-1, Estatus:=1)
continuar = CveComplementoPagoTimbre > 0 continuar = CveComplementoPagoTimbre > 0
End If End If
If continuar Then continuar = objbancos.UpdateComplementoPago(CveComplementoPagoTimbre, dr("FolioFiscalTimbre").ToString(), dr("CvePAC").ToString().ToEntero(), CveEmpresa) If continuar Then continuar = objbancos.UpdateComplementoPago(CveComplementoPagoTimbre, dr("FolioFiscalTimbre").ToString(), "4.0", dr("CvePAC").ToString().ToEntero(), CveEmpresa)
If continuar Then If continuar Then
dr("Sincronizado") = 1 dr("Sincronizado") = 1
End If End If

View File

@@ -23,30 +23,23 @@
<tr> <tr>
<td class="Titulos" colspan="4">Filtros para búsqueda</td> <td class="Titulos" colspan="4">Filtros para búsqueda</td>
</tr> </tr>
<tr> <tr>
<td class="text-right" style="width: 150px"><b>Banco:</b></td>
<td style="width: 225px">
<asp:DropDownList ID="DdlBanco" runat="server" CssClass="form-control input-sm" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Banco" DataValueField="CveBanco" ValidationGroup="GrpGuardar">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
</asp:DropDownList>
</td>
<td class="text-right" style="width: 150px"><b>Cuenta:</b></td>
<td style="width: 225px">
<asp:DropDownList ID="DdlCuenta" runat="server" CssClass="form-control input-sm" AppendDataBoundItems="true" DataTextField="NumCuenta" DataValueField="CveCuenta" ValidationGroup="GrpGuardar">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="text-right" style="width: 150px"><b>Folio:</b></td> <td class="text-right" style="width: 150px"><b>Folio:</b></td>
<td style="width: 225px"> <td style="width: 150px">
<asp:TextBox ID="TxtFolio" CssClass="form-control input-sm" runat="server" MaxLength="20" autofocus></asp:TextBox> <asp:TextBox ID="TxtFolio" CssClass="form-control input-sm" runat="server" MaxLength="20" autofocus="true"></asp:TextBox>
</td> </td>
<td class="text-right" style="width: 150px"><b>Cuenta:</b></td>
<td style="width: 150px">
<asp:DropDownList ID="DdlCuenta" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" ValidationGroup="GrpGuardar">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="text-right" style="width: 150px"><b>Fecha Inicio:</b></td> <td class="text-right" style="width: 150px"><b>Fecha Inicio:</b></td>
<td style="width: 225px"> <td style="width: 150px">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="padding: 0px;"> <div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="padding: 0px;">
<%-- --%> <%-- --%>
<asp:TextBox Style="width: 200px !important;" ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Font-Size="12px"></asp:TextBox> <asp:TextBox Style="width: 150px !important;" ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Font-Size="12px"></asp:TextBox>
<span class="input-group-btn "> <span class="input-group-btn ">
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton> <asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span> </span>
@@ -58,6 +51,22 @@
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
</div> </div>
</td> </td>
<td class="text-right" style="width: 150px"><b>Fecha Fin:</b></td>
<td style="width: 150px">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="padding: 0px;">
<%-- --%>
<asp:TextBox Style="width: 150px !important;" ID="TxtFechaFin" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Font-Size="12px"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TxtFechaFin" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender1" TargetControlID="TxtFechaFin" PopupButtonID="ImgCalendarioF" PopupPosition="BottomLeft" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="TxtFechaFin" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="TxtFechaFin" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</td>
</tr> </tr>
<tr> <tr>
<td style="text-align: center;" align="center" colspan="4"> <td style="text-align: center;" align="center" colspan="4">

View File

@@ -47,22 +47,22 @@ Partial Class Bancos_PopUpBuscarIE
#Region " C A R G A - D A T O S" #Region " C A R G A - D A T O S"
Private Sub CargaDatos() Private Sub CargaDatos()
CargaBanco() ' CargaBanco()
CargaCuenta() CargaCuenta()
End Sub End Sub
Private Sub CargaBanco() 'Private Sub CargaBanco()
DdlBanco.DataSource = GlobalDTBancos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) ' DdlBanco.DataSource = GlobalDTBancos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlBanco.DataBind() ' DdlBanco.DataBind()
End Sub 'End Sub
Private Sub CargaCuenta() Private Sub CargaCuenta()
DdlCuenta.Items.Clear() DdlCuenta.Items.Clear()
DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("CveBanco = '" & DdlBanco.SelectedValue.ToEntero & "'") DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) '.FiltraParametros("CveBanco = '" & DdlBanco.SelectedValue.ToEntero & "'")
DdlCuenta.DataBind() DdlCuenta.DataBind()
DdlCuenta.Items.Insert(0, New ListItem("Todas", "-1")) DdlCuenta.Items.Insert(0, New ListItem("Todas", "-1"))
End Sub End Sub
Protected Sub DdlBanco_SelectedIndexChanged1(sender As Object, e As System.EventArgs) Handles DdlBanco.SelectedIndexChanged 'Protected Sub DdlBanco_SelectedIndexChanged1(sender As Object, e As System.EventArgs) Handles DdlBanco.SelectedIndexChanged
CargaCuenta() ' CargaCuenta()
End Sub 'End Sub
#End Region #End Region
@@ -73,7 +73,7 @@ Partial Class Bancos_PopUpBuscarIE
If ValidarFiltrosSeleccionado() Then If ValidarFiltrosSeleccionado() Then
Dim ObjBancosIE As New ClsBancos Dim ObjBancosIE As New ClsBancos
If ObjBancosIE.GetBancosIE(-1, DdlBanco.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, "-1", -1, Folio, "-1", -1, -1, -1, -1, -1, txtFechaI.Text.ToDate, If ObjBancosIE.GetBancosIE(-1, -1, DdlCuenta.SelectedValue.ToEntero, "-1", -1, Folio, "-1", -1, -1, -1, -1, -1, txtFechaI.Text.ToDate,
MaxFecha.ToShortDateString.ToDate, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa, TopSelect:=100) Then MaxFecha.ToShortDateString.ToDate, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa, TopSelect:=100) Then
DtDatos = ObjBancosIE.DtResultados 'If(TxtFolio.Text <> "", ObjBancosIE.DtResultados.FiltraParametros(String.Format("Folio Like '{0}'", TxtFolio.Text)), ObjBancosIE.DtResultados) DtDatos = ObjBancosIE.DtResultados 'If(TxtFolio.Text <> "", ObjBancosIE.DtResultados.FiltraParametros(String.Format("Folio Like '{0}'", TxtFolio.Text)), ObjBancosIE.DtResultados)
Else Else
@@ -110,7 +110,7 @@ Partial Class Bancos_PopUpBuscarIE
End Sub End Sub
Private Function ValidarFiltrosSeleccionado() As Boolean Private Function ValidarFiltrosSeleccionado() As Boolean
If DdlBanco.SelectedValue.ToEntero > 0 Then Return True ' If DdlBanco.SelectedValue.ToEntero > 0 Then Return True
If DdlCuenta.SelectedValue.ToEntero > 0 Then Return True If DdlCuenta.SelectedValue.ToEntero > 0 Then Return True
If TxtFolio.Text.Length > 0 Then Return True If TxtFolio.Text.Length > 0 Then Return True
Return False Return False

View File

@@ -39,7 +39,7 @@ Partial Class Bancos_ProveedoresAbonar
Private Property CveUsuarioProgramo As Integer Private Property CveUsuarioProgramo As Integer
Get Get
Return ViewState("CveUsuarioProgramo").ToString.ToEntero Return IfNull(ViewState("CveUsuarioProgramo"), "-1").ToString.ToEntero
End Get End Get
Set(value As Integer) Set(value As Integer)
ViewState("CveUsuarioProgramo") = value ViewState("CveUsuarioProgramo") = value
@@ -1282,51 +1282,76 @@ Partial Class Bancos_ProveedoresAbonar
Case 64 'Ganancia Case 64 'Ganancia
If CveMoneda <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then If CveMoneda <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then
Dim tImporteCompra, tImportePago As Decimal
Dim Diferencia As Decimal = 0
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria If gvr.DataKey("CveMoneda").ToEntero = 1 And CveMoneda <> 1 Then
'tipoCambioVentaDiferenciaCambiaria = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal) 'factura pesos, pago en dolares
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) tImporteCompra = gvr.FCTextBox("TxtAbonar").Text.ToDecimal.RoundSQL
tImportePago = (((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioCompra / TipoCambioPago).RoundSQL * TipoCambioPago).RoundSQL
ElseIf gvr.DataKey("CveMoneda").ToEntero <> 1 And CveMoneda <> 1 Then
Dim Diferencia As Decimal = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioCompraValuacion) - ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * TipoCambioPago) 'Añadimos la diferencia de perdida en la venta 'factura dolares, pago en dolares
Diferencia -= ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA tImporteCompra = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioCompraValuacion).RoundSQL
Diferencia += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA tImportePago = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * TipoCambioPago).RoundSQL
Diferencia += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR ElseIf gvr.DataKey("CveMoneda").ToEntero <> 1 And CveMoneda = 1 Then
Diferencia -= ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS 'factura dolares, pago en pesos
Diferencia = Math.Round(Diferencia, 2) tImporteCompra = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioCompraValuacion).RoundSQL
tImportePago = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * TipoCambioPago).RoundSQL
'' se considera, las diferencias, y no el tipo de cambio, por el caso de las fluctuaciones
'' si tiene funcionalidad de flucturación con ivas, tomar tipocambioventa
If Diferencia > 0 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = Math.Abs(Diferencia)
importeMX = ImporteMovimiento
End If End If
If tImporteCompra <> tImportePago Then
If tImporteCompra > tImportePago Then
ConceptoContable = 64
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
TipoMovimiento = True
'CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
Else
ConceptoContable = 65
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
TipoMovimiento = False
' CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
End If
Diferencia = tImporteCompra - tImportePago
End If
If FuncionalidadFluctuacionImpuestos Then
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
Diferencia = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioCompraValuacion) - ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * TipoCambioPago) 'Añadimos la diferencia de perdida en la venta
Diferencia -= ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA
Diferencia += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA
Diferencia += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR
Diferencia -= ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS
Diferencia = Diferencia.RoundSQL
End If
ImporteMovimiento = Math.Abs(Diferencia)
importeMX = ImporteMovimiento
Else Else
ImporteMovimiento = 0 ImporteMovimiento = 0
End If End If
Case 65 'Perdida 'Case 65 'Perdida
If CveMoneda <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then ' If CveMoneda <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria ' IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
'tipoCambioVentaDiferenciaCambiaria = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal) ' 'tipoCambioVentaDiferenciaCambiaria = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal)
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) ' Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
Dim Diferencia As Decimal = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioCompraValuacion) - ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * TipoCambioPago) 'Añadimos la diferencia de perdida en la venta ' Dim Diferencia As Decimal = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioCompraValuacion) - ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * TipoCambioPago) 'Añadimos la diferencia de perdida en la venta
Diferencia -= ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA ' Diferencia -= ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA
Diferencia += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA ' Diferencia += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA
Diferencia += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR ' Diferencia += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR
Diferencia -= ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS ' Diferencia -= ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS
Diferencia = Math.Round(Diferencia, 2) ' Diferencia = Math.Round(Diferencia, 2)
'si la diferencia es negativa es pérdida, si es positiva es ganancia ' 'si la diferencia es negativa es pérdida, si es positiva es ganancia
If Diferencia < 0 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then ' If Diferencia < 0 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = Math.Abs(Diferencia) ' ImporteMovimiento = Math.Abs(Diferencia)
importeMX = ImporteMovimiento ' importeMX = ImporteMovimiento
End If ' End If
Else ' Else
ImporteMovimiento = 0 ' ImporteMovimiento = 0
End If ' End If
Case 255 'Otros egresos Case 255 'Otros egresos
If DdlOtrosPagos.SelectedValue = "2" Then If DdlOtrosPagos.SelectedValue = "2" Then
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
@@ -1435,10 +1460,10 @@ Partial Class Bancos_ProveedoresAbonar
TipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal TipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal
End If End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Referencia, 30, ConceptoMovimiento, TxtFechaDocumento.Text.ToDate, IdCuenta, -1, CveIE, CveProveedor:=CveProveedor, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=If(TipoCambioPago = 1, 0, TxtImporte.Text.ToDecimal), TipoCambio:=TipoCambioPago, CveSubProyecto:=CveSubProyecto) Then If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Referencia, 30, ConceptoMovimiento, TxtFechaDocumento.Text.ToDate, IdCuenta, -1, CveIE, CveProveedor:=CveProveedor, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=If(TipoCambioPago = 1, 0, TxtImporte.Text.ToDecimal), TipoCambio:=TipoCambioPago, CveSubProyecto:=CveSubProyecto) Then
MsgError = "No se pudo insertar la póliza" MsgError = "No se pudo insertar la póliza"
End If End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, If(CveMoneda = 1 AndAlso TxtTC.Visible, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, TxtImporte.Text.ToDecimal), Referencia, 204, ConceptoMovimiento, TxtFechaDocumento.Text.ToDate, IdCuentaBancariaComplementaria, -1, CveIE, CveProveedor:=CveProveedor, ImporteMX:=If(CveMoneda = 2, Math.Round((TxtImporte.Text.Trim.ToDecimal * TipoCambioPago) - TxtImporte.Text.Trim.ToDecimal, 2, MidpointRounding.AwayFromZero), TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 1, 0, TxtImporte.Text.ToDecimal), TipoCambio:=TipoCambioPago, CveSubProyecto:=CveSubProyecto) Then If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, If(CveMoneda = 1 AndAlso TxtTC.Visible, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, TxtImporte.Text.ToDecimal), Referencia, 204, ConceptoMovimiento, TxtFechaDocumento.Text.ToDate, IdCuentaBancariaComplementaria, -1, CveIE, CveProveedor:=CveProveedor, ImporteMX:=If(CveMoneda = 2, Math.Round((TxtImporte.Text.Trim.ToDecimal * TipoCambioPago) - TxtImporte.Text.Trim.ToDecimal, 2, MidpointRounding.AwayFromZero), TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 1, 0, TxtImporte.Text.ToDecimal), TipoCambio:=TipoCambioPago, CveSubProyecto:=CveSubProyecto) Then
MsgError = "No se pudo insertar la póliza" MsgError = "No se pudo insertar la póliza"
End If End If
Else Else
@@ -1448,7 +1473,7 @@ Partial Class Bancos_ProveedoresAbonar
TipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal TipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal
End If End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Referencia, 30, ConceptoMovimiento, TxtFechaDocumento.Text.ToDate, IdCuenta, -1, CveIE, CveProveedor:=CveProveedor, ImporteMX:=If(CveMoneda = 2, Math.Round(TxtImporte.Text.Trim.ToDecimal * TipoCambioPago, 2, MidpointRounding.AwayFromZero), TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(DivTC.Visible, If(TxtTC.Text.ToDecimal > 0, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, 0), 0), TipoCambio:=TipoCambioPago, CveSubProyecto:=CveSubProyecto) Then If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Referencia, 30, ConceptoMovimiento, TxtFechaDocumento.Text.ToDate, IdCuenta, -1, CveIE, CveProveedor:=CveProveedor, ImporteMX:=If(CveMoneda = 2, Math.Round(TxtImporte.Text.Trim.ToDecimal * TipoCambioPago, 2, MidpointRounding.AwayFromZero), TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(DivTC.Visible, If(TxtTC.Text.ToDecimal > 0, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, 0), 0), TipoCambio:=TipoCambioPago, CveSubProyecto:=CveSubProyecto) Then
MsgError = "No se pudo insertar la póliza" MsgError = "No se pudo insertar la póliza"
End If End If
@@ -1473,7 +1498,7 @@ Partial Class Bancos_ProveedoresAbonar
ImporteFluctuacion = PagoProveedoresME - (Bancos + BancosComplementaria) ImporteFluctuacion = PagoProveedoresME - (Bancos + BancosComplementaria)
If ImporteFluctuacion.RoundSQL() <> 0 Then If MsgError = "" AndAlso ImporteFluctuacion.RoundSQL() <> 0 Then
'SI EL PAGO DE PROVEEDORES ME ES MAYOR QUE BANCOS METER EL CONCEPTO DE GANANCIA 'SI EL PAGO DE PROVEEDORES ME ES MAYOR QUE BANCOS METER EL CONCEPTO DE GANANCIA
If ImporteFluctuacion > 0 Then If ImporteFluctuacion > 0 Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), Referencia, 64, ConceptoMovimiento, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveSubProyecto:=CveSubProyecto, CveProveedor:=Me.CveProveedor, CveCompra:=-1, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TipoCambio, TipoCambioPago:=TCPago) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), Referencia, 64, ConceptoMovimiento, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveSubProyecto:=CveSubProyecto, CveProveedor:=Me.CveProveedor, CveCompra:=-1, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TipoCambio, TipoCambioPago:=TCPago) Then
@@ -1494,10 +1519,9 @@ Partial Class Bancos_ProveedoresAbonar
TipoCambioPago = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToString.ToDecimal TipoCambioPago = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToString.ToDecimal
End If End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Referencia, 30, ConceptoMovimiento, TxtFechaDocumento.Text.ToDate, IdCuenta, -1, CveIE, CveProveedor:=CveProveedor, ImporteMX:=If(CveMoneda = 2, Math.Round(TxtImporte.Text.Trim.ToDecimal * TipoCambioPago, 2, MidpointRounding.AwayFromZero), TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(DivTC.Visible, If(TxtTC.Text.ToDecimal > 0, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, 0), 0), TipoCambio:=TipoCambioPago, CveSubProyecto:=CveSubProyecto) Then If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtImporte.Text.ToDecimal, Referencia, 30, ConceptoMovimiento, TxtFechaDocumento.Text.ToDate, IdCuenta, -1, CveIE, CveProveedor:=CveProveedor, ImporteMX:=If(CveMoneda = 2, Math.Round(TxtImporte.Text.Trim.ToDecimal * TipoCambioPago, 2, MidpointRounding.AwayFromZero), TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(DivTC.Visible, If(TxtTC.Text.ToDecimal > 0, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, 0), 0), TipoCambio:=TipoCambioPago, CveSubProyecto:=CveSubProyecto) Then
MsgError = "No se pudo insertar la póliza" MsgError = "No se pudo insertar la póliza"
End If End If
End If End If
End If End If
@@ -1853,7 +1877,7 @@ Partial Class Bancos_ProveedoresAbonar
DdlTipoTransaccion.SelectedValue = TipoPago.ToString DdlTipoTransaccion.SelectedValue = TipoPago.ToString
RecargaCuentasDepositos() RecargaCuentasDepositos()
ElseIf TipoPago = 3 Then ElseIf TipoPago = 3 Then
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo = 'Egs' AND CveTipoTransaccion IN (1, 2)and Estatus = 1 ") DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo = 'Egs' AND CveTipoTransaccion IN (1, 2) and Estatus = 1 ")
DdlTipoTransaccion.DataBind() DdlTipoTransaccion.DataBind()
DdlTipoTransaccion.SelectedValue = TipoPago.ToString DdlTipoTransaccion.SelectedValue = TipoPago.ToString
RecargaCuentasDepositos() RecargaCuentasDepositos()

View File

@@ -590,7 +590,7 @@ Partial Class Bancos_RepComplementoPago
If EstatusSATCancelado(Can_FolioFiscalCancelar, UsuarioActual.Empresa.RFC, Can_RFCReceptorCancelar) Then If EstatusSATCancelado(Can_FolioFiscalCancelar, UsuarioActual.Empresa.RFC, Can_RFCReceptorCancelar) Then
If ObjBanco.UpdateComplementoPago(Can_CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, Can_CvePACCancelacion, FechaCancelacion:=Date.Now, SelloCancelacion:="") Then If ObjBanco.UpdateComplementoPagoCancelado(Can_CveComplementoPagoCancelar, 2, UsuarioActual.CveEmpresa, Can_CvePACCancelacion, Date.Now, "", CveSATMotivoCancelacion) Then
Alert("El complemento se cancelo correctamente.") Alert("El complemento se cancelo correctamente.")
ErrorProceso = False ErrorProceso = False
End If End If
@@ -599,7 +599,7 @@ Partial Class Bancos_RepComplementoPago
Dim resp = ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, Can_FolioFiscalCancelar, 0, Can_RFCReceptorCancelar, UsuarioActual.Empresa.RFC, Can_CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion) Dim resp = ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, Can_FolioFiscalCancelar, 0, Can_RFCReceptorCancelar, UsuarioActual.Empresa.RFC, Can_CvePACCancelacion, CveSATMotivoCancelacion:=CveSATMotivoCancelacion)
If resp.Verificado Then If resp.Verificado Then
If ObjBanco.UpdateComplementoPago(Can_CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, Can_CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse, CveSATMotivoCancelacion:=CveSATMotivoCancelacion) Then If ObjBanco.UpdateComplementoPagoCancelado(Can_CveComplementoPagoCancelar, 2, UsuarioActual.CveEmpresa, Can_CvePACCancelacion, ObjCancelacion.CancelacionFecha, ObjCancelacion.CancelacionAcuse, CveSATMotivoCancelacion) Then
Alert("El complemento se cancelo correctamente.") Alert("El complemento se cancelo correctamente.")
ErrorProceso = False ErrorProceso = False
End If End If

Binary file not shown.

View File

@@ -3699,13 +3699,7 @@ Partial Class Compras_Compras
Dim DtPS = GlobalDTPS(UsuarioActual.CveEmpresa).AsEnumerable Dim DtPS = GlobalDTPS(UsuarioActual.CveEmpresa).AsEnumerable
Dim DtPSAlias = GlobalDTProductosServiciosAlias(UsuarioActual.CveEmpresa).AsEnumerable Dim DtPSAlias = GlobalDTProductosServiciosAlias(UsuarioActual.CveEmpresa).AsEnumerable
''AGREGA EN TABLA TEMPORAL
'Dim DtPSTemp = TmpDT.Clone
'Dim Row As DataRow = Nothing
Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable) Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable)
Dim nodo As XmlNode = XMLDoc.DocumentElement Dim nodo As XmlNode = XMLDoc.DocumentElement
Dim VersionCFDI As String = ValorXML(nodo, "version") Dim VersionCFDI As String = ValorXML(nodo, "version")
@@ -3770,9 +3764,6 @@ Partial Class Compras_Compras
PU = ValorXML(node, "importe").ToDecimal / ValorXML(node, "cantidad").ToDecimal PU = ValorXML(node, "importe").ToDecimal / ValorXML(node, "cantidad").ToDecimal
End If End If
'OBTIENE DESCUENTO 'OBTIENE DESCUENTO
If ValorXML(node, "descuento") IsNot Nothing Then Descuento = ValorXML(node, "descuento").Trim.ToDecimal If ValorXML(node, "descuento") IsNot Nothing Then Descuento = ValorXML(node, "descuento").Trim.ToDecimal
@@ -3807,8 +3798,6 @@ Partial Class Compras_Compras
End If End If
End If End If
'se le puso una condicion de que ignorara los acentos, porque en la bd, marcaria error porque no distingue acentos 'se le puso una condicion de que ignorara los acentos, porque en la bd, marcaria error porque no distingue acentos
'CONCEPTO PRUEBA "TRABAJOS DE CONSTRUCCION", RM/Compras/Compras.aspx?CveFactura=13402&RFC=ECO061206QW7 'CONCEPTO PRUEBA "TRABAJOS DE CONSTRUCCION", RM/Compras/Compras.aspx?CveFactura=13402&RFC=ECO061206QW7
'' u!PS.ToString.ToUpper.Trim = PSS '' u!PS.ToString.ToUpper.Trim = PSS
@@ -3882,7 +3871,6 @@ Partial Class Compras_Compras
Exit For Exit For
End If End If
ElseIf ValorXML(nodeTraslado, "Impuesto") = "003" Then ElseIf ValorXML(nodeTraslado, "Impuesto") = "003" Then
IEPS = ValorXML(nodeTraslado, "Importe").Trim.ToDecimal IEPS = ValorXML(nodeTraslado, "Importe").Trim.ToDecimal
PorcentajeIEPS = ValorXML(nodeTraslado, "TasaOCuota").Trim.ToDecimal PorcentajeIEPS = ValorXML(nodeTraslado, "TasaOCuota").Trim.ToDecimal
@@ -3938,10 +3926,6 @@ Partial Class Compras_Compras
End If End If
If Version = "3.2" Then If Version = "3.2" Then
Try Try
If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
Dim ContadorTraslado = 0 Dim ContadorTraslado = 0
@@ -3960,14 +3944,10 @@ Partial Class Compras_Compras
End If End If
'' AGREGA PS '' AGREGA PS
'AGREGA A TMPDT 'AGREGA A TMPDT
AddPS(ValorXML(node, "cantidad").ToDecimal, CveUM, UMM, tCveClasif, Clasif, tCvePS, PSS, TipoPS, "-1", "SE", "SE", "-1", Obs, PU, Total, IVA, RetIVA, RetISR, IEPS, 0, Descuento, PSCodigo:=tPSCodigo, TCalculaTotales:=False, CveSATPS:=ValorXML(node, "ClaveProdServ").ToEntero(), CargaXml:=True, PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, PorcentajeRetISR:=PorcentajeRetISR, PorcentajeIEPS:=PorcentajeIEPS) AddPS(ValorXML(node, "cantidad").ToDecimal, CveUM, UMM, tCveClasif, Clasif, tCvePS, PSS, TipoPS, "-1", "SE", "SE", "-1", Obs, PU, Total, IVA, RetIVA, RetISR, IEPS, 0, Descuento, PSCodigo:=tPSCodigo, TCalculaTotales:=False, CveSATPS:=ValorXML(node, "ClaveProdServ").ToEntero(), CargaXml:=True, PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, PorcentajeRetISR:=PorcentajeRetISR, PorcentajeIEPS:=PorcentajeIEPS)
Next Next
End If End If
@@ -10879,13 +10859,7 @@ Partial Class Compras_Compras
End If End If
End If End If
Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable) Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable)
Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix) Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix)
Dim cfdVer As String = "" Dim cfdVer As String = ""
@@ -10894,14 +10868,10 @@ Partial Class Compras_Compras
cfdVer = "http://www.sat.gob.mx/cfd/2" cfdVer = "http://www.sat.gob.mx/cfd/2"
ElseIf Version = "3.3" Then ElseIf Version = "3.3" Then
cfdVer = "http://www.sat.gob.mx/cfd/3" cfdVer = "http://www.sat.gob.mx/cfd/3"
Else ' se considera que es la version 4.0 Else ' se considera que es la version 4.0
cfdVer = "http://www.sat.gob.mx/cfd/4" cfdVer = "http://www.sat.gob.mx/cfd/4"
End If End If
'If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2"
namespaces.AddNamespace(Prefijo, cfdVer) namespaces.AddNamespace(Prefijo, cfdVer)
namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital") namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital")
namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal") namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal")
@@ -10912,7 +10882,6 @@ Partial Class Compras_Compras
If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
EmisorRFC = ValorXML(node, "RFC") EmisorRFC = ValorXML(node, "RFC")
'EmisorNombre = ValorXML(node, "nombre")
End If End If
node = XMLDoc.SelectSingleNode(String.Format("//{0}:CfdiRelacionados", Prefijo), namespaces) node = XMLDoc.SelectSingleNode(String.Format("//{0}:CfdiRelacionados", Prefijo), namespaces)
@@ -10944,29 +10913,23 @@ Partial Class Compras_Compras
TotalRetenciones = ValorXML(node, "totalImpuestosRetenidos", "0").ToDecimal TotalRetenciones = ValorXML(node, "totalImpuestosRetenidos", "0").ToDecimal
If Version = "3.3" Or Version = "4.0" Then If Version = "3.3" OrElse Version = "4.0" Then
For Each retencion As XmlNode In nodeRetenciones For Each retencion As XmlNode In nodeRetenciones
If retencion.Attributes("Impuesto").Value = "002" Then If retencion.Attributes("Impuesto").Value = "002" Then RetencionIVA += retencion.Attributes("Importe").Value.ToDecimal
RetencionIVA += retencion.Attributes("Importe").Value.ToDecimal
End If If retencion.Attributes("Impuesto").Value = "001" Then RetencionISR += retencion.Attributes("Importe").Value.ToDecimal
If retencion.Attributes("Impuesto").Value = "001" Then
RetencionISR += retencion.Attributes("Importe").Value.ToDecimal
End If
' Do something.
Next Next
GvOC1.Columns(6).Visible = True GvOC1.Columns(6).Visible = True
GvOC2.Columns(4).Visible = True GvOC2.Columns(4).Visible = True
Else Else
For Each retencion As XmlNode In nodeRetenciones For Each retencion As XmlNode In nodeRetenciones
If retencion.Attributes("impuesto").Value = "IVA" Then If retencion.Attributes("impuesto").Value = "IVA" Then RetencionIVA += retencion.Attributes("importe").Value.ToDecimal
RetencionIVA += retencion.Attributes("importe").Value.ToDecimal
End If If retencion.Attributes("impuesto").Value = "ISR" Then RetencionISR += retencion.Attributes("importe").Value.ToDecimal
If retencion.Attributes("impuesto").Value = "ISR" Then
RetencionISR += retencion.Attributes("importe").Value.ToDecimal
End If
' Do something.
Next Next
End If End If
SumaTotalRetenciones += RetencionIVA SumaTotalRetenciones += RetencionIVA
@@ -10975,34 +10938,22 @@ Partial Class Compras_Compras
TotalTraslados = ValorXML(node, "totalImpuestosTrasladados", "0").ToDecimal TotalTraslados = ValorXML(node, "totalImpuestosTrasladados", "0").ToDecimal
Dim nodeTraslados As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Impuestos/{0}:Traslados/{0}:Traslado", Prefijo), namespaces) Dim nodeTraslados As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Comprobante/{0}:Impuestos/{0}:Traslados/{0}:Traslado", Prefijo), namespaces)
If Version = "3.3" Or Version = "4.0" Then If Version = "3.3" OrElse Version = "4.0" Then
For Each traslado As XmlNode In nodeTraslados For Each traslado As XmlNode In nodeTraslados
If traslado.Attributes("Impuesto").Value = "002" Then If traslado.Attributes("Impuesto").Value = "002" Then TrasladoIVA += traslado.Attributes("Importe").Value.ToDecimal
TrasladoIVA += traslado.Attributes("Importe").Value.ToDecimal
End If If traslado.Attributes("Impuesto").Value = "003" Then TrasladoIEPS += traslado.Attributes("Importe").Value.ToDecimal
If traslado.Attributes("Impuesto").Value = "003" Then
TrasladoIEPS += traslado.Attributes("Importe").Value.ToDecimal
End If
If traslado.Attributes("Impuesto").Value = "001" Then
'TrasladoISR = traslado.Attributes("importe").Value
End If
' Do something.
Next Next
Else Else
For Each traslado As XmlNode In nodeTraslados For Each traslado As XmlNode In nodeTraslados
If traslado.Attributes("impuesto").Value = "IVA" Then If traslado.Attributes("impuesto").Value = "IVA" Then TrasladoIVA += traslado.Attributes("importe").Value.ToDecimal
TrasladoIVA += traslado.Attributes("importe").Value.ToDecimal
End If If traslado.Attributes("impuesto").Value = "IEPS" Then TrasladoIEPS += traslado.Attributes("importe").Value.ToDecimal
If traslado.Attributes("impuesto").Value = "IEPS" Then
TrasladoIEPS += traslado.Attributes("importe").Value.ToDecimal
End If
'If traslado.Attributes("impuesto").Value = "ISR" Then
' TrasladoISR = traslado.Attributes("importe").Value
'End If
' Do something.
Next Next
End If End If
@@ -11024,53 +10975,15 @@ Partial Class Compras_Compras
node = node.SelectSingleNode(String.Format("//{0}:ImpuestosLocales", "implocal"), namespaces) node = node.SelectSingleNode(String.Format("//{0}:ImpuestosLocales", "implocal"), namespaces)
If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
OtrosImpuestos = ValorXML(node, "TotaldeTraslados", "0").ToDecimal OtrosImpuestos = ValorXML(node, "TotaldeTraslados", "0").ToDecimal
OtrosImpuestosRetenciones = ValorXML(node, "TotaldeRetenciones", "0").ToDecimal '2022.06.04-- se quitan los datos de retenciones de impuestos locales, generan conflicto. RMF
'OtrosImpuestosRetenciones = ValorXML(node, "TotaldeRetenciones", "0").ToDecimal
'If RetencionIVA <= 0 AndAlso ValorXML(node, "TotaldeRetenciones", "0").ToDouble > 0 Then RetencionIVA = ValorXML(node, "TotaldeRetenciones", "0").ToDecimal
'For Each retencion As XmlNode In nodeImpLocales
' If retencion.Attributes("impuesto").Value = "IVA" Then
' RetencionIVA += retencion.Attributes("importe").Value.ToDouble
' End If
' If retencion.Attributes("impuesto").Value = "ISR" Then
' RetencionISR += retencion.Attributes("importe").Value.ToDouble
' End If
' ' Do something.
'Next
' SumaTotalRetenciones += RetencionIVA
' SumaTotalRetenciones += RetencionISR
'TotalTraslados = ValorXML(node, "totalImpuestosTrasladados", "0").ToDouble
'Dim nodeTraslados As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Traslado", Prefijo), namespaces)
'For Each traslado As XmlNode In nodeTraslados
' If traslado.Attributes("impuesto").Value = "IVA" Then
' TrasladoIVA += traslado.Attributes("importe").Value.ToDouble
' End If
' If traslado.Attributes("impuesto").Value = "IEPS" Then
' TrasladoIEPS += traslado.Attributes("importe").Value.ToDouble
' End If
' 'If traslado.Attributes("impuesto").Value = "ISR" Then
' ' TrasladoISR = traslado.Attributes("importe").Value
' 'End If
' ' Do something.
'Next
'SumaTotalTraslados += TrasladoIVA
'SumaTotalTraslados += TrasladoIEPS
End If End If
End If End If
'Try
' _TFDUUID = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", Prefijo), namespaces).LastChild.Attributes("UUID").InnerText
'Catch ex As Exception
' _TFDUUID = ""
'End Try
End Sub End Sub
#End Region #End Region

File diff suppressed because it is too large Load Diff

View File

@@ -631,65 +631,64 @@ Partial Class Compras_ReembolsosComprobaciones
Dim IdCtaOtrosProductos As Integer = 0 Dim IdCtaOtrosProductos As Integer = 0
Dim CvePrePolizaUnificar As Integer = 0 Dim CvePrePolizaUnificar As Integer = 0
'Conta SIG
Dim CveCuentaProveedor As Integer = 0
Dim CveCuentaPersonal As Integer = 0
Dim SeUnifico = False Dim SeUnifico = False
'Obtenemos la cuenta del Personal o Caja Chica If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If CveCajaChica > 0 Then 'Obtenemos la cuenta del Personal o Caja Chica
If ObjMov.GetRetCuenta(30, CveCajaChica) Then If CveCajaChica > 0 Then
If ObjMov.DtResultados.Rows.Count > 0 Then If ObjMov.GetRetCuenta(30, CveCajaChica) Then
IdCuentaBancaria = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero If ObjMov.DtResultados.Rows.Count > 0 Then
IdCuentaBancaria = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
End If
End If
Else
If ObjMov.GetRetCuenta(29, CvePersonal) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaPersonal = ObjMov.DtResultados.Rows(0)("IdCtaContPersonal").ToString.ToEntero
End If
End If End If
End If End If
Else
If ObjMov.GetRetCuenta(29, CvePersonal) Then 'Obtenemos la cuenta del IVAxAcreditar
If ObjMov.GetRetCuenta(14, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaPersonal = ObjMov.DtResultados.Rows(0)("IdCtaContPersonal").ToString.ToEntero IdCtaIVAxAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
End If End If
End If End If
End If
'Obtenemos la cuenta del IVAxAcreditar 'Obtenemos la cuenta del IVAAcreditable
If ObjMov.GetRetCuenta(14, UsuarioActual.CveEmpresa) Then If ObjMov.GetRetCuenta(19, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaIVAxAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero IdCtaIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero
End If
End If End If
End If
'Obtenemos la cuenta del IVAAcreditable 'Obtenemos la cuenta del RetIVA
If ObjMov.GetRetCuenta(19, UsuarioActual.CveEmpresa) Then If ObjMov.GetRetCuenta(15, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero IdCtaRetIVA = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If End If
End If
'Obtenemos la cuenta del RetIVA 'Obtenemos la cuenta del RetISR
If ObjMov.GetRetCuenta(15, UsuarioActual.CveEmpresa) Then If ObjMov.GetRetCuenta(16, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaRetIVA = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero IdCtaRetISR = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If End If
End If
'Obtenemos la cuenta del RetISR 'Obtenemos la cuenta del IdCtaOtrosProductos
If ObjMov.GetRetCuenta(16, UsuarioActual.CveEmpresa) Then If ObjMov.GetRetCuenta(132, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaRetISR = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero IdCtaOtrosProductos = ObjMov.DtResultados.Rows(0)("IdCtaOtrosProductos").ToString.ToEntero
End If End If
End If
'Obtenemos la cuenta del IdCtaOtrosProductos
If ObjMov.GetRetCuenta(132, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaOtrosProductos = ObjMov.DtResultados.Rows(0)("IdCtaOtrosProductos").ToString.ToEntero
End If End If
End If End If
'inserto las compras que voy a pagar 'inserto las compras que voy a pagar
For Each gvr As GridViewRow In GvCxP.Rows For Each gvr As GridViewRow In GvCxP.Rows
If gvr.FCCheckBox("Chk").Checked Then If gvr.FCCheckBox("Chk").Checked Then
ConceptoMovimiento = $"{gvr.DataKey("Proveedor")} F:{gvr.DataKey("SerieFolio")} {If(DdlPersonal.Visible, DdlPersonal.SelectedItem.Text, DdlCajaChica.SelectedItem.Text)}" ConceptoMovimiento = $"{gvr.DataKey("Proveedor")} F:{gvr.DataKey("SerieFolio")} {If(DdlPersonal.Visible, DdlPersonal.SelectedItem.Text, DdlCajaChica.SelectedItem.Text)}"
Referencia = gvr.DataKey("SerieFolio").ToString Referencia = gvr.DataKey("SerieFolio").ToString
@@ -740,13 +739,21 @@ Partial Class Compras_ReembolsosComprobaciones
Dim ComisionTmp As Decimal = gvr.FCTextBox("TxtComision").Text.ToDecimal Dim ComisionTmp As Decimal = gvr.FCTextBox("TxtComision").Text.ToDecimal
'Otros Ingresos 'Otros Ingresos
If (ChkAjusteOI.Checked Or ChkOtrosIngresosCheque.Checked) AndAlso gvr.FCTextBox("TxtComision").Text.ToDecimal <> 0 Then If MsgError = "" AndAlso (ChkAjusteOI.Checked Or ChkOtrosIngresosCheque.Checked) AndAlso ComisionTmp <> 0 Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, 211, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio, CveCuenta:=CveCuentaProveedor) Then
Dim tOtCveCon As Integer = 211
Dim tOtTipoMovto As Boolean = False
If ComisionTmp < 0 Then
tOtTipoMovto = True : tOtCveCon = 78
ComisionTmp = Math.Abs(ComisionTmp)
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, tOtTipoMovto, ComisionTmp, Referencia, tOtCveCon, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ComisionTmp), ImporteMX:=ComisionTmp * tipoCambio) Then
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos" MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
End If End If
If CveCajaChica > 0 AndAlso Not HdnCheque.Value.ToEntero > 0 Then If CveCajaChica > 0 AndAlso Not HdnCheque.Value.ToEntero > 0 Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, 211, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio, CveCuenta:=CveCuentaProveedor, Contabilizable:=False) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, Not tOtTipoMovto, ComisionTmp, Referencia, tOtCveCon, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ComisionTmp), ImporteMX:=ComisionTmp * tipoCambio, Contabilizable:=False) Then
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos" MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
End If End If
End If End If
@@ -754,22 +761,21 @@ Partial Class Compras_ReembolsosComprobaciones
If gvr.DataKey("Original").ToDecimal > 0 Then PorcentajePago = (ImporteMovto / gvr.DataKey("Original").ToDecimal) Else PorcentajePago = 1 If gvr.DataKey("Original").ToDecimal > 0 Then PorcentajePago = (ImporteMovto / gvr.DataKey("Original").ToDecimal) Else PorcentajePago = 1
If Not ChkReembolsarSinBancos.Checked AndAlso (Not HdnCheque.Value.ToEntero > 0 Or Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then If MsgError = "" AndAlso Not ChkReembolsarSinBancos.Checked AndAlso (Not HdnCheque.Value.ToEntero > 0 Or Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then
Dim ImporteMovtoTmp As Decimal = ImporteMovto Dim ImporteMovtoTmp As Decimal = ImporteMovto
If ComisionTmp < 0 Then 'If ComisionTmp < 0 Then
ImporteMovtoTmp = ImporteMovto + ComisionTmp ' ImporteMovtoTmp = ImporteMovto + ComisionTmp
End If 'End If
'Si es caja chica metemos el concepto 30, si es funcionario metemos 29 'Si es caja chica metemos el concepto 30, si es funcionario metemos 29
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, ImporteMovtoTmp, Referencia, If(CveCajaChica > 0, 30, 29), ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEPago, CveIEDevolucion:=If(CveCajaChica > 0, If(DDlCheques.SelectedValue.ToEntero = -1, CveIECajaChica, DDlCheques.SelectedValue.ToEntero), -1), CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovtoTmp), ImporteMX:=ImporteMovtoTmp * tipoCambio, CveCuenta:=CveCuentaPersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, ImporteMovtoTmp, Referencia, If(CveCajaChica > 0, 30, 29), ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEPago, CveIEDevolucion:=If(CveCajaChica > 0, If(DDlCheques.SelectedValue.ToEntero = -1, CveIECajaChica, DDlCheques.SelectedValue.ToEntero), -1), CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovtoTmp), ImporteMX:=ImporteMovtoTmp * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then
MsgError = "Detalle" MsgError = "Detalle"
End If End If
End If End If
'Pago Proveedores 'Pago Proveedores
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, ImporteMovto, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, ImporteMovto, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle" MsgError = "Detalle"
End If End If
@@ -824,134 +830,55 @@ Partial Class Compras_ReembolsosComprobaciones
End If End If
If MsgError = "" AndAlso gvr.DataKey("RetIVA").ToDecimal > 0 Then If MsgError = "" AndAlso gvr.DataKey("RetIVA").ToDecimal > 0 Then
Dim ConceptoContableRetIVAXAcreditar = 0, ConceptoContableRetIVAAcreditable = 0, IdCtaContableRetIVAXAcreditar = 0, IdCtaContableRetIVAAcreditable = 0 Dim ConceptoContableRetIVAXAcreditar = 0, ConceptoContableRetIVAAcreditable = 0, IdCtaContableRetIVAXAcreditar = 0, IdCtaContableRetIVAAcreditable = 0, CveFunc = 0, CveFuncAcreditable = 0
Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero
Case 1 Case 1
ConceptoContableRetIVAXAcreditar = 15 ConceptoContableRetIVAXAcreditar = 15
ConceptoContableRetIVAAcreditable = 22 ConceptoContableRetIVAAcreditable = 22
If IdCtaRetIVA > 0 Then CveFunc = 307
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA CveFuncAcreditable = 308
ElseIf UsuarioActual.Empresa.Funcionalidad(307).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(307).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(308).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(308).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
Case 2 Case 2
ConceptoContableRetIVAXAcreditar = 183 ConceptoContableRetIVAXAcreditar = 183
ConceptoContableRetIVAAcreditable = 184 ConceptoContableRetIVAAcreditable = 184
If IdCtaRetIVA > 0 Then CveFunc = 309
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA CveFuncAcreditable = 310
ElseIf UsuarioActual.Empresa.Funcionalidad(309).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(309).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(310).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(310).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
Case 3 Case 3
ConceptoContableRetIVAXAcreditar = 185 ConceptoContableRetIVAXAcreditar = 185
ConceptoContableRetIVAAcreditable = 186 ConceptoContableRetIVAAcreditable = 186
If IdCtaRetIVA > 0 Then CveFunc = 311
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA CveFuncAcreditable = 312
ElseIf UsuarioActual.Empresa.Funcionalidad(311).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(311).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(312).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(312).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
Case 4 Case 4
ConceptoContableRetIVAXAcreditar = 248 ConceptoContableRetIVAXAcreditar = 248
ConceptoContableRetIVAAcreditable = 249 ConceptoContableRetIVAAcreditable = 249
If IdCtaRetIVA > 0 Then CveFunc = 313
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA CveFuncAcreditable = 314
ElseIf UsuarioActual.Empresa.Funcionalidad(313).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(313).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(314).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(314).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
Case 5
ConceptoContableRetIVAXAcreditar = 285
ConceptoContableRetIVAAcreditable = 286
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(577).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(577).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(578).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(578).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End Select End Select
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(CveFunc).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(CveFunc).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(CveFuncAcreditable).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(CveFuncAcreditable).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End If
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
If ImporteMovto = gvr.FCLiteral("LtlSaldo").Text.ToDouble Then If ImporteMovto = gvr.FCLiteral("LtlSaldo").Text.ToDouble Then
'Agrego el RetIVA 'Agrego el RetIVA
@@ -975,15 +902,47 @@ Partial Class Compras_ReembolsosComprobaciones
MsgError = "Detalle" MsgError = "Detalle"
End If End If
End If End If
Dim AcreditaISR As Boolean = False
If UsuarioActual.CveEmpresa = 140 Then AcreditaISR = True
If MsgError = "" AndAlso AcreditaISR AndAlso gvr.DataKey("RetISR").ToDecimal > 0 Then
Dim ConceptoContableRetISRXAcreditar = 0, ConceptoContableRetISRAcreditable = 0, IdCtaContableRetISRXAcreditar = 0, IdCtaContableRetISRAcreditable = 0
Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero
Case 1
ConceptoContableRetISRXAcreditar = 16
ConceptoContableRetISRAcreditable = 23
Case 2
ConceptoContableRetISRXAcreditar = 243
ConceptoContableRetISRAcreditable = 244
CveFunc = 309
CveFuncAcreditable = 310
Case 3
ConceptoContableRetISRXAcreditar = 327
ConceptoContableRetISRAcreditable = 328
CveFunc = 311
End Select
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRXAcreditar, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRAcreditable, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
End If
End If End If
Dim SaldoExcedente As Decimal = gvr.FCTextBox("TxtSaldoExcedente").Text.ToDecimal
If MsgError = "" AndAlso UsuarioActual.Empresa.Funcionalidad(506) = "1" And CbPermitirExcedente.Checked = True And SaldoExcedente > 0 Then
Dim SaldoExcedente As Double = gvr.FCTextBox("TxtSaldoExcedente").Text.ToDecimal
If UsuarioActual.Empresa.Funcionalidad(506) = "1" And CbPermitirExcedente.Checked = True And SaldoExcedente > 0 Then
If DDlPermitirExcedente.SelectedValue = "1" Then If DDlPermitirExcedente.SelectedValue = "1" Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=(SaldoExcedente) * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=(SaldoExcedente) * tipoCambio, CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle Reembolso Personal" MsgError = "Detalle Reembolso Personal"
End If End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 132, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaOtrosProductos, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 132, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaOtrosProductos, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
@@ -991,17 +950,17 @@ Partial Class Compras_ReembolsosComprobaciones
End If End If
ElseIf DDlPermitirExcedente.SelectedValue = "2" Then ElseIf DDlPermitirExcedente.SelectedValue = "2" Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaProveedor, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, False, SaldoExcedente, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle Reembolso Personal Excedente" MsgError = "Detalle Reembolso Personal Excedente"
End If End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 29, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaPersonal, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CveCuenta:=CveCuentaPersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 29, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaPersonal, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle Reembolso Personal Excedente" MsgError = "Detalle Reembolso Personal Excedente"
End If End If
End If End If
End If End If
'Unificamos el cheque y la caja chica con los pagos y facturas 'Unificamos el cheque y la caja chica con los pagos y facturas
If Not IdPoliza > 0 AndAlso Not gvr.DataKey("IdPoliza").ToEntero > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(219) = "1" Then If MsgError = "" AndAlso Not IdPoliza > 0 AndAlso Not gvr.DataKey("IdPoliza").ToEntero > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(219) = "1" Then
If MsgError = "" Then If MsgError = "" Then
'CvePrePolizaUnificar = CvePrePolizaPago 'CvePrePolizaUnificar = CvePrePolizaPago
''codigo temoral, RMF. falta criterio de unificacion, en una póliza nueva de diario ''codigo temoral, RMF. falta criterio de unificacion, en una póliza nueva de diario
@@ -1023,7 +982,7 @@ Partial Class Compras_ReembolsosComprobaciones
End If End If
'CHEQUE EXCEDENTE - NUEVO 'CHEQUE EXCEDENTE - NUEVO
If ChkChequeExcedente.Checked And ImportePagar > 0 Then If MsgError = "" AndAlso ChkChequeExcedente.Checked And ImportePagar > 0 Then
ImporteMovto = ImportePagar ImporteMovto = ImportePagar
If ImportePagar = ImporteOriginal Then If ImportePagar = ImporteOriginal Then
@@ -1038,7 +997,7 @@ Partial Class Compras_ReembolsosComprobaciones
If gvr.DataKey("Original").ToDecimal > 0 Then PorcentajePago = (ImporteMovto / gvr.DataKey("Original").ToDecimal).RoundSQL Else PorcentajePago = 1 If gvr.DataKey("Original").ToDecimal > 0 Then PorcentajePago = (ImporteMovto / gvr.DataKey("Original").ToDecimal).RoundSQL Else PorcentajePago = 1
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, ImporteMovto, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=(ImporteMovto * tipoCambio), CveCuenta:=CveCuentaProveedor) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, ImporteMovto, Referencia, CveConceptoContablePago, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=(ImporteMovto * tipoCambio)) Then
MsgError = "Detalle" MsgError = "Detalle"
Exit For Exit For
Else Else
@@ -1048,7 +1007,7 @@ Partial Class Compras_ReembolsosComprobaciones
'Otros Ingresos 'Otros Ingresos
If ChkAjusteOI.Checked Then If ChkAjusteOI.Checked Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, UsuarioActual.Empresa.IdCuentaOtrosIngresos, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio, CveCuenta:=CveCuentaProveedor) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, UsuarioActual.Empresa.IdCuentaOtrosIngresos, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio) Then
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos" MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
End If End If
End If End If
@@ -1108,110 +1067,59 @@ Partial Class Compras_ReembolsosComprobaciones
End If End If
If MsgError = "" AndAlso gvr.DataKey("RetIVA").ToDecimal > 0 Then If MsgError = "" AndAlso gvr.DataKey("RetIVA").ToDecimal > 0 Then
Dim ConceptoContableRetIVAXAcreditar = 0, ConceptoContableRetIVAAcreditable = 0, IdCtaContableRetIVAXAcreditar = 0, IdCtaContableRetIVAAcreditable = 0 Dim ConceptoContableRetIVAXAcreditar = 0, ConceptoContableRetIVAAcreditable = 0, IdCtaContableRetIVAXAcreditar = 0, IdCtaContableRetIVAAcreditable = 0, CveFunc = 0, CveFuncAcreditable = 0
Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero
Case 1 Case 1
ConceptoContableRetIVAXAcreditar = 15 ConceptoContableRetIVAXAcreditar = 15
ConceptoContableRetIVAAcreditable = 22 ConceptoContableRetIVAAcreditable = 22
If IdCtaRetIVA > 0 Then CveFunc = 307
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA CveFuncAcreditable = 308
ElseIf UsuarioActual.Empresa.Funcionalidad(307).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(307).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(308).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(308).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
Case 2 Case 2
ConceptoContableRetIVAXAcreditar = 183 ConceptoContableRetIVAXAcreditar = 183
ConceptoContableRetIVAAcreditable = 184 ConceptoContableRetIVAAcreditable = 184
If IdCtaRetIVA > 0 Then CveFunc = 309
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA CveFuncAcreditable = 310
ElseIf UsuarioActual.Empresa.Funcionalidad(309).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(309).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(310).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(310).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
Case 3 Case 3
ConceptoContableRetIVAXAcreditar = 185 ConceptoContableRetIVAXAcreditar = 185
ConceptoContableRetIVAAcreditable = 186 ConceptoContableRetIVAAcreditable = 186
If IdCtaRetIVA > 0 Then CveFunc = 311
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA CveFuncAcreditable = 312
ElseIf UsuarioActual.Empresa.Funcionalidad(311).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(311).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(312).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(312).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
Case 4 Case 4
ConceptoContableRetIVAXAcreditar = 248 ConceptoContableRetIVAXAcreditar = 248
ConceptoContableRetIVAAcreditable = 249 ConceptoContableRetIVAAcreditable = 249
If IdCtaRetIVA > 0 Then CveFunc = 313
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA CveFuncAcreditable = 314
ElseIf UsuarioActual.Empresa.Funcionalidad(313).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(313).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(314).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(314).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End Select End Select
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAXAcreditar = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(CveFunc).ToEntero > 0 Then
IdCtaContableRetIVAXAcreditar = UsuarioActual.Empresa.Funcionalidad(CveFunc).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAXAcreditar, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAXAcreditar = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
If IdCtaRetIVA > 0 Then
IdCtaContableRetIVAAcreditable = IdCtaRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(CveFuncAcreditable).ToEntero > 0 Then
IdCtaContableRetIVAAcreditable = UsuarioActual.Empresa.Funcionalidad(CveFuncAcreditable).ToEntero
Else
If ObjMov.GetRetCuenta(ConceptoContableRetIVAAcreditable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContableRetIVAAcreditable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End If
'Agrego el RetIVA 'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, False, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetIVAXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAXAcreditar, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, False, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetIVAXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetIVAXAcreditar, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetIVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
MsgError = "Detalle" MsgError = "Detalle"
@@ -1223,10 +1131,44 @@ Partial Class Compras_ReembolsosComprobaciones
End If End If
End If End If
Dim AcreditaISR As Boolean = False
If UsuarioActual.CveEmpresa = 140 Then AcreditaISR = True
If MsgError = "" AndAlso AcreditaISR AndAlso gvr.DataKey("RetISR").ToDecimal > 0 Then
Dim ConceptoContableRetISRXAcreditar = 0, ConceptoContableRetISRAcreditable = 0, IdCtaContableRetISRXAcreditar = 0, IdCtaContableRetISRAcreditable = 0, CveFunc = 0, CveFuncAcreditable = 0
Select Case gvr.DataKey("CveRetIVAConcepto").ToEntero
Case 1
ConceptoContableRetISRXAcreditar = 16
ConceptoContableRetISRAcreditable = 23
Case 2
ConceptoContableRetISRXAcreditar = 243
ConceptoContableRetISRAcreditable = 244
CveFunc = 309
CveFuncAcreditable = 310
Case 3
ConceptoContableRetISRXAcreditar = 327
ConceptoContableRetISRAcreditable = 328
CveFunc = 311
End Select
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, False, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRXAcreditar, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRXAcreditar, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
'Agrego el RetIVA
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.DataKey("RetISR").ToDecimal * PorcentajePago, Referencia, ConceptoContableRetISRAcreditable, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaContableRetISRAcreditable, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("RetISR").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaExcedente, CvePersonal:=CvePersonal) Then
MsgError = "Detalle"
End If
End If
End If End If
If ImportePagar = ImporteOriginal Then If MsgError = "" AndAlso ImportePagar = ImporteOriginal Then
'Unificamos el cheque y la caja chica con los pagos y facturas 'Unificamos el cheque y la caja chica con los pagos y facturas
If gvr.DataKey("IdPoliza").ToEntero = 0 AndAlso UsuarioActual.Empresa.Funcionalidad(219) = "1" Then If gvr.DataKey("IdPoliza").ToEntero = 0 AndAlso UsuarioActual.Empresa.Funcionalidad(219) = "1" Then
If Not ObjMov.PrePolizaUnificacion(CvePrePolizaExcedente, CvePrePolizaPago) Then If Not ObjMov.PrePolizaUnificacion(CvePrePolizaExcedente, CvePrePolizaPago) Then
@@ -1277,7 +1219,6 @@ Partial Class Compras_ReembolsosComprobaciones
End If End If
If MsgError.Trim = "" Then If MsgError.Trim = "" Then
'Conta SIG AUTOMATICA
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1" Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
If UsuarioActual.CveEmpresa = 119 Then If UsuarioActual.CveEmpresa = 119 Then
@@ -1358,12 +1299,21 @@ Partial Class Compras_ReembolsosComprobaciones
If CvePrePolizaExcedente > 0 Then If CvePrePolizaExcedente > 0 Then
Mensaje.AppendFormat("Abono Registrado Correctamente. <br/><br/> Cheque: <a target='_blank' href=/Bancos/IE.aspx?CveIE={0}>{1}</a> <br/><br/> <a target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={2}"">Imprimir</a>", CveIEExcedente, TxtFolio.Text, Encripta(String.Format("OP=ImprimeMov&CveIE={0}", CveIEExcedente))) Mensaje.AppendFormat("Abono Registrado Correctamente. <br/><br/> Cheque: <a target='_blank' href=/Bancos/IE.aspx?CveIE={0}>{1}</a> <br/><br/> <a target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={2}"">Imprimir</a>", CveIEExcedente, TxtFolio.Text, Encripta(String.Format("OP=ImprimeMov&CveIE={0}", CveIEExcedente)))
Mensaje.AppendFormat("</br> <br/>Póliza: <b> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' class='Texto' target='_blank'>{1}</a><br/>", ObjMov.ContaIdPoliza, ObjMov.ContaFolio) If UsuarioActual.Empresa.TipoContabilidad = 2 Then
Mensaje.AppendFormat("</br> <br/>Póliza: <b> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' class='Texto' target='_blank'>{1}</a><br/>", ObjMov.ContaIdPoliza, ObjMov.ContaFolio)
Else
Mensaje.AppendFormat("</br> <br/>Póliza: <b> <a href='/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}' class='Texto' target='_blank'>{1}</a><br/>", CvePrePolizaExcedente, ObjMov.ContaFolio)
End If
Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) Alert(Mensaje.ToString, TipoMensaje.MsgInformacion)
Else Else
Mensaje.AppendFormat("Abono Registrado Correctamente. <br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir</a>", Encripta(String.Format("OP=ImprimeMov&CveIE={0}", CveIERegistrado))) Mensaje.AppendFormat("Abono Registrado Correctamente. <br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir</a>", Encripta(String.Format("OP=ImprimeMov&CveIE={0}", CveIERegistrado)))
If CvePrePolizaIERegistrado > 0 Then If CvePrePolizaIERegistrado > 0 Then
Mensaje.AppendFormat("</br> <br/>Póliza: <b> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' class='Texto' target='_blank'>{1}</a><br/>", ObjMov.ContaIdPoliza, ObjMov.ContaFolio) If UsuarioActual.Empresa.TipoContabilidad = 2 Then
Mensaje.AppendFormat("</br> <br/>Póliza: <b> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' class='Texto' target='_blank'>{1}</a><br/>", ObjMov.ContaIdPoliza, ObjMov.ContaFolio)
Else
Mensaje.AppendFormat("</br> <br/>Póliza: <b> <a href='/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}' class='Texto' target='_blank'>{1}</a><br/>", CvePrePolizaIERegistrado, ObjMov.ContaFolio)
End If
End If End If
Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) Alert(Mensaje.ToString, TipoMensaje.MsgInformacion)
End If End If
@@ -1735,163 +1685,19 @@ Partial Class Compras_ReembolsosComprobaciones
#Region "VIATICOS" #Region "VIATICOS"
Protected Sub ChkAplicaViatico_CheckedChanged(sender As Object, e As EventArgs) Protected Sub ChkAplicaViatico_CheckedChanged(sender As Object, e As EventArgs)
If ChkAplicaViatico.Checked Then ' If ChkAplicaViatico.Checked Then
Dim Retorno = TimbrarNomina12(DdlPersonal.SelectedValue.ToEntero) ' Dim Retorno = TimbrarNomina12(DdlPersonal.SelectedValue.ToEntero)
If Retorno <> "" Then ' If Retorno <> "" Then
Alert(Retorno, TipoMensaje.MsgError) ' Alert(Retorno, TipoMensaje.MsgError)
Else ' Else
Dim SerieFolio = $"VIA-{Folio}" ' Dim SerieFolio = $"VIA-{Folio}"
Dim Msg As New StringBuilder ' Dim Msg As New StringBuilder
Msg.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=DesXmlVIA&SERIEFOLIO={0}&TIPO={1}", SerieFolio, "Viaticos Comprobados"))) ' Msg.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=DesXmlVIA&SERIEFOLIO={0}&TIPO={1}", SerieFolio, "Viaticos Comprobados")))
Alert(Msg.ToString) ' Alert(Msg.ToString)
End If ' End If
End If ' End If
End Sub End Sub
Private Function TimbrarNomina12(CvePersonal As Integer) As String
Dim Retorno As String = ""
UsuarioActual.Empresa.CvePAC = 2
Dim sw As New Diagnostics.Stopwatch
sw.Start()
Select Case UsuarioActual.Empresa.CvePAC
Case 1
'Retorno = TimbrarBIInformNomina12(CveNomina, CvePersonal, CvePeriodo)
Case 2, 4
Dim cfdi As CFDITimbre = PreTimbrar(CvePersonal)
If cfdi Is Nothing Then
sw.Stop()
Return "No tiene asignado un folio de viaticos"
End If
If cfdi IsNot Nothing AndAlso cfdi.Mensaje = "" Then
Dim ObjTimbrado As New Timbrado
Dim ObjFactura As New Modelos.Factura
ObjFactura.TipoDocto = "Viaticos Comprobados"
ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero
ObjFactura.Serie = cfdi.Comprobante.Serie
ObjFactura.Timbre = cfdi
If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) Then
Retorno = ObjTimbrado.MensajeErrorCFDI
End If
'Retorno = TimbrarFacturaRealVirtual(cfdi, UsuarioActual)
If Retorno <> "" Then
Retorno = $"{Retorno} - {cfdi.Receptor.Nombre}"
Else
'Genero la addenda Ford
' GeneraPDFNuevo(String.Format("{0}XML\Nomina\{1}.xml", Ruta, NominaFolio), CvePersonal, CvePeriodo)
End If
Else
Retorno = $"No se pudo generar el pretimbre: <br/> {cfdi.Mensaje}"
End If
End Select
sw.Stop()
GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString, UsuarioActual.Empresa.CvePAC, "Nomina")
Return Retorno
End Function
Private Function PreTimbrar(CvePersonal As Integer) As CFDITimbre
Dim cfdi As New CFDITimbre
Dim ObjFolio As New ClsGralFolios
If ObjFolio.GetFolios("VIA", UsuarioActual.CveEmpresa) Then
If ObjFolio.DtResultados.Rows.Count > 0 Then
Folio = ObjFolio.DtResultados.Rows(0)("FActual").ToString
Else
ObjFolio.Dispose()
Return Nothing
End If
End If
ObjFolio.Dispose()
Dim objPersonal As New ClsRH
objPersonal.GetPersonal(CvePersonal, UsuarioActual.CveEmpresa)
Dim AntiguedadSemanas As Integer = DateDiff(DateInterval.Weekday, objPersonal.FechaIngreso, Now).ToEntero
cfdi.Nomina = New CFDINomina
cfdi.Nomina.Version = "1.2"
cfdi.Nomina.TipoNomina = "E"
cfdi.Nomina.FechaPago = LtChequeFecha.Text.ToDate
cfdi.Nomina.FechaInicio = LtChequeFecha.Text
cfdi.Nomina.FechaFin = LtChequeFecha.Text
cfdi.Nomina.NumDiasPagados = 1
cfdi.Emisor.Nombre = UsuarioActual.Empresa.Empresa
cfdi.Emisor.RFC = UsuarioActual.Empresa.RFC
cfdi.Emisor.RegistroPatronal = objPersonal.DtResultados.Rows(0)("RegistroPatronal").ToString()
cfdi.Emisor.RegimenFiscal = UsuarioActual.Empresa.CodigoRegimenFiscal
'aplica persona fisica debe de tener CURP
If cfdi.Emisor.RegimenFiscal.Contiene("605", "606", "608", "611", "612", "614", "616", "621", "622", "629", "630", "615") Then
cfdi.Emisor.CURP = UsuarioActual.Empresa.CURP
End If
cfdi.Receptor.UsoCFDI = "P01"
cfdi.Receptor.RFC = objPersonal.RFC
cfdi.Receptor.Nombre = objPersonal.NombreCompleto
Dim ObjDeducciones As New List(Of CFDINominaDeducciones)
ObjDeducciones.Add(New CFDINominaDeducciones With {.TipoDeduccion = "081",
.Clave = "081",
.Concepto = "Ajuste de viáticos entregados al trabajador",
.Importe = TxtChequeSaldo.Text.ToDecimal}
)
If ObjDeducciones IsNot Nothing AndAlso ObjDeducciones.Count > 0 Then cfdi.Nomina.Deducciones = ObjDeducciones
Dim ObjPercepcion As New List(Of CFDINominaPercepciones)
ObjPercepcion.Add(New CFDINominaPercepciones With {.TipoPercepcion = "050",
.Clave = "050",
.Concepto = "Viáticos",
.ImporteExento = TxtChequeSaldo.Text.ToDecimal,
.ImporteGravado = 0}
)
If ObjPercepcion IsNot Nothing AndAlso ObjPercepcion.Count > 0 Then cfdi.Nomina.Percepciones = ObjPercepcion
cfdi.Comprobante.Version = "3.3"
cfdi.Comprobante.Serie = "VIA"
cfdi.Comprobante.Folio = Folio
cfdi.Comprobante.Fecha = Now
cfdi.Comprobante.Subtotal = TxtChequeSaldo.Text.ToDecimal
cfdi.Comprobante.Descuentos = cfdi.Nomina.TotalDeducciones.ToDecimal
cfdi.Comprobante.Total = TxtChequeSaldo.Text.ToDecimal - cfdi.Nomina.TotalDeducciones.ToDecimal
cfdi.Comprobante.MotivoDescuento = ""
cfdi.Comprobante.Moneda = "MXN"
cfdi.Comprobante.TipoComprobante = "N"
cfdi.Comprobante.TipoDocto = "Egs"
cfdi.Comprobante.MetodoPago = "PUE"
cfdi.Comprobante.CondicionesdePago = ""
cfdi.Comprobante.FormadePago = "99"
cfdi.Comprobante.LugarExpedicion = UsuarioActual.Empresa.CP.ToString
cfdi.Comprobante.NumCuentaPago = ""
cfdi.Nomina.Receptor.CURP = objPersonal.CURP
cfdi.Nomina.Receptor.NSS = objPersonal.NumeroSS
cfdi.Nomina.Receptor.FechaInicioContrato = objPersonal.FechaInicioContrato.ToShortDateString
cfdi.Nomina.Receptor.Antiguedad = $"P{AntiguedadSemanas}W"
cfdi.Nomina.Receptor.TipoContrato = objPersonal.CodigoTipoContrato
cfdi.Nomina.Receptor.CodigoTipoJornada = objPersonal.ClaveTipoJornada
cfdi.Nomina.Receptor.CodigoRegimenContratacion = If(objPersonal.CveRegimenContratacion = "", "99", objPersonal.CveRegimenContratacion)
cfdi.Nomina.Receptor.CodigoEmpleado = objPersonal.Codigo
cfdi.Nomina.Receptor.Departamento = objPersonal.Departamento
cfdi.Nomina.Receptor.Puesto = objPersonal.Puesto
cfdi.Nomina.Receptor.CodigoRiesgoPuesto = If(objPersonal.CveSATRiesgoPuesto.ToString = "0", "99", objPersonal.CveSATRiesgoPuesto.ToString)
cfdi.Nomina.Receptor.TipoPeriodo = objPersonal.TipoPeriodoPago
cfdi.Nomina.Receptor.CodigoBanco = objPersonal.ClaveBanco
cfdi.Nomina.Receptor.NumeroCuenta = objPersonal.BancoNumCuenta
cfdi.Nomina.Receptor.SDI = objPersonal.SDI
cfdi.Nomina.Receptor.SBC = objPersonal.SDI
cfdi.Nomina.Receptor.Sindicalizado = ""
cfdi.Nomina.Receptor.CodigoEntidadFederativa = objPersonal.ClaveEstado
cfdi.Conceptos.Add(New CFDIConceptos With {.Cantidad = 1, .ClaveUnidad = "ACT", .ClaveProdServ = "84111505", .Descripcion = "Pago de nómina", .ValorUnitario = cfdi.Nomina.TotalPercepciones + cfdi.Nomina.TotalOtrosPagos, .Importe = cfdi.Nomina.TotalPercepciones + cfdi.Nomina.TotalOtrosPagos, .Descuento = cfdi.Nomina.TotalDeducciones.ToDecimal})
objPersonal.Dispose()
Return cfdi
End Function
#End Region #End Region

View File

@@ -553,7 +553,7 @@ Partial Class Contabilidad2_CatCuentas
item.Controls.Add(objul) item.Controls.Add(objul)
End If End If
ArbolCuentas.additem(objul, idnew, IDSelected, String.Format("{0} - {1}", TxtCuenta.Text, Tnombre.Text)) ArbolCuentas.additem(objul, idnew, IDSelected, String.Format("{0} - {1}", TxtCuenta.Text, Tnombre.Text))
CargaDatos()
End If End If
End If End If
If ObjConta2 IsNot Nothing Then ObjConta2.Dispose() If ObjConta2 IsNot Nothing Then ObjConta2.Dispose()
@@ -568,6 +568,8 @@ Partial Class Contabilidad2_CatCuentas
If Not TieneError Then If Not TieneError Then
ObjConta.Commit() ObjConta.Commit()
CargaDatos()
LimpiarCampos() LimpiarCampos()
updatos.Update() updatos.Update()
Alert("La cuenta se guardo correctamente", TipoMensaje.MsgInformacion) Alert("La cuenta se guardo correctamente", TipoMensaje.MsgInformacion)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -423,7 +423,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
DdlUnidadRec.DataBind(); DdlUnidadRec.DataBind();
TxtFechaI.Text = DateTime.Now.AddDays(-1).ToShortDateString(); TxtFechaI.Text = DateTime.Now.AddDays(-1).ToShortDateString();
TxtFechaF.Text = DateTime.Now.ToShortDateString(); TxtFechaF.Text = DateTime.Now.AddDays(3).ToShortDateString();
DdlChofer.DataSource = get_GlobalDTChoferes(UsuarioActual.CveEmpresa); DdlChofer.DataSource = get_GlobalDTChoferes(UsuarioActual.CveEmpresa);
DdlChofer.DataBind(); DdlChofer.DataBind();

View File

@@ -228,9 +228,9 @@ Partial Class Inventarios_Default
Private Sub CargarMedRin() Private Sub CargarMedRin()
Dim ObjGral As New ClsGenerales Dim ObjGral As New ClsGenerales
If ObjGral.GetMedidas(UsuarioActual.CveEmpresa) Then If ObjGral.GetMedidas(UsuarioActual.CveEmpresa) Then
DdlMedidas.DataSource = ObjGral.DtResultados DdlMedidas.DataSource = ObjGral.DtResultados.FiltraParametros("", Orderby:="Medida")
If ObjGral.GetRimTamanios(UsuarioActual.CveEmpresa) Then If ObjGral.GetRimTamanios(UsuarioActual.CveEmpresa) Then
DdlRin.DataSource = ObjGral.DtResultados DdlRin.DataSource = ObjGral.DtResultados.FiltraParametros("", Orderby:="RinTamaño")
End If End If
End If End If
ObjGral.Dispose() ObjGral.Dispose()

View File

@@ -696,8 +696,9 @@ Partial Class PV
Private ReadOnly Property ClasificacionesDescuentos As Dictionary(Of Integer, Decimal) Private ReadOnly Property ClasificacionesDescuentos As Dictionary(Of Integer, Decimal)
Get Get
Return New Dictionary(Of Integer, Decimal) From { Return New Dictionary(Of Integer, Decimal) From {
{20516, 0.23D}, 'Descuento para lubricantes LTH {20516, 0.21D}, 'Descuento para lubricantes LTH
{20515, 0.25D} 'Descuento para filtros LTH {20515, 0.25D}, 'Descuento para filtros LTH
{20518, 0.183D} 'Descuento para pilas alcalinas -- segun
} }
End Get End Get
End Property End Property
@@ -4392,7 +4393,10 @@ Partial Class PV
End If End If
End If End If
Else Else
If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then If CveMarcaPS = 1092 Then ' E140 - alcalinas LTH
Descuento = ((Cantidad * PU) * 0.183D).RoundSQL(2)
End If
If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515, 20518) Then
Descuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero)).RoundSQL(2) Descuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero)).RoundSQL(2)
End If End If
End If End If

View File

@@ -76,7 +76,7 @@ public partial class Ventas_RepCancelacionesPorAtender : ClsPaginas
protected void btnAceptar_Click(object sender, EventArgs e) protected void btnAceptar_Click(object sender, EventArgs e)
{ {
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
Cancelacion.CancelacionSoapClient objServicio = new Cancelacion.CancelacionSoapClient(); Cancelacion2022.CancelacionSoapClient objServicio = new Cancelacion2022.CancelacionSoapClient();
try try
{ {
@@ -98,7 +98,7 @@ public partial class Ventas_RepCancelacionesPorAtender : ClsPaginas
//var acusesat = Timbrado.VerificarVigenciaSAT(Uuid, RFC, RFCReceptor, Total, true); //var acusesat = Timbrado.VerificarVigenciaSAT(Uuid, RFC, RFCReceptor, Total, true);
//if (acusesat != null && acusesat.EsCancelable.Contains("Cancelable")) //if (acusesat != null && acusesat.EsCancelable.Contains("Cancelable"))
//{ //{
Cancelacion.StructCancel resp = objServicio.AceptaRechaza(RFCReceptor, PACUsuario, PACContrasenia, CertB64, KeyB64, ClaveReceptor, Uuid, "Aceptación"); Cancelacion2022.StructCancel resp = objServicio.AceptaRechaza(RFCReceptor, PACUsuario, PACContrasenia, CertB64, KeyB64, ClaveReceptor, Uuid, "Aceptación");
if (resp.Estado == 0) if (resp.Estado == 0)
{ {
Alert("Aceptación de cancelación exitosa"); Alert("Aceptación de cancelación exitosa");
@@ -126,7 +126,7 @@ public partial class Ventas_RepCancelacionesPorAtender : ClsPaginas
protected void btnRechazar_Click(object sender, EventArgs e) protected void btnRechazar_Click(object sender, EventArgs e)
{ {
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
Cancelacion.CancelacionSoapClient objServicio = new Cancelacion.CancelacionSoapClient(); Cancelacion2022.CancelacionSoapClient objServicio = new Cancelacion2022.CancelacionSoapClient();
try try
{ {
@@ -145,7 +145,7 @@ public partial class Ventas_RepCancelacionesPorAtender : ClsPaginas
//var acusesat = Timbrado.VerificarVigenciaSAT(Uuid, "", RFCReceptor, total, true); //var acusesat = Timbrado.VerificarVigenciaSAT(Uuid, "", RFCReceptor, total, true);
Cancelacion.StructCancel resp = objServicio.AceptaRechaza(RFCReceptor, PACUsuario, PACContrasenia, CertB64, KeyB64, ClaveReceptor, Uuid, "Rechazo"); Cancelacion2022.StructCancel resp = objServicio.AceptaRechaza(RFCReceptor, PACUsuario, PACContrasenia, CertB64, KeyB64, ClaveReceptor, Uuid, "Rechazo");
if (resp.Estado == 0) if (resp.Estado == 0)
{ {
Alert("Aceptación de cancelación exitosa"); Alert("Aceptación de cancelación exitosa");
@@ -160,7 +160,7 @@ public partial class Ventas_RepCancelacionesPorAtender : ClsPaginas
} }
catch (Exception ex) catch (Exception ex)
{ {
//Alert(ex.ToString(), ModExtensiones.TipoMensaje.MsgError); //Alert(ex.ToString(), ModExtensiones.TipoMensaje.MsgError);
this.OnError("Ocurrió un error al rechazar la cancelación", ex); this.OnError("Ocurrió un error al rechazar la cancelación", ex);
} }
} }

View File

@@ -2467,21 +2467,27 @@
<div class="row rowpadding"> <div class="row rowpadding">
<label class="col-md-2">Emitir:</label> <label class="col-md-2">Emitir:</label>
<div class="col-md-10"> <div class="col-md-10">
<asp:CheckBox ID="ChkEmitirCartaPorte" runat="server" CssClass="chksino" Text=" " /> <asp:CheckBox ID="ChkEmitirCartaPorte" runat="server" CssClass="chksino" Text=" " OnCheckedChanged="ChkEmitirCartaPorte_CheckedChanged" AutoPostBack="true" />
</div> </div>
</div> </div>
<br /> <br />
<div class="row rowpadding"> <div class="row rowpadding">
<label class="col-md-2">Origen:</label> <label class="col-md-2">Origen:</label>
<div class="col-md-10"> <div class="col-md-10">
<asp:TextBox ID="TxtOrigenCP" runat="server" Enabled="false" Text="" CssClass="form-control input-sm"></asp:TextBox> <asp:DropDownList ID="DdlDireccionOrigen" runat="server" AutoPostBack="true" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="SucursalClienteVentaDireccion" DataValueField="CveDireccionEnvio" Width="100%" OnSelectedIndexChanged="DdlDireccionOrigen_SelectedIndexChanged">
<asp:ListItem Selected="true" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<%--<asp:TextBox ID="TxtOrigenCP" runat="server" Enabled="false" Text="" CssClass="form-control input-sm"></asp:TextBox>--%>
</div> </div>
</div> </div>
<br /> <br />
<div class="row rowpadding"> <div class="row rowpadding">
<label class="col-md-2">Destino:</label> <label class="col-md-2">Destino:</label>
<div class="col-md-10"> <div class="col-md-10">
<asp:TextBox ID="TxtDestinoCP" runat="server" Enabled="false" Text="" CssClass="form-control input-sm"></asp:TextBox> <asp:DropDownList ID="DdlDireccionDestino" runat="server" AutoPostBack="true" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="SucursalClienteVentaDireccion" DataValueField="CveDireccionEnvio" Width="100%" OnSelectedIndexChanged="DdlDireccionDestino_SelectedIndexChanged">
<asp:ListItem Selected="true" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<%--<asp:TextBox ID="TxtDestinoCP" runat="server" Enabled="false" Text="" CssClass="form-control input-sm"></asp:TextBox>--%>
</div> </div>
</div> </div>
<br /> <br />
@@ -5956,11 +5962,54 @@
<h4 class="modal-title">Registrar Mercancía</h4> <h4 class="modal-title">Registrar Mercancía</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="form-group form-md-line-input input-iconright"> <div class="row">
<asp:TextBox ID="TxtCantidadMercancia" runat="server" ClientIDMode="Static" CssClass="form-control" CausesValidation="true"></asp:TextBox> <div class="col-md-12">
<ajax:FilteredTextBoxExtender ID="FTEMercancia" runat="server" TargetControlID="TxtCantidadMercancia" FilterType="Numbers, Custom" ValidChars="." /> <div class="row">
<asp:RequiredFieldValidator ID="RFVMercancia" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtCantidadMercancia" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddPSMercancia"></asp:RequiredFieldValidator> <label class="col-md-3 truncate" style="color: #888888; font-family: 'Open Sans', sans-serif; direction: ltr; font-size: 12px;">Agregar Flete:</label>
<label for="<%= TxtCantidadMercancia.ClientID.ToString()%>">Cantidad:</label> </div>
<div class="row">
<div class="col-md-12">
<asp:CheckBox ID="ChkAgregarFlete" runat="server" CssClass="chksino" Text=" " OnCheckedChanged="ChkAgregarFlete_CheckedChanged" Checked="true"
AutoPostBack="true" />
</div>
</div>
</div>
</div>
<div id="DivServicioFlete" runat="server" visible="True" class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-12">
<div class="form-group form-md-line-input input-iconright">
<label for="<%= DdlPSFlete.ClientID.ToString()%>">Servicio:</label>
<ADS:Dropdownlost runat="server" ID="DdlPSFlete" CssStyle="width: 100%;" CssClass=" form-control input-sm DdlPS" IncluyeTodos="false" CssClassDdl="select2me form-control" DataTextField="PSCodigo" DataValueField="CvePS" />
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-md-12">
<div class="row">
<label class="col-md-3 truncate" style="color: #888888; font-family: 'Open Sans', sans-serif; direction: ltr; font-size: 12px;">Observaciones:</label>
</div>
<div class="row">
<div class="col-md-12">
<asp:TextBox ID="TxtObservacionesMercancia" CssClass="form-control input-sm" runat="server" Rows="2" TextMode="MultiLine" Width="100%" MaxLength="50"></asp:TextBox>
</div>
</div>
</div>
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-md-12">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCantidadMercancia" runat="server" ClientIDMode="Static" CssClass="form-control" CausesValidation="true"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTEMercancia" runat="server" TargetControlID="TxtCantidadMercancia" FilterType="Numbers, Custom" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVMercancia" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtCantidadMercancia" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddPSMercancia"></asp:RequiredFieldValidator>
<label for="<%= TxtCantidadMercancia.ClientID.ToString()%>">Cantidad:</label>
</div>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@@ -5970,6 +6019,16 @@
</div> </div>
</div> </div>
</div> </div>
<br />
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPrecioMercancia" inputmode="numeric" runat="server" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddPSMercancia" Width="200px" CssClass="form-control "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTBPrecioMercancia" runat="server" TargetControlID="TxtPrecioMercancia" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecioMercancia" runat="server" ControlToValidate="TxtPrecioMercancia" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddPSMercancia"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecioM1" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecioMercancia" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVPrecioMercancia" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecioMercancia" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GrpAddPSMercancia"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecioM2" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecioMercancia" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtPrecioMercancia.ClientID.ToString()%>">Precio:</label>
</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<asp:LinkButton ID="LnkAddPSMercancia" OnClick="LnkAddPSMercancia_Click" runat="server" CssClass="btn btn-success" Text="Agregar" ValidationGroup="GrpAddPSMercancia"></asp:LinkButton> <asp:LinkButton ID="LnkAddPSMercancia" OnClick="LnkAddPSMercancia_Click" runat="server" CssClass="btn btn-success" Text="Agregar" ValidationGroup="GrpAddPSMercancia"></asp:LinkButton>

View File

@@ -228,6 +228,14 @@ Partial Class Ventas
ViewState("TmpDTEnvioDireccion") = value ViewState("TmpDTEnvioDireccion") = value
End Set End Set
End Property End Property
Private Property TmpDTDireccionCP As DataTable
Get
Return If(IsNothing(ViewState("TmpDTDireccionCP")), Nothing, CType(ViewState("TmpDTDireccionCP"), DataTable))
End Get
Set(value As DataTable)
ViewState("TmpDTDireccionCP") = value
End Set
End Property
Private Property IdPoliza As Integer Private Property IdPoliza As Integer
Get Get
@@ -1346,6 +1354,22 @@ Partial Class Ventas
ViewState("RegimenFiscalCliente") = value ViewState("RegimenFiscalCliente") = value
End Set End Set
End Property End Property
Private Property RegimenSociedad As String
Get
Return IfNull(ViewState("RegimenSociedad"), "").ToString()
End Get
Set(value As String)
ViewState("RegimenSociedad") = value
End Set
End Property
Private Property TipoPersona As Boolean
Get
Return CBool(IfNull(ViewState("TipoPersona"), False))
End Get
Set(value As Boolean)
ViewState("TipoPersona") = value
End Set
End Property
Private Property Adjunto As String Private Property Adjunto As String
Get Get
Return If(IsNothing(ViewState("Adjunto")), "", ViewState("Adjunto").ToString()) Return If(IsNothing(ViewState("Adjunto")), "", ViewState("Adjunto").ToString())
@@ -2327,7 +2351,7 @@ Partial Class Ventas
UpFacturar.Update() UpFacturar.Update()
'CargaTiposDocumentos() 'CargaTiposDocumentos()
TrEmitir.Visible = False TrEmitir.Visible = False
If UsuarioActual.CveRol = 1 Then If UsuarioActual.CveRol = 1 AndAlso UsuarioActual.CveEmpresa = 1 Then
DivCartaPorte.Visible = True DivCartaPorte.Visible = True
End If End If
ViewState("EstablecioFolio") = False ViewState("EstablecioFolio") = False
@@ -2491,6 +2515,7 @@ Partial Class Ventas
CargaClasificaciones() CargaClasificaciones()
CargaPS(-1, DdlPS) CargaPS(-1, DdlPS)
CargaPS(-1, DdlPSMercancia) CargaPS(-1, DdlPSMercancia)
CargaPS(-1, DdlPSFlete)
'CargaPSRemision(-1, DdlPSRemision) 'CargaPSRemision(-1, DdlPSRemision)
CargaPSPyME(-1, DdlPSPyME) CargaPSPyME(-1, DdlPSPyME)
@@ -4953,7 +4978,7 @@ Partial Class Ventas
If DbRowVenta("CveDireccionEnvio").ToString().ToEntero() > 0 AndAlso DbRowVenta("CveDireccionEnvio").ToString() IsNot Nothing Then If DbRowVenta("CveDireccionEnvio").ToString().ToEntero() > 0 AndAlso DbRowVenta("CveDireccionEnvio").ToString() IsNot Nothing Then
ChkDireccionEnvio.Checked = True ChkDireccionEnvio.Checked = True
DdlDireccionEnvio.SelectedValueExist(DbRowVenta("CveDireccionEnvio").ToString().ToEntero()) DdlDireccionEnvio.SelectedValueExist(DbRowVenta("CveDireccionEnvio").ToString().ToEntero())
DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty) 'DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
DdlDireccionEnvio.Enabled = False DdlDireccionEnvio.Enabled = False
ChkDireccionEnvio.Enabled = False ChkDireccionEnvio.Enabled = False
DdlDireccionEnvio.Visible = True DdlDireccionEnvio.Visible = True
@@ -6110,8 +6135,11 @@ Partial Class Ventas
ViewState("CliLocalidad") = If(ObjCliente.Localidad.Trim.Length = 0, ObjCliente.Ciudad.Trim, ObjCliente.Localidad.Trim) ViewState("CliLocalidad") = If(ObjCliente.Localidad.Trim.Length = 0, ObjCliente.Ciudad.Trim, ObjCliente.Localidad.Trim)
ViewState("CliPais") = ObjCliente.Pais ViewState("CliPais") = ObjCliente.Pais
ImprimeNombreSucursal = ObjCliente.ImprimeNombreSucursal ImprimeNombreSucursal = ObjCliente.ImprimeNombreSucursal
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
RegimenFiscalCliente = ObjCliente.DtResultados(0)("CodigoRegimenFiscal").ToString() RegimenFiscalCliente = ObjCliente.DtResultados(0)("CodigoRegimenFiscal").ToString()
RegimenSociedad = ObjCliente.DtResultados(0)("RegimenSociedad").ToString()
TipoPersona = CBool(ObjCliente.DtResultados(0)("TipoPersona"))
CargaUsoCFDI() CargaUsoCFDI()
End If End If
'ViewState("NumCtaPago") = ObjCliente.NumCtaPago 'ViewState("NumCtaPago") = ObjCliente.NumCtaPago
@@ -6137,7 +6165,7 @@ Partial Class Ventas
End If End If
'HABILITA LA OPCION DE DIRECCION DE ENVIO 'HABILITA LA OPCION DE DIRECCION DE ENVIO
If UsuarioActual.CveEmpresa.Contiene(1, 72, 119, 140) Then If UsuarioActual.CveEmpresa.Contiene(1, 13, 72, 119, 140) Then
trDireccionEnvio.Visible = True trDireccionEnvio.Visible = True
CargaDireccionesEnvio() CargaDireccionesEnvio()
End If End If
@@ -7259,7 +7287,7 @@ Partial Class Ventas
DdlClasificacion.DataBind() DdlClasificacion.DataBind()
DdlClasificacionPyME.DataBind() DdlClasificacionPyME.DataBind()
End Sub End Sub
Private Sub CargaPS(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost) Private Sub CargaPS(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost, Optional AplicaParaVenta As Boolean = True)
Objeto.setEsWebService(UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1") Objeto.setEsWebService(UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1")
@@ -7285,7 +7313,9 @@ Partial Class Ventas
Objeto.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString()) Objeto.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString())
Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas") Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas")
Objeto.ddlWS.Attributes.Add("data-Estatus", "1") Objeto.ddlWS.Attributes.Add("data-Estatus", "1")
Objeto.ddlWS.Attributes.Add("data-AplicaparaVenta", "1") If AplicaParaVenta Then
Objeto.ddlWS.Attributes.Add("data-AplicaparaVenta", "1")
End If
End If End If
End Sub End Sub
@@ -8249,6 +8279,22 @@ Partial Class Ventas
DtOCTmpDT = TmpDT.Copy DtOCTmpDT = TmpDT.Copy
TmpDTError = TmpDT.Copy TmpDTError = TmpDT.Copy
If UsuarioActual.Empresa.Funcionalidad(350) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Egs", "Dev") Then
If RegimenFiscalCliente.Contiene("-1", "") Then
Alert("El cliente no tiene asignado un régimen fiscal.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim EsPersonaMoral As Boolean = (TipoPersona = True)
If EsPersonaMoral AndAlso String.IsNullOrEmpty(RegimenSociedad) Then
Alert("El cliente no tiene asignado un regimen de sociedad.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
If (Me.FacturarSucursal AndAlso DdlSucursalCliente.SelectedValue.ToEntero() > 0 AndAlso (Me.ClienteSucursal IsNot Nothing AndAlso String.IsNullOrEmpty(Me.ClienteSucursal.RFC))) Then If (Me.FacturarSucursal AndAlso DdlSucursalCliente.SelectedValue.ToEntero() > 0 AndAlso (Me.ClienteSucursal IsNot Nothing AndAlso String.IsNullOrEmpty(Me.ClienteSucursal.RFC))) Then
Alert("La sucursal no tiene asignada un RFC.", TipoMensaje.MsgAdvertencia) Alert("La sucursal no tiene asignada un RFC.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
@@ -8270,11 +8316,11 @@ Partial Class Ventas
End If End If
If ChkEmitirCartaPorte.Checked Then If ChkEmitirCartaPorte.Checked Then
If String.IsNullOrEmpty(TxtOrigenCP.Text.Trim()) Then If DdlDireccionOrigen.SelectedValue.ToEntero() <= 0 Then
Alert("La carta porte no tiene un origen definido.", TipoMensaje.MsgAdvertencia) Alert("La carta porte no tiene un origen definido.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
If String.IsNullOrEmpty(TxtDestinoCP.Text.Trim()) Then If DdlDireccionDestino.SelectedValue.ToEntero() <= 0 Then
Alert("La carta porte no tiene un destino definido.", TipoMensaje.MsgAdvertencia) Alert("La carta porte no tiene un destino definido.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
@@ -9319,7 +9365,7 @@ Partial Class Ventas
End If End If
If ChkEmitirCartaPorte.Checked AndAlso CveTimbreCartaPorte > 0 Then If ChkEmitirCartaPorte.Checked AndAlso CveTimbreCartaPorte > 0 Then
Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorte, ObjFactura, UsuarioActual) Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorte, UsuarioActual)
If Not RespCartaPorte.TieneError Then If Not RespCartaPorte.TieneError Then
ObjFactura.Timbre.Complementos.CartaPorte = RespCartaPorte.CartaPorte ObjFactura.Timbre.Complementos.CartaPorte = RespCartaPorte.CartaPorte
Else Else
@@ -11464,7 +11510,11 @@ Partial Class Ventas
Timbre.Receptor.DomicilioFiscalReceptor = Obj.ClienteSucursal.CP Timbre.Receptor.DomicilioFiscalReceptor = Obj.ClienteSucursal.CP
Else Else
Timbre.Receptor.RFC = Obj.Cliente.RFC Timbre.Receptor.RFC = Obj.Cliente.RFC
Timbre.Receptor.Nombre = Obj.Cliente.NombreComercial If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
Timbre.Receptor.Nombre = Obj.Cliente.Nombre
Else
Timbre.Receptor.Nombre = Obj.Cliente.NombreComercial
End If
Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP
End If End If
@@ -14808,21 +14858,7 @@ Partial Class Ventas
Exit Sub Exit Sub
End If End If
If UsuarioActual.Empresa.CvePlataforma = 2 Then Select Case ConversionRemision
PdfFacturaPyME(ObjFactura, TmpDT, False)
Else
'REINICIA VALORES DE CONVERSION DE MONEDA
'If Not ObjFactura.ConvertirPesos And ChkConvertirDoctoPesos.Checked Then
' For Each Row As DataRow In TmpDT.Rows
' Row("PU") = Row("PU").ToString().ToDouble / TxtTipoCambio.Text.Trim.ToDecimal
' Row("Total") = Row("Cantidad").ToString().ToDouble / Row("PU").ToString().ToDouble
' Row("Descuento") = Row("Descuento").ToString().ToDouble / TxtTipoCambio.Text.Trim.ToDecimal
' Row("IEPS") = Row("IEPS").ToString().ToDouble / TxtTipoCambio.Text.Trim.ToDecimal
' Next
'End If
Select Case ConversionRemision
Case "*" Case "*"
For Each Row As DataRow In TmpDT.Rows For Each Row As DataRow In TmpDT.Rows
Row("PU") = Math.Round(Row("PU").ToString().ToDouble * TipoCambioRemision, NumeroDecimales) Row("PU") = Math.Round(Row("PU").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
@@ -14904,8 +14940,6 @@ Partial Class Ventas
End Select End Select
'PdfFacturaPyME(ObjFactura, TmpDT)
End If
End Sub End Sub
#End Region #End Region
@@ -16266,12 +16300,12 @@ Partial Class Ventas
Dim TmpDTComplementosTimbrado As New DataTable Dim TmpDTComplementosTimbrado As New DataTable
PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado) PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado)
Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorteVenta, ObjFactura, UsuarioActual) Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorteVenta, UsuarioActual)
If Not RespCartaPorte.TieneError Then If Not RespCartaPorte.TieneError Then
ObjFactura.Timbre.Complementos.CartaPorte = RespCartaPorte.CartaPorte ObjFactura.Timbre.Complementos.CartaPorte = RespCartaPorte.CartaPorte
Else Else
Exit Sub
Alert(RespCartaPorte.Mensaje, TipoMensaje.MsgAdvertencia) Alert(RespCartaPorte.Mensaje, TipoMensaje.MsgAdvertencia)
Exit Sub
End If End If
If ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) Then If ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) Then
@@ -16470,7 +16504,7 @@ Partial Class Ventas
If RespCancelacion.Verificado Then If RespCancelacion.Verificado Then
If ObjBanco.UpdateComplementoPago(CveComplementoPago, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse) Then If ObjBanco.UpdateComplementoPagoCancelado(CveComplementoPago, 2, CvePACCancelacion, UsuarioActual.CveEmpresa, ObjCancelacion.CancelacionFecha, ObjCancelacion.CancelacionAcuse, 1) Then
CargaComplementosPago() CargaComplementosPago()
Alert("El complemento se canceló correctamente.") Alert("El complemento se canceló correctamente.")
End If End If
@@ -21583,6 +21617,11 @@ Partial Class Ventas
ObjConta.Dispose() ObjConta.Dispose()
ObjBancos.Dispose() ObjBancos.Dispose()
If ObjAC IsNot Nothing Then ObjAC.Dispose() If ObjAC IsNot Nothing Then ObjAC.Dispose()
'REGENERAR EL PDF
If Not OcurrioError Then
DescargarFactura(CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Regenerar:=True)
End If
End Sub End Sub
Private Sub BtnActualizarCuentaTerminal_Click(sender As Object, e As EventArgs) Handles BtnActualizarCuentaTerminal.Click Private Sub BtnActualizarCuentaTerminal_Click(sender As Object, e As EventArgs) Handles BtnActualizarCuentaTerminal.Click
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
@@ -22887,14 +22926,14 @@ Partial Class Ventas
If ChkDireccionEnvio.Checked Then If ChkDireccionEnvio.Checked Then
DdlDireccionEnvio.Visible = True DdlDireccionEnvio.Visible = True
LnkOtraDireccion.Visible = True LnkOtraDireccion.Visible = True
DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty) 'DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
Else Else
DdlDireccionEnvio.Visible = False DdlDireccionEnvio.Visible = False
LnkOtraDireccion.Visible = False LnkOtraDireccion.Visible = False
If SucursalDestinoCP IsNot Nothing Then If SucursalDestinoCP IsNot Nothing Then
SucursalDestinoCP = Nothing SucursalDestinoCP = Nothing
SucursalDestinoCP = New Modelos.SucursalModel SucursalDestinoCP = New Modelos.SucursalModel
TxtDestinoCP.Text = "" 'TxtDestinoCP.Text = ""
End If End If
End If End If
End Sub End Sub
@@ -22934,7 +22973,7 @@ Partial Class Ventas
TxtEnvioTel.Text = "" TxtEnvioTel.Text = ""
CargaDireccionesEnvio() CargaDireccionesEnvio()
DdlDireccionEnvio.SelectedValueExist(CveDireccionEnvio) DdlDireccionEnvio.SelectedValueExist(CveDireccionEnvio)
DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty) 'DdlDireccionEnvio_SelectedIndexChanged(DdlDireccionEnvio, EventArgs.Empty)
End If End If
ObjClientes.Dispose() ObjClientes.Dispose()
@@ -33101,8 +33140,8 @@ Partial Class Ventas
' Return File ' Return File
'End Function 'End Function
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer, Optional GetBytes As Boolean = True) As Byte() Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer, Optional GetBytes As Boolean = True, Optional Regenerar As Boolean = False) As Byte()
Dim Url = New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?P={3}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) Dim Url = New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?P={3}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&REGENERAR={1}", CveVenta, If(Regenerar, "1", "0")))))
Dim File As Byte() = Nothing Dim File As Byte() = Nothing
Try Try
Using httpClient = New HttpClient() Using httpClient = New HttpClient()
@@ -34217,7 +34256,6 @@ Partial Class Ventas
DdlUnidadCamion.DataSource = ObjInv.DtResultados DdlUnidadCamion.DataSource = ObjInv.DtResultados
End If End If
If ObjInv.GetCamiones(-1, UsuarioActual.CveEmpresa, 2, Estatus:=1) Then If ObjInv.GetCamiones(-1, UsuarioActual.CveEmpresa, 2, Estatus:=1) Then
DdlRemolque1.DataSource = ObjInv.DtResultados DdlRemolque1.DataSource = ObjInv.DtResultados
End If End If
@@ -34227,7 +34265,6 @@ Partial Class Ventas
DdlUnidadCamion.DataBind() DdlUnidadCamion.DataBind()
DdlUnidadCamion.Items.Insert(0, New ListItem("Seleccione Uno", "-1")) DdlUnidadCamion.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
DdlRemolque1.DataBind() DdlRemolque1.DataBind()
DdlRemolque1.Items.Insert(0, New ListItem("Seleccione Uno", "-1")) DdlRemolque1.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
@@ -34265,14 +34302,14 @@ Partial Class Ventas
End Sub End Sub
Protected Sub DdlConfigAuto_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlConfigAuto_SelectedIndexChanged(sender As Object, e As EventArgs)
ValidaConfiguracionVeiculo() ValidaConfiguracionVehiculo()
End Sub End Sub
Public Sub CargaVentaCortePorte(CveVenta As Integer) Public Sub CargaVentaCortePorte(CveVenta As Integer)
TxtFechaEntregaCP.Enabled = False TxtFechaEntregaCP.Enabled = False
TxtFechaLlegadaCP.Enabled = False TxtFechaLlegadaCP.Enabled = False
Using ObjGral As New ClsGenerales Using ObjGral As New ClsGenerales
If ObjGral.GetGralTimbre(-1, "Man", MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa, -1, CveVenta:=CveVenta) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then If ObjGral.GetGralTimbre(-1, "Ing", MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa, -1, CveVenta:=CveVenta) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then
Dim RowCP As DataRow = ObjGral.DtResultados.Rows(0) Dim RowCP As DataRow = ObjGral.DtResultados.Rows(0)
Me.CveTimbreCartaPorteVenta = RowCP("CveTimbre").ToString().ToEntero() Me.CveTimbreCartaPorteVenta = RowCP("CveTimbre").ToString().ToEntero()
@@ -34294,7 +34331,7 @@ Partial Class Ventas
DdlUnidadCamion.Enabled = False DdlUnidadCamion.Enabled = False
End Sub End Sub
Private Sub ValidaConfiguracionVeiculo() Private Sub ValidaConfiguracionVehiculo()
DvRemolque1.Visible = False DvRemolque1.Visible = False
DvRemolque2.Visible = False DvRemolque2.Visible = False
@@ -34307,7 +34344,6 @@ Partial Class Ventas
If ObjGrales.GetCartaPorteConfigAutoTransportes() Then If ObjGrales.GetCartaPorteConfigAutoTransportes() Then
Dim Remolque As String = ObjGrales.DtResultados.FiltroPrimeroValor("Remolque", $" CveConfigAutoTransporte ='{DdlConfigAuto.SelectedValue}'") Dim Remolque As String = ObjGrales.DtResultados.FiltroPrimeroValor("Remolque", $" CveConfigAutoTransporte ='{DdlConfigAuto.SelectedValue}'")
If Remolque = "1" Then If Remolque = "1" Then
RequiereRemolque = True RequiereRemolque = True
MostrarRemolques = True MostrarRemolques = True
@@ -34330,7 +34366,6 @@ Partial Class Ventas
MostrarRemolques = False MostrarRemolques = False
End If End If
If RequiereRemolque Or MostrarRemolques Then If RequiereRemolque Or MostrarRemolques Then
DvRemolque1.Visible = True DvRemolque1.Visible = True
End If End If
@@ -34341,7 +34376,6 @@ Partial Class Ventas
DvConfiguracionVeiculo.Visible = True DvConfiguracionVeiculo.Visible = True
End If End If
UpEmitirTransitorio.Update() UpEmitirTransitorio.Update()
End Sub End Sub
Protected Sub DdlRemolque1_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlRemolque1_SelectedIndexChanged(sender As Object, e As EventArgs)
@@ -34358,14 +34392,11 @@ Partial Class Ventas
End Using End Using
DdlRemolque2.DataBind() DdlRemolque2.DataBind()
Else Else
DvRemolque2.Visible = False DvRemolque2.Visible = False
End If End If
DdlRemolque2.Items.Insert(0, New ListItem("Seleccione uno", "-1")) DdlRemolque2.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
UpEmitirTransitorio.Update() UpEmitirTransitorio.Update()
End Sub End Sub
@@ -34402,13 +34433,13 @@ Partial Class Ventas
If CveEntregaAlmacen > 0 Then If CveEntregaAlmacen > 0 Then
For Each RowPS As DataRow In ObjFactura.DtMercancias.Rows For Each RowPS As DataRow In ObjFactura.DtMercancias.Rows
If Not ObjGral.AddEntregaAlmacenRutaDetalle(CveEntregaAlmacen, RowPS("CvePS").ToString().ToEntero, RowPS("Cantidad").ToString().ToEntero, RowPS("CveUM").ToString().ToEntero, UsuarioActual.CveUsuario) Then If Not ObjGral.AddEntregaAlmacenRutaDetalle(CveEntregaAlmacen, RowPS("CvePS").ToString().ToEntero, RowPS("Cantidad").ToString().ToDecimal, RowPS("CveUM").ToString().ToEntero, UsuarioActual.CveUsuario) Then
ErrorProceso = True ErrorProceso = True
Exit For Exit For
End If End If
Next Next
CveTimbre = ObjGral.AddGralTimbre("Man", DdlSubProyectoDatos.SelectedValue.ToEntero, TxtFecha.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=True, CveVenta:=ObjFactura.CveVenta) CveTimbre = ObjGral.AddGralTimbre("Ing", DdlSubProyectoDatos.SelectedValue.ToEntero, TxtFecha.Text.ToDate, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=True, CveVenta:=ObjFactura.CveVenta)
If Not CveTimbre > 0 Then If Not CveTimbre > 0 Then
ErrorProceso = True ErrorProceso = True
@@ -34540,12 +34571,80 @@ Partial Class Ventas
GuardaLog(ex.ToString()) GuardaLog(ex.ToString())
End Try End Try
TxtOrigenCP.Text = SBDomicilioSucursal.ToString 'TxtOrigenCP.Text = SBDomicilioSucursal.ToString
UpEmitirTransitorio.Update() UpEmitirTransitorio.Update()
End Sub End Sub
Protected Sub DdlDireccionEnvio_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlDireccionEnvio_SelectedIndexChanged(sender As Object, e As EventArgs)
'If SucursalDestinoCP Is Nothing Then
' SucursalDestinoCP = New Modelos.SucursalModel
'Else
' SucursalDestinoCP = Nothing
' SucursalDestinoCP = New Modelos.SucursalModel
'End If
'If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows.Count > 0 Then
' Dim Row As DataRow = TmpDTEnvioDireccion.FiltroPrimero(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero()))
' If Row IsNot Nothing Then
' SucursalDestinoCP.Direccion = Row("EnvioDireccion").ToString()
' SucursalDestinoCP.Colonia = Row("EnvioColonia").ToString()
' SucursalDestinoCP.Municipio = Row("EnvioCiudad").ToString()
' SucursalDestinoCP.CveEstado = Row("CveEstado").ToString().ToEntero()
' SucursalDestinoCP.Estado = Row("EnvioEstado").ToString()
' SucursalDestinoCP.CvePais = Row("CvePais").ToString().ToEntero()
' SucursalDestinoCP.Pais = Row("Pais").ToString()
' SucursalDestinoCP.CP = Row("EnvioCP").ToString()
' TxtDestinoCP.Text = String.Format("{0} col. {1},CP:{2}, {3},{4},{5}", SucursalDestinoCP.Direccion, SucursalDestinoCP.Colonia, SucursalDestinoCP.CP, SucursalDestinoCP.Municipio, SucursalDestinoCP.Estado, SucursalDestinoCP.Pais)
' Else
' TxtDestinoCP.Text = ""
' End If
'Else
' TxtDestinoCP.Text = ""
'End If
UpEmitirTransitorio.Update()
End Sub
Protected Sub DdlDireccionOrigen_SelectedIndexChanged(sender As Object, e As EventArgs)
If SucursalOrigenCP Is Nothing Then
SucursalOrigenCP = New Modelos.SucursalModel
Else
SucursalOrigenCP = Nothing
SucursalOrigenCP = New Modelos.SucursalModel
End If
If TmpDTDireccionCP IsNot Nothing AndAlso TmpDTDireccionCP.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionOrigen.SelectedValue.ToEntero())).Rows.Count > 0 Then
Dim Row As DataRow = TmpDTDireccionCP.FiltroPrimero(String.Format("CveDireccionEnvio = {0}", DdlDireccionOrigen.SelectedValue.ToEntero()))
If Row IsNot Nothing Then
SucursalOrigenCP.Direccion = Row("EnvioDireccion").ToString()
SucursalOrigenCP.Colonia = Row("EnvioColonia").ToString()
SucursalOrigenCP.Municipio = Row("EnvioCiudad").ToString()
SucursalOrigenCP.CveEstado = Row("CveEstado").ToString().ToEntero()
SucursalOrigenCP.Estado = Row("EnvioEstado").ToString()
SucursalOrigenCP.CvePais = Row("CvePais").ToString().ToEntero()
SucursalOrigenCP.Pais = Row("Pais").ToString()
SucursalOrigenCP.CP = Row("EnvioCP").ToString()
'TxtDestinoCP.Text = String.Format("{0} col. {1},CP:{2}, {3},{4},{5}", SucursalDestinoCP.Direccion, SucursalDestinoCP.Colonia, SucursalDestinoCP.CP, SucursalDestinoCP.Municipio, SucursalDestinoCP.Estado, SucursalDestinoCP.Pais)
Else
'TxtDestinoCP.Text = ""
End If
Else
'TxtDestinoCP.Text = ""
End If
UpEmitirTransitorio.Update()
End Sub
Protected Sub DdlDireccionDestino_SelectedIndexChanged(sender As Object, e As EventArgs)
If SucursalDestinoCP Is Nothing Then If SucursalDestinoCP Is Nothing Then
SucursalDestinoCP = New Modelos.SucursalModel SucursalDestinoCP = New Modelos.SucursalModel
Else Else
@@ -34554,9 +34653,9 @@ Partial Class Ventas
End If End If
If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows.Count > 0 Then If TmpDTDireccionCP IsNot Nothing AndAlso TmpDTDireccionCP.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionDestino.SelectedValue.ToEntero())).Rows.Count > 0 Then
Dim Row As DataRow = TmpDTEnvioDireccion.FiltroPrimero(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())) Dim Row As DataRow = TmpDTDireccionCP.FiltroPrimero(String.Format("CveDireccionEnvio = {0}", DdlDireccionDestino.SelectedValue.ToEntero()))
If Row IsNot Nothing Then If Row IsNot Nothing Then
SucursalDestinoCP.Direccion = Row("EnvioDireccion").ToString() SucursalDestinoCP.Direccion = Row("EnvioDireccion").ToString()
@@ -34568,20 +34667,20 @@ Partial Class Ventas
SucursalDestinoCP.Pais = Row("Pais").ToString() SucursalDestinoCP.Pais = Row("Pais").ToString()
SucursalDestinoCP.CP = Row("EnvioCP").ToString() SucursalDestinoCP.CP = Row("EnvioCP").ToString()
TxtDestinoCP.Text = String.Format("{0} col. {1},CP:{2}, {3},{4},{5}", SucursalDestinoCP.Direccion, SucursalDestinoCP.Colonia, SucursalDestinoCP.CP, SucursalDestinoCP.Municipio, SucursalDestinoCP.Estado, SucursalDestinoCP.Pais) 'TxtDestinoCP.Text = String.Format("{0} col. {1},CP:{2}, {3},{4},{5}", SucursalDestinoCP.Direccion, SucursalDestinoCP.Colonia, SucursalDestinoCP.CP, SucursalDestinoCP.Municipio, SucursalDestinoCP.Estado, SucursalDestinoCP.Pais)
Else Else
TxtDestinoCP.Text = "" 'TxtDestinoCP.Text = ""
End If End If
Else Else
TxtDestinoCP.Text = "" 'TxtDestinoCP.Text = ""
End If End If
UpEmitirTransitorio.Update() UpEmitirTransitorio.Update()
End Sub End Sub
Protected Sub LnkAgregarMercancia_Click(sender As Object, e As EventArgs) Protected Sub LnkAgregarMercancia_Click(sender As Object, e As EventArgs)
TxtCantidadMercancia.Text = "" TxtCantidadMercancia.Text = ""
DdlPSMercancia.SelectedValue = "" 'DdlPSMercancia.SelectedValue = ""
DdlPSMercancia.SelectedText = "Seleccione" 'DdlPSMercancia.SelectedText = "Seleccione"
UpAgregarMercancia.Update() UpAgregarMercancia.Update()
RegistraScript("$('#DivAddMercancia').modal('show');", "M1") RegistraScript("$('#DivAddMercancia').modal('show');", "M1")
@@ -34615,9 +34714,45 @@ Partial Class Ventas
GvMercanciasCP.DataSource = DtMercancias GvMercanciasCP.DataSource = DtMercancias
GvMercanciasCP.DataBind() GvMercanciasCP.DataBind()
If ChkAgregarFlete.Checked Then
Dim CvePSServicio As Integer = DdlPSFlete.SelectedValue.ToEntero()
If CvePSServicio > 0 Then
Dim Cantidad As Decimal = TxtCantidadMercancia.Text.ToDecimal
Dim PU As Decimal = TxtPrecioMercancia.Text.Trim.ToDecimal
Dim Descuento As Decimal = 0
Dim CveUM As Integer = -1
Dim UnidadMedida As String = ""
Dim CveClasificacion As Integer = -1
Dim Clasificacion As String = ""
Dim drPSFlete As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSServicio).FiltroPrimero("")
If DrPS IsNot Nothing Then
CveUM = drPSFlete("CveUnidadMedida").ToString().ToEntero()
CveClasificacion = drPSFlete("CveClasificacion").ToString().ToEntero()
End If
Dim CveSubProyecto As Integer = DdlSubProyectoDatos.SelectedValue.ToEntero()
Dim CveProyecto = GlobalDTSubProyectos(-1, CveSubProyecto:=CveSubProyecto, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProyecto", "").ToEntero()
Dim Proyecto As String = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, CveProyecto, UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("Proyecto", "").ToString()
AgregarProductoServicio(Cantidad, CveUM, UnidadMedida, CveClasificacion, Clasificacion,
CvePSServicio, "", TxtObservacionesMercancia.Text.Trim, PU, Descuento,
CveProyecto, Proyecto, CveSubProyecto, DdlSubProyectoDatos.SelectedItem.Text,
Serie:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=-1,
ImporteProntoPago:=0)
CalculaUsados()
CalculaTotalesVenta()
Else
Alert("No se agrego el servicio del flete", TipoMensaje.MsgAdvertencia)
End If
End If
TxtCantidadMercancia.Text = "" TxtCantidadMercancia.Text = ""
DdlPSMercancia.SelectedValue = "" TxtObservacionesMercancia.Text = ""
DdlPSMercancia.SelectedText = "Seleccione"
UpAgregarMercancia.Update() UpAgregarMercancia.Update()
UpEmitirTransitorio.Update() UpEmitirTransitorio.Update()
@@ -34680,5 +34815,109 @@ Partial Class Ventas
End Sub End Sub
Protected Sub ChkEmitirCartaPorte_CheckedChanged(sender As Object, e As EventArgs)
If ChkEmitirCartaPorte.Checked AndAlso CveCliente > 0 Then
Dim ObjClientes As New ClsClientes
If ObjClientes.DireccionEnvioGet(-1, CveCliente, -1) Then
TmpDTDireccionCP = ObjClientes.DtResultados.FiltraParametros(String.Format("Estatus = 1"))
End If
ObjClientes.Dispose()
Else
TmpDTDireccionCP = Nothing
End If
DdlDireccionOrigen.DataSource = TmpDTDireccionCP
DdlDireccionOrigen.DataBind()
DdlDireccionDestino.DataSource = TmpDTDireccionCP
DdlDireccionDestino.DataBind()
End Sub
Protected Sub ChkAgregarFlete_CheckedChanged(sender As Object, e As EventArgs)
DivServicioFlete.Visible = ChkAgregarFlete.Checked
UpAgregarMercancia.Update()
End Sub
Protected Sub DdlPSMercancia_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPSMercancia.selectedindexchange
Dim CvePSParametro As Integer = DdlPSMercancia.SelectedValue.ToEntero()
If CvePSParametro > 0 Then
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPSMercancia.SelectedValue.ToEntero()).FiltroPrimero("")
If drPS IsNot Nothing Then
Dim CveClasificacion As Integer = drPS("CveClasificacion").ToString().ToEntero()
'SUGIERE PRECIO
Dim PrecioSugerido As Decimal = 0
Dim tPrecioSugerido As Decimal = 0
tPrecioSugerido = drPS("Precio").ToString().ToDecimal
If UsuarioActual.CveEmpresa.Contiene(1) Then
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPorcentajeProductos(CveCliente) Then
Dim PrecioAplicado = ObjPS.DtResultados.FiltraParametros($"CvePS = {CvePSParametro}").FiltroPrimeroValor("PrecioA").ToDecimal
If PrecioAplicado > 0 Then
PrecioSugerido = PrecioAplicado
End If
End If
ObjPS.Dispose()
End If
If UsuarioActual.Empresa.Funcionalidad(404).ToEntero > 0 Then 'cuando el valor es 10.- secuencia Cliente/Sucursal, 20 - sucursal/cliente
Dim TipoPrecioLista As Integer = UsuarioActual.Empresa.Funcionalidad(404).ToEntero
' si es 10. primero el cliente
Dim CvePrecioListaPS As Integer
Dim PorcentajePrecio As Decimal = 0
If TipoPrecioLista = 10 Then
CvePrecioListaPS = Me.CvePrecioListaCliente
If CvePrecioListaPS <= 0 Then
CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero()
End If
Else
CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero()
If CvePrecioListaPS <= 0 Then
CvePrecioListaPS = Me.CvePrecioListaCliente 'GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero()
End If
End If
If CvePrecioListaPS > 0 Then
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then
PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal
PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal
End If
ObjPS.Dispose()
End If
If PrecioSugerido = 0 Then
Dim ObjInventarios As New ClsInventarios
Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidadMercancia.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidadMercancia.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
ObjInventarios.Dispose()
If CostoPS > 0 And PorcentajePrecio > 0 Then
PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
End If
End If
CvePrecioLista = CvePrecioListaPS
End If
If PrecioSugerido > 0 Then
Dim PrecioBaseCosto As Decimal = 0
PrecioBaseCosto = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion).FiltroPrimeroValor("PrecioBaseCosto", "").ToDecimal
If PrecioBaseCosto > 0 Then
PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1)
End If
End If
If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
TxtPrecioMercancia.Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere
End If
End If
End Sub
End Class End Class