-- mejora

This commit is contained in:
2023-08-18 19:06:42 -07:00
parent 3d032c7dfe
commit cd9d8346f2
18 changed files with 263 additions and 356 deletions

View File

@@ -2538,11 +2538,11 @@ Partial Class Clientes
Dim NombreCuentaCuentaAltaCompaq As String = ""
Dim IdCuentaAltaCompaq As Integer = -1
'Si tiene contabilizacion automatica y la funcionalidad de carga cuenta automatica o UsaAC le agregamos automaticamente una cuenta al cliente
If UsuarioActual.Empresa.Funcionalidad(211).ToEntero() > 0 AndAlso (UsuarioActual.Empresa.Funcionalidad(200).ToEntero() > 0 Or UsuarioActual.Empresa.UsaAC) AndAlso DdlCtaContableClientes.SelectedValue.ToEntero() < 1 Then
If Not AgregarCuentaContable(BtnActivaRegistroClientes, DdlCtaContableClientes, CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, IdCuentaAltaCompaq) Then
ErrorProceso = True
End If
End If
'If UsuarioActual.Empresa.Funcionalidad(211).ToEntero() > 0 AndAlso (UsuarioActual.Empresa.Funcionalidad(200).ToEntero() > 0 Or UsuarioActual.Empresa.UsaAC) AndAlso DdlCtaContableClientes.SelectedValue.ToEntero() < 1 Then
' If Not AgregarCuentaContable(BtnActivaRegistroClientes, DdlCtaContableClientes, CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, IdCuentaAltaCompaq) Then
' ErrorProceso = True
' End If
'End If
'Dim MetodoPago = DdlMetodoPago.SelectedValue.Toentero()
'If UsuarioActual.Empresa.CvePlataforma = 3 Then
@@ -2612,12 +2612,11 @@ Partial Class Clientes
End If
End If
If IdCuentaAltaCompaq > 0 Then
If Not AltaCuentaContabilidadSIG(CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, IdCuentaAltaCompaq, 1, ObjClientes.IniciaTransacSQL) Then
ErrorProceso = True
End If
End If
'If IdCuentaAltaCompaq > 0 Then
' If Not AltaCuentaContabilidadSIG(CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, IdCuentaAltaCompaq, 1, ObjClientes.IniciaTransacSQL) Then
' ErrorProceso = True
' End If
'End If
If ErrorProceso Then
ObjClientes.RollBack()
@@ -2638,7 +2637,6 @@ Partial Class Clientes
End If
End If
Else
Dim NombreCliente As String = ""
If TxtRFC.Text.Length = 13 AndAlso TxtApellidoPaterno.Text <> "" AndAlso TxtApellidoMaterno.Text <> "" AndAlso TxtNombres.Text <> "" Then
@@ -2672,7 +2670,6 @@ Partial Class Clientes
ObjClientes.AddClienteImpuestosLocales(CveCliente, GVR.DataKey("CveImpuestoLocal").ToEntero())
End If
Next
GuardarDocumentosClientes()
'For Each gvr As GridViewRow In GvDocsVentas.Rows
@@ -2753,18 +2750,13 @@ Partial Class Clientes
#Region "G L O B L A L"
Private Sub RecargaGlobal()
'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT)
'Hilo.Start()
Private Sub RecargaGlobal()
GeneraGlobalDT()
End Sub
Private Sub GeneraGlobalDT()
GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing
'Dim Objclientes As New ClsClientes
'If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then
' Application("GlobalDTCliente") = Objclientes.DtResultados
'End If
'Objclientes.Dispose()
GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing
End Sub
#End Region
@@ -3701,147 +3693,147 @@ Partial Class Clientes
End Sub
Public Sub BtnAgregaCuentaContable(sender As Object, e As EventArgs) Handles BtnActivaRegistroClientes.Click, BtnActivaRegistroAnticipos.Click, BtnActivaRegistroIVA.Click, BtnActivaRegistroISR.Click
Dim CuentaContable = DirectCast(sender, Button).CommandArgument.ToString()
Dim Button = DirectCast(sender, Button)
'Dim CuentaContable = DirectCast(sender, Button).CommandArgument.ToString()
'Dim Button = DirectCast(sender, Button)
Dim CodigoCuentaAltaCompaq As String = ""
Dim NombreCuentaCuentaAltaCompaq As String = ""
Dim IdCuentaAltaCompaq As Integer = -1
'Dim CodigoCuentaAltaCompaq As String = ""
'Dim NombreCuentaCuentaAltaCompaq As String = ""
'Dim IdCuentaAltaCompaq As Integer = -1
Select Case CuentaContable
Case "Clientes"
AgregarCuentaContable(Button, DdlCtaContableClientes, "", "", -1)
Case "Anticipos"
'Select Case CuentaContable
' Case "Clientes"
' AgregarCuentaContable(Button, DdlCtaContableClientes, "", "", -1)
' Case "Anticipos"
AgregarCuentaContable(Button, DdlCtaContableAnticipos, CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, IdCuentaAltaCompaq)
AltaCuentaContabilidadSIG(CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, IdCuentaAltaCompaq, 3)
' AgregarCuentaContable(Button, DdlCtaContableAnticipos, CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, IdCuentaAltaCompaq)
' AltaCuentaContabilidadSIG(CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, IdCuentaAltaCompaq, 3)
Case "RetIVA"
' Case "RetIVA"
AgregarCuentaContable(Button, DdlCtaContableRetIVA, "", "", -1)
Case "RetISR"
AgregarCuentaContable(Button, DdlCtaContableRetISR, "", "", -1)
End Select
' AgregarCuentaContable(Button, DdlCtaContableRetIVA, "", "", -1)
' Case "RetISR"
' AgregarCuentaContable(Button, DdlCtaContableRetISR, "", "", -1)
'End Select
End Sub
Private Function AgregarCuentaContable(btn As Button, ddl As DropDownList, ByRef CodigoCuentaAltaCompaq As String, ByRef NombreCuentaCuentaAltaCompaq As String, ByRef IdCuentaAltaCompaq As Integer) As Boolean
Dim IdCuentaContable As Integer = -1
Dim CtaCodigo As String = ""
Dim TieneError = False
Dim ProcesoCorrecto As Boolean
Dim ObjContaAC As New ClsContPAQi(UsuarioActual.Empresa)
ObjContaAC.IniciaTransacSQL()
Dim CuentaPadre = -1
Select Case btn.CommandArgument.ToString()
Case "Clientes"
CuentaPadre = UsuarioActual.Empresa.Funcionalidad(211).ToEntero()
Case "Anticipos"
CuentaPadre = UsuarioActual.Empresa.Funcionalidad(212).ToEntero()
Case "RetIVA"
CuentaPadre = UsuarioActual.Empresa.Funcionalidad(213).ToEntero()
Case "RetISR"
CuentaPadre = UsuarioActual.Empresa.Funcionalidad(214).ToEntero()
End Select
'SI EL NOMBRE DEL PROVEEDOR ES MAYOR DE 50 LO CORTAMOS
Dim NombreCuenta = If(TxtNombreComercial.Text.Trim.Length > 50, TxtNombreComercial.Text.Trim.Substring(0, 50), TxtNombreComercial.Text.Trim)
IdCuentaContable = ObjContaAC.AddSiguienteCuentaHijo(CuentaPadre, NombreCuenta, Tipo:="A", CuentaMayor:=2)
NombreCuentaCuentaAltaCompaq = NombreCuenta
IdCuentaAltaCompaq = IdCuentaContable
If IdCuentaContable > 0 Then
ObjContaAC.GetCuentas(IdCuentaContable, "-1", -1)
Dim dt = ObjContaAC.DtResultados
If dt.Rows.Count = 1 Then
Dim row As DataRow = dt.Rows(0)
CtaCodigo = CStr(row("CtaCodigo"))
CodigoCuentaAltaCompaq = CStr(row("Codigo"))
Else
TieneError = True
End If
Else
TieneError = True
End If
If Not TieneError Then
ObjContaAC.Commit()
'Alert(String.Format("Se registo la Cuenta Contable: {0}", CtaCodigo, TipoMensaje.MsgInformacion))
ddl.Items.Add(New ListItem(CtaCodigo, IdCuentaContable.ToString())) : ddl.SelectedValueExist(IdCuentaContable.ToString())
btn.Visible = False
ddl.Width = 206
ProcesoCorrecto = True
Else
ObjContaAC.RollBack()
Alert("error", TipoMensaje.MsgError)
ProcesoCorrecto = False
End If
ObjContaAC.Dispose()
UpFiscalContable.Update()
Return ProcesoCorrecto
End Function
Private Function AltaCuentaContabilidadSIG(CodigoCuentaAltaCompaq As String, NombreCuentaCuentaAltaCompaq As String, IdCuentaAltaCompaq As Integer, CveConceptoContable As Integer, Optional Transaccion As SqlTransaction = Nothing) As Boolean
Dim Respuesta As Boolean = False
Dim DisposeClases As Boolean = False
Dim ObjContabilidad As ClsContabilidad
If Transaccion Is Nothing Then
ObjContabilidad = New ClsContabilidad
DisposeClases = True
Else
ObjContabilidad = New ClsContabilidad(Transaccion)
DisposeClases = False
End If
If UsuarioActual.CveEmpresa.Contiene(7, 11, 145, 122) Then
Dim CvePadre As Integer = GlobalDTContaCuentasContables(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCuenta", $"IdCompaq = {UsuarioActual.Empresa.Funcionalidad(211).ToEntero()}").ToEntero
'If ObjContabilidad.GetCuentasGlobales(UsuarioActual.CveEmpresa, 1) Then
' Dim CvePadre As Integer = ObjContabilidad.DtResultados.FiltroPrimeroValor("CveCuenta").ToEntero
If CvePadre > 0 Then
Dim CvecuentaNueva As Integer = ObjContabilidad.AddCuenta(CvePadre, CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, "A", 2, 1, CveCliente:=CveCliente, IdCompaq:=IdCuentaAltaCompaq)
If CvecuentaNueva > 0 Then
If ObjContabilidad.AddCuentasAsignaciones(CveConceptoContable, UsuarioActual.CveEmpresa, CvecuentaNueva, CveCliente:=CveCliente, PorcentajeIVA:=0) Then
Respuesta = True
End If
End If
End If
'End If
Else
Respuesta = True
End If
If DisposeClases Then
ObjContabilidad.Dispose()
If Not Respuesta Then
Alert("Se presento un error al agregar y asignar la cuenta (Conta SIG).", TipoMensaje.MsgAdvertencia)
End If
End If
Return Respuesta
End Function
End Sub
'Private Function AgregarCuentaContable(btn As Button, ddl As DropDownList, ByRef CodigoCuentaAltaCompaq As String, ByRef NombreCuentaCuentaAltaCompaq As String, ByRef IdCuentaAltaCompaq As Integer) As Boolean
' Dim IdCuentaContable As Integer = -1
' Dim CtaCodigo As String = ""
' Dim TieneError = False
' Dim ProcesoCorrecto As Boolean
' Dim ObjContaAC As New ClsContPAQi(UsuarioActual.Empresa)
' ObjContaAC.IniciaTransacSQL()
' Dim CuentaPadre = -1
' Select Case btn.CommandArgument.ToString()
' Case "Clientes"
' CuentaPadre = UsuarioActual.Empresa.Funcionalidad(211).ToEntero()
' Case "Anticipos"
' CuentaPadre = UsuarioActual.Empresa.Funcionalidad(212).ToEntero()
' Case "RetIVA"
' CuentaPadre = UsuarioActual.Empresa.Funcionalidad(213).ToEntero()
' Case "RetISR"
' CuentaPadre = UsuarioActual.Empresa.Funcionalidad(214).ToEntero()
' End Select
' 'SI EL NOMBRE DEL PROVEEDOR ES MAYOR DE 50 LO CORTAMOS
' Dim NombreCuenta = If(TxtNombreComercial.Text.Trim.Length > 50, TxtNombreComercial.Text.Trim.Substring(0, 50), TxtNombreComercial.Text.Trim)
' IdCuentaContable = ObjContaAC.AddSiguienteCuentaHijo(CuentaPadre, NombreCuenta, Tipo:="A", CuentaMayor:=2)
' NombreCuentaCuentaAltaCompaq = NombreCuenta
' IdCuentaAltaCompaq = IdCuentaContable
' If IdCuentaContable > 0 Then
' ObjContaAC.GetCuentas(IdCuentaContable, "-1", -1)
' Dim dt = ObjContaAC.DtResultados
' If dt.Rows.Count = 1 Then
' Dim row As DataRow = dt.Rows(0)
' CtaCodigo = CStr(row("CtaCodigo"))
' CodigoCuentaAltaCompaq = CStr(row("Codigo"))
' Else
' TieneError = True
' End If
' Else
' TieneError = True
' End If
' If Not TieneError Then
' ObjContaAC.Commit()
' 'Alert(String.Format("Se registo la Cuenta Contable: {0}", CtaCodigo, TipoMensaje.MsgInformacion))
' ddl.Items.Add(New ListItem(CtaCodigo, IdCuentaContable.ToString())) : ddl.SelectedValueExist(IdCuentaContable.ToString())
' btn.Visible = False
' ddl.Width = 206
' ProcesoCorrecto = True
' Else
' ObjContaAC.RollBack()
' Alert("error", TipoMensaje.MsgError)
' ProcesoCorrecto = False
' End If
' ObjContaAC.Dispose()
' UpFiscalContable.Update()
' Return ProcesoCorrecto
'End Function
'Private Function AltaCuentaContabilidadSIG(CodigoCuentaAltaCompaq As String, NombreCuentaCuentaAltaCompaq As String, IdCuentaAltaCompaq As Integer, CveConceptoContable As Integer, Optional Transaccion As SqlTransaction = Nothing) As Boolean
' Dim Respuesta As Boolean = False
' Dim DisposeClases As Boolean = False
' Dim ObjContabilidad As ClsContabilidad
' If Transaccion Is Nothing Then
' ObjContabilidad = New ClsContabilidad
' DisposeClases = True
' Else
' ObjContabilidad = New ClsContabilidad(Transaccion)
' DisposeClases = False
' End If
' If UsuarioActual.CveEmpresa.Contiene(7, 11, 145, 122) Then
' Dim CvePadre As Integer = GlobalDTContaCuentasContables(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCuenta", $"IdCompaq = {UsuarioActual.Empresa.Funcionalidad(211).ToEntero()}").ToEntero
' 'If ObjContabilidad.GetCuentasGlobales(UsuarioActual.CveEmpresa, 1) Then
' ' Dim CvePadre As Integer = ObjContabilidad.DtResultados.FiltroPrimeroValor("CveCuenta").ToEntero
' If CvePadre > 0 Then
' Dim CvecuentaNueva As Integer = ObjContabilidad.AddCuenta(CvePadre, CodigoCuentaAltaCompaq, NombreCuentaCuentaAltaCompaq, "A", 2, 1, CveCliente:=CveCliente, IdCompaq:=IdCuentaAltaCompaq)
' If CvecuentaNueva > 0 Then
' If ObjContabilidad.AddCuentasAsignaciones(CveConceptoContable, UsuarioActual.CveEmpresa, CvecuentaNueva, CveCliente:=CveCliente, PorcentajeIVA:=0) Then
' Respuesta = True
' End If
' End If
' End If
' 'End If
' Else
' Respuesta = True
' End If
' If DisposeClases Then
' ObjContabilidad.Dispose()
' If Not Respuesta Then
' Alert("Se presento un error al agregar y asignar la cuenta (Conta SIG).", TipoMensaje.MsgAdvertencia)
' End If
' End If
' Return Respuesta
'End Function
#End Region

View File

@@ -8464,11 +8464,8 @@ Partial Class PV
DVRegimenSociedad.Visible = False
DivRazonSocial2.Attributes.Add("class", "col-md-12")
If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then
DivRazonSocial2.Attributes.Add("class", "col-md-8")
DVRegimenSociedad.Visible = True
DivRazonSocial2.Attributes.Add("class", "col-md-8")
DVRegimenSociedad.Visible = True
If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then
DdlRegimenFiscalCliente.DataSource = GlobalDTRegimenesFiscales().FiltraParametros("CveRegimenFiscal = 11")
@@ -8497,14 +8494,7 @@ Partial Class PV
DdlUsoCFDICliente.Items.Clear()
DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
MuestraOcultaGenero()
UpAgregarCliente.Update()
End Sub

View File

@@ -79,10 +79,8 @@ Partial Class Ventas_RepProductosServiciosDetalle
CargaParametrosDetalle()
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
LblServicioDomicilioFiltro.Visible = True
DVServicioDomicilio.Visible = True
End If
If UsuarioActual.CveEmpresa.Contiene(7, 122) Then
@@ -772,20 +770,12 @@ Partial Class Ventas_RepProductosServiciosDetalle
Private Sub BtnDescargarPDF_Click(sender As Object, e As EventArgs) Handles BtnDescargarZipPDF.Click
'If Not Directory.Exists(AppDomain.CurrentDomain.BaseDirectory & "Temp\" & UsuarioActual.CveUsuario.ToString & "\") Then
' Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory & "Temp\" & UsuarioActual.CveUsuario.ToString & "\")
'End If
Dim Archivo As String = String.Empty
Dim HuboInexistentes As Boolean = False
Dim SBInexistentes As New StringBuilder : SBInexistentes.Append("No se pudieron anexar los siguientes archivos:<br />")
Dim ArchivoDestino As String = String.Format("{0}Temp\{1}.zip", AppDomain.CurrentDomain.BaseDirectory, Now.ToString("yyyyMMddhhmmss") & UsuarioActual.CveUsuario.ToString)
Dim archiveZip As ZipArchive = ZipFile.Open(ArchivoDestino, ZipArchiveMode.Create)
Dim DTVentas As DataTable = TmpDT.FiltraParametros("", "", {"CveVenta", "TipoDocumento", "Folio", "SerieFolio"})
Try
@@ -797,10 +787,8 @@ Partial Class Ventas_RepProductosServiciosDetalle
If Drow("TipoDocumento").ToString.Trim <> String.Empty Then
Archivo = String.Format("{0}PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta.Replace("\", "/"), Drow("TipoDocumento").ToString, Drow("SerieFolio").ToString)
If File.Exists(Archivo) Then
archiveZip.CreateEntryFromFile(Archivo, Drow("SerieFolio").ToString & ".pdf")
If UsuarioActual.CveRol = 1 Then
If UsuarioActual.CveRol = 1 OrElse UsuarioActual.CveEmpresa = 119 Then
Archivo = String.Format("{0}XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta.Replace("\", "/"), Drow("TipoDocumento").ToString, Drow("SerieFolio").ToString)
If File.Exists(Archivo) Then
archiveZip.CreateEntryFromFile(Archivo, Drow("SerieFolio").ToString & ".xml")
@@ -810,7 +798,6 @@ Partial Class Ventas_RepProductosServiciosDetalle
SBInexistentes.AppendFormat("Tipo {0}, Folio {1} - {2}<br />", Drow("TipoDocumento").ToString, SerieFolio, Archivo)
End If
End If
Else
HuboInexistentes = True
SBInexistentes.AppendFormat("Tipo {0}, Folio {1} - {2}<br />", Drow("TipoDocumento").ToString, SerieFolio, Archivo)
@@ -818,14 +805,11 @@ Partial Class Ventas_RepProductosServiciosDetalle
End If
Next
Catch ex As Exception
End Try
archiveZip.Dispose()
Response.Clear()
Response.ContentType = "application/zip"
Response.AddHeader("content-disposition", $"attachment; filename=facturas{Now.ToString("yyyyMMddhhmmss")}.zip")