From f6ab8ae4284ec2fad7bb808e8bac823649dd0b28 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 27 Jan 2022 23:34:55 -0700 Subject: [PATCH] timbrado v.4.0 --- App_Code/CFDITimbre.vb | 4 ++-- App_Code/ClsClientes.vb | 10 +++++++--- App_Code/ClsPaginas.vb | 25 +++++++++++++++++++++---- App_Code/Timbrado.vb | 2 +- Ventas/Clientes.aspx | 13 +++++++++++++ Ventas/Clientes.aspx.vb | 15 ++++++++++----- Ventas/Ventas.aspx.vb | 10 ++++++++-- 7 files changed, 62 insertions(+), 17 deletions(-) diff --git a/App_Code/CFDITimbre.vb b/App_Code/CFDITimbre.vb index 0b2a1280b..3138f25ba 100644 --- a/App_Code/CFDITimbre.vb +++ b/App_Code/CFDITimbre.vb @@ -279,8 +279,8 @@ End Class Public Class CFDIReceptor Public Property RFC As String Public Property Nombre As String - Public Property RegimenFiscalReceptor As String = "601" - Public Property DomicilioFiscalReceptor As String = "601" + Public Property RegimenFiscalReceptor As String = "" + Public Property DomicilioFiscalReceptor As String = "" Public Property ResidenciaFiscal As String = "" Public Property NumeroRegistroTributario As String = "" Public Property UsoCFDI As String diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 9845e2643..e9826f77e 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -125,6 +125,7 @@ Public Class ClsClientes Public Property Celular As String Public Property ExtOtros As String Public Property CveUsoCFDI As Integer + Public Property CveRegimenFiscal As Integer Public Property CveFormaPago33 As Integer Public Property CveMetodoPago33 As Integer Public Property CveClienteCorporativo As String @@ -384,6 +385,8 @@ Public Class ClsClientes _CveFormaPago33 = Data(0)("CveFormaPago33").ToString.ToEntero _CveMetodoPago33 = Data(0)("CveMetodoPago33").ToString.ToEntero + _CveRegimenFiscal = Data(0)("CveRegimenFiscal").ToString.ToEntero + _CveClienteCorporativo = Data(0)("CveClienteCorporativo").ToString _DesglosaIEPS = CType(Data(0)("DesglosaIEPS"), Boolean) _NoDesglosaIVA = CType(Data(0)("NoDesglosaIVA"), Boolean) @@ -573,7 +576,7 @@ Public Class ClsClientes Optional AplicaComercioExterior As Boolean = False, Optional CveTipoOperacion As Integer = -1, Optional CvePedimento As Integer = -1, Optional CveIncoterm As Integer = -1, Optional CvePais As Integer = -1, Optional CveEstado As Integer = -1, Optional CveMunicipio As Integer = -1, Optional CveColonia As Integer = -1, Optional CveMotivoTraslado As Integer = 0, Optional NumRegIdTrib As String = "", Optional ComExtEstado As String = "-1", Optional ComExtMunicipio As String = "-1", Optional ComExtColonia As String = "-1", Optional RequiereOC As Boolean = False, Optional LT As String = "0", Optional LG As String = "0", Optional EsDistribuidor As Boolean = False, Optional TipoCliente As Integer = 1, Optional CargoUsado As Boolean = False, Optional BonificacionUsado As Boolean = False, Optional CveTipoRetencion As Integer = 0, - Optional CorreoEntregaCompras As String = "-1", Optional CorreoEntregaAlmacen As String = "-1", Optional CveSATEstado As Integer = -1, Optional CveAdminTrayecto As Integer = -1) As Boolean + Optional CorreoEntregaCompras As String = "-1", Optional CorreoEntregaAlmacen As String = "-1", Optional CveSATEstado As Integer = -1, Optional CveAdminTrayecto As Integer = -1, Optional CveRegimenFiscal As Integer = 0) As Boolean Dim Retorno As Boolean = False @@ -714,7 +717,7 @@ Public Class ClsClientes .Add("@CveSATEstado", SqlDbType.Int).Value = CveSATEstado .Add("@CveAdminTrayecto", SqlDbType.TinyInt).Value = CveAdminTrayecto - + .Add("@CveRegimenFiscal", SqlDbType.TinyInt).Value = CveRegimenFiscal End With Try @@ -763,7 +766,7 @@ Public Class ClsClientes Optional CveMotivoTraslado As Integer = 0, Optional NumRegIdTrib As String = "-1", Optional ComExtEstado As String = "-1", Optional ComExtMunicipio As String = "-1", Optional ComExtColonia As String = "-1", Optional ApellidoPaternoPF As String = "-1", Optional ApellidoMaternoPF As String = "-1", Optional NombresPF As String = "-1", Optional RequiereOC As Boolean = False, Optional LT As String = "0", Optional LG As String = "0", Optional EsDistribuidor As Boolean = False, Optional TipoCliente As Integer = 1, Optional CargoUsado As Boolean = False, Optional BonificacionUsado As Boolean = False, Optional CveTipoRetencion As Integer = 0, Optional CorreoEntregaCompras As String = "-1", Optional CorreoEntregaAlmacen As String = "-1", - Optional CveSATEstado As Integer = -1, Optional CveAdminTrayecto As Integer = -1, Optional NoDesglosaIVA As Boolean = False) As Boolean + Optional CveSATEstado As Integer = -1, Optional CveAdminTrayecto As Integer = -1, Optional NoDesglosaIVA As Boolean = False, Optional CveRegimenFiscal As Integer = 0) As Boolean Dim Retorno As Boolean = False @@ -920,6 +923,7 @@ Public Class ClsClientes .Add("@CveSATEstado", SqlDbType.Int).Value = CveSATEstado .Add("@CveAdminTrayecto", SqlDbType.TinyInt).Value = CveAdminTrayecto + .Add("@CveRegimenFiscal", SqlDbType.TinyInt).Value = CveRegimenFiscal End With Try diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index eccfb731a..e8fd83dd4 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -716,6 +716,23 @@ Public Class ClsPaginas Application("GlobalDTNomSatRegimenContratacion") = value End Set End Property + + Property GlobalDTRegimenesFiscales() As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTRegimenesFiscales") + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjGral As New ClsSisEmpresas + If ObjGral.GetRegimenFiscal(-1) Then Application(AppNombre) = ObjGral.DtResultados + ObjGral.Dispose() + End If + GlobalDTRegimenesFiscales = DirectCast(Application(AppNombre), DataTable) + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTRegimenesFiscales") + Application(AppNombre) = value + End Set + End Property Property GlobalDTNomSatRiesgoPuesto() As DataTable Get GlobalDTNomSatRiesgoPuesto = DirectCast(Application("GlobalDTNomSatRiesgoPuesto"), DataTable) @@ -6933,7 +6950,7 @@ Public Class ClsPaginas Dim TC As Decimal = ValorNodoXML(XmlDoc.DocumentElement, "TC").ToDecimal If TC <= 0 Then TC = 1 - If ValorNodoXML(XmlDoc.DocumentElement, "version") = "3.3" Then + If ValorNodoXML(XmlDoc.DocumentElement, "version").Contiene("3.3", "4.0") Then Vta.FechaEmision = ValorNodoXML(XmlDoc.DocumentElement, "fecha").ToDate Vta.NoSerieCertificadoContribuyente = ValorNodoXML(XmlDoc.DocumentElement, "NoCertificado") @@ -7039,7 +7056,7 @@ Public Class ClsPaginas 'Dim CadenaOriginals As String = "||1.0|" + Vta.FolioFiscal + "|" + Vta.FechaCertificacion.ToString("yyyy-MM-dd") + "T" + Vta.FechaCertificacion.ToString("HH:mm:ss") + "|" + Vta.SelloCFDi + "|" + Vta.NoSerieCertificado + "||" - Dim CadenaOriginals As String = String.Format("||{0}|{1}|{2}T{3}|{4}|{5}||", If(Vta.Version = "3.3", "1.1", "1.0"), Vta.FolioFiscal, Vta.FechaCertificacion.ToString("yyyy-MM-dd"), Vta.FechaCertificacion.ToString("HH:mm:ss"), Vta.SelloCFDi, Vta.NoSerieCertificado) + Dim CadenaOriginals As String = String.Format("||{0}|{1}|{2}T{3}|{4}|{5}||", If(Vta.Version.Contiene("3.3", "4.0"), "1.1", "1.0"), Vta.FolioFiscal, Vta.FechaCertificacion.ToString("yyyy-MM-dd"), Vta.FechaCertificacion.ToString("HH:mm:ss"), Vta.SelloCFDi, Vta.NoSerieCertificado) If Not ImagenCBB.Exists Then ImgCBB = "" Dim RutaFormato As String = "" Dim RutaFormatoDefault As String = "" @@ -7162,7 +7179,7 @@ Public Class ClsPaginas params.Add(New ReportParameter("MetodoPago", Vta.ClaveMetodoPagoSAT.ToString)) End If - If Vta.Version = "3.3" Then + If Vta.Version.Contiene("3.3", "4.0") Then params.Add(New ReportParameter("FormaPago", Vta.FormaPago33.ToString)) params.Add(New ReportParameter("MetodoPago", Vta.MetodoPago33.ToString)) params.Add(New ReportParameter("UsoCFDI", Vta.UsoCFDI)) @@ -8342,7 +8359,7 @@ Public Class ClsPaginas 'XmlDoc.Load(Ruta & "XML\\Nomina\NOM A-3845.xml") XmlDoc.Load(PathXML) - If ValorNodoXML(XmlDoc.DocumentElement, "version") = "3.3" Then + If ValorNodoXML(XmlDoc.DocumentElement, "version").Contiene("3.3", "4.0") Then FechaEmision = XmlDoc.DocumentElement.Attributes("Fecha").InnerText.ToDate NoSerieCertificadoContribuyente = XmlDoc.DocumentElement.Attributes("NoCertificado").InnerText diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index c659db691..2f98c6f49 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -1016,7 +1016,7 @@ Public Class Timbrado Retorno = TimbrarFacturaProFact(UsuarioActual, Ventas) 'Retorno = TimbrarFacturaProFact(UsuarioActual, Ventas, TmpDTConceptos, TmpDTImpuestos, TmpDTComplementos, Ruta, LstFordASN, FordGSDBM, ObjV) Case 4 - If Ventas.Version = "4.0" Then + If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then Dim Ret As String = TimbrarFacturaGoCFDIv40(Ventas, UsuarioActual, CvePACEspecial) If Ret <> "" Then MensajeErrorCFDI = Ret Retorno = If(Ret = "", True, False) diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index fc434b7e5..994492273 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -501,6 +501,19 @@ +
+
+
+ + + + + + +
+
+
+ diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 3f903f6d9..77066bfad 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -753,6 +753,10 @@ Partial Class Clientes DivRetIVA.Visible = False End If + If UsuarioActual.CveUsuario = 100 Then + divRegimen.Visible = True + End If + If Request("CveCliente") IsNot Nothing AndAlso IsNumeric(Request("CveCliente")) AndAlso Request("CveCliente").ToEntero() > 0 Then 'If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not Request("CveCliente").Contiene("10450", "10460", "10458") Then ' BtnGuardar.Enabled = False : BtnEliminar.Enabled = False : LbAgregarSucursal.Enabled = False : LbEnviarActivacionPortal.Enabled = False @@ -1246,10 +1250,9 @@ Partial Class Clientes CargaClasificaciones() - If UsuarioActual.Empresa.UsaContabilidad Then - 'CargaCuentasContables() - End If + DdlRegimenFiscal.DataSource = GlobalDTRegimenesFiscales + DdlRegimenFiscal.DataBind() CargaCombosComercioExterior() @@ -1574,6 +1577,7 @@ Partial Class Clientes DdlUsoCFDI.SelectedValueExist(ObjClientes.CveUsoCFDI.ToString()) DdlMetodoPago33.SelectedValueExist(ObjClientes.CveMetodoPago33.ToString()) DdlFormaPago33.SelectedValueExist(ObjClientes.CveFormaPago33.ToString()) + DdlRegimenFiscal.SelectedValueExist(ObjClientes.CveRegimenFiscal) ChkDesglosarIEPS.Checked = ObjClientes.DesglosaIEPS ChkNoDesglosaIVA.Checked = ObjClientes.NoDesglosaIVA @@ -2613,7 +2617,8 @@ Partial Class Clientes CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero(), CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(), DesglosaIEPS:=ChkDesglosarIEPS.Checked, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, CveTipoOperacion:=DdlTipoOperacion.SelectedValue.ToEntero(), CvePedimento:=DdlClavePedimento.SelectedValue.ToEntero(), CveIncoterm:=DdlIncoterm.SelectedValue.ToEntero(), CvePais:=DdlPais.SelectedValue.ToEntero(), CveEstado:=DdlEstado.SelectedValue.ToEntero(), CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero(), CveColonia:=DdlColonia.SelectedValue.ToEntero(), CveMotivoTraslado:=IIf(DdlMotivoTraslado.SelectedValue = "-1", "0", DdlMotivoTraslado.SelectedValue).ToString().ToEntero(), NumRegIdTrib:=IIf(TxtNumRegIdTrib.Text = "", "-1", TxtNumRegIdTrib.Text).ToString(), ComExtEstado:=IIf(TxtComExtEstado.Text = "", "-1", TxtComExtEstado.Text).ToString(), ComExtMunicipio:=IIf(TxtComExtMunicipio.Text = "", "-1", TxtComExtMunicipio.Text).ToString(), ComExtColonia:=IIf(TxtComExtColonia.Text = "", "-1", TxtComExtColonia.Text).ToString(), RequiereOC:=ChkRequiereOC.Checked, LT:=LT, LG:=LG, EsDistribuidor:=ChkEsDistribuidor.Checked, - TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero(), CargoUsado:=ChkCargoUsado.Checked, BonificacionUsado:=ChkBonificacionUsado.Checked, CveTipoRetencion:=DdlTipoRetencion.SelectedValue.ToEntero(), CorreoEntregaCompras:=TxtCorreoEntregaCompras.Text, CorreoEntregaAlmacen:=TxtCorreoEntregaAlmacen.Text, CveSATEstado:=DdlEstadoSAT.SelectedValue.ToEntero(), CveAdminTrayecto:=If(DdlAdminTrayecto.SelectedValue.ToEntero() <= 0, 0, DdlAdminTrayecto.SelectedValue.ToEntero())) Then + TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero(), CargoUsado:=ChkCargoUsado.Checked, BonificacionUsado:=ChkBonificacionUsado.Checked, CveTipoRetencion:=DdlTipoRetencion.SelectedValue.ToEntero(), CorreoEntregaCompras:=TxtCorreoEntregaCompras.Text, CorreoEntregaAlmacen:=TxtCorreoEntregaAlmacen.Text, CveSATEstado:=DdlEstadoSAT.SelectedValue.ToEntero(), CveAdminTrayecto:=If(DdlAdminTrayecto.SelectedValue.ToEntero() <= 0, 0, DdlAdminTrayecto.SelectedValue.ToEntero()), + CveRegimenFiscal:=DdlRegimenFiscal.SelectedValue.ToEntero) Then ViewState("CveCliente") = ObjClientes.CveCliente @@ -2710,7 +2715,7 @@ Partial Class Clientes ApellidoPaternoPF:=IIf(TxtApellidoPaterno.Text = "", "-1", TxtApellidoPaterno.Text).ToString(), ApellidoMaternoPF:=IIf(TxtApellidoMaterno.Text = "", "-1", TxtApellidoMaterno.Text).ToString(), NombresPF:=IIf(TxtNombres.Text = "", "-1", TxtNombres.Text).ToString(), RequiereOC:=ChkRequiereOC.Checked, LT:=LT, LG:=LG, EsDistribuidor:=ChkEsDistribuidor.Checked, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero(), CargoUsado:=ChkCargoUsado.Checked, BonificacionUsado:=ChkBonificacionUsado.Checked, CveTipoRetencion:=DdlTipoRetencion.SelectedValue.ToEntero(), CorreoEntregaCompras:=TxtCorreoEntregaCompras.Text, CorreoEntregaAlmacen:=TxtCorreoEntregaAlmacen.Text, CveSATEstado:=DdlEstadoSAT.SelectedValue.ToEntero(), CveAdminTrayecto:=If(DdlAdminTrayecto.SelectedValue.ToEntero() <= 0, 0, DdlAdminTrayecto.SelectedValue.ToEntero()), - NoDesglosaIVA:=ChkNoDesglosaIVA.Checked) Then + NoDesglosaIVA:=ChkNoDesglosaIVA.Checked, CveRegimenFiscal:=DdlRegimenFiscal.SelectedValue.ToEntero) Then ObjClientes.LimpiaImpuestosLocales(CveCliente) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 502fe40c6..d546a104b 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -10973,13 +10973,15 @@ Partial Class Ventas If Obj.FacturarSucursal Then Timbre.Receptor.RFC = Obj.ClienteSucursal.RFC Timbre.Receptor.Nombre = Obj.ClienteSucursal.Nombre + Timbre.Receptor.DomicilioFiscalReceptor = Obj.ClienteSucursal.CP Else Timbre.Receptor.RFC = Obj.Cliente.RFC Timbre.Receptor.Nombre = Obj.Cliente.Nombre + Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP End If Timbre.Receptor.RegimenFiscalReceptor = Obj.Cliente.CodigoRegimenFiscal - Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP + Timbre.Receptor.ResidenciaFiscal = "" Timbre.Receptor.NumeroRegistroTributario = "" Timbre.Receptor.UsoCFDI = Obj.ClaveUsoCFDI @@ -11119,7 +11121,8 @@ Partial Class Ventas .ClaveProdServ = drr("SATClaveProdServ").ToString(), .Noidentificacion = drr("Noidentificacion").ToString(), .CuentaPredial = drr("CuentaPredial").ToString(), - .ImporteGravaIVAAdicional = drr("ImporteIEPS").ToString().ToDecimal} + .ImporteGravaIVAAdicional = drr("ImporteIEPS").ToString().ToDecimal, + .ObjetoImpuesto = drr("CodigoObjetoImpuesto").ToString()} 'verifica suma subtotales If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal.RoundSQL(2) <> concepto.Importe.RoundSQL(2) AndAlso Math.Abs(totSubTotal.RoundSQL(2) - concepto.Importe.RoundSQL(2)) <= 0.01 Then 'proceso de ajusta de decimales concepto.Importe = totSubTotal @@ -17732,6 +17735,7 @@ Partial Class Ventas Row("CveTipoPS") = DrPS("CveTipoPS") Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario") Row("CveTamaño") = DrPS("CveTamaño") + Row("ObjetoImpuesto") = DrPS("CodigoObjetoImpuesto") If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion") If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion") @@ -18281,6 +18285,7 @@ Partial Class Ventas TmpDT.Columns.Add("TieneProntoPago", GetType(String)) TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal)) + TmpDT.Columns.Add("ObjetoImpuesto", GetType(String)) TmpDT.Columns("EsOutSourcing").DefaultValue = False TmpDT.Columns("EsCargo").DefaultValue = False @@ -18288,6 +18293,7 @@ Partial Class Ventas TmpDT.Columns("TieneProntoPago").DefaultValue = "No" TmpDT.Columns("ImporteProntoPago").DefaultValue = 0 + End Sub Private Sub CreaDTmpC() DTmpC = New DataTable