Correciones en ventas
This commit is contained in:
@@ -2314,6 +2314,7 @@ Partial Class Ventas
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
|
||||
|
||||
If Not IsPostBack Then
|
||||
|
||||
If IfNull(Request("Opcionx"), "").ToString = "Saldar" And UsuarioActual.CveUsuario = 100 Then
|
||||
@@ -3165,6 +3166,10 @@ Partial Class Ventas
|
||||
BrSubProyecto.Visible = DdlProyecto.Visible
|
||||
divProyectoPyME.Visible = DdlProyecto.Visible
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(172, 173) Then
|
||||
LnkAddVenta.Visible = True
|
||||
End If
|
||||
|
||||
'MOSTRAR LA OPCION DE AGREGAR PS EN BDH
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveVenta <= 0 Then
|
||||
ImgOtrosConceptos.Visible = False
|
||||
@@ -7685,33 +7690,36 @@ Partial Class Ventas
|
||||
e.Row.FCTextBox("TxtDescuento").Enabled = False
|
||||
End If
|
||||
|
||||
'Si es una devolucion
|
||||
If NuevaFactura = 0 Then
|
||||
e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False
|
||||
e.Row.FCDropDownList("DdlClasificacion").Enabled = False
|
||||
e.Row.FCDropDownLost("DdlPS").Enabled = False
|
||||
e.Row.FCDropDownList("DdlProyecto").Enabled = False
|
||||
e.Row.FCDropDownList("DdlSubProyecto").Enabled = False
|
||||
e.Row.FCTextBox("TxtPrecio").Enabled = False
|
||||
ElseIf NuevaFactura = 1 Or CveContrato > 0 Then
|
||||
e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False
|
||||
e.Row.FCDropDownList("DdlClasificacion").Enabled = False
|
||||
e.Row.FCDropDownLost("DdlPS").Enabled = False
|
||||
e.Row.FCTextBox("TxtCantidad").Enabled = False
|
||||
e.Row.FCTextBox("TxtPrecio").Enabled = False
|
||||
e.Row.FCTextBox("TxtDescuento").Enabled = False
|
||||
|
||||
If TieneAlmacen Then e.Row.FCLinkButton("imgD").Visible = False
|
||||
If Not EsCreaApartirDe Then
|
||||
'Si es una devolucion
|
||||
If NuevaFactura = 0 Then
|
||||
e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False
|
||||
e.Row.FCDropDownList("DdlClasificacion").Enabled = False
|
||||
e.Row.FCDropDownLost("DdlPS").Enabled = False
|
||||
e.Row.FCDropDownList("DdlProyecto").Enabled = False
|
||||
e.Row.FCDropDownList("DdlSubProyecto").Enabled = False
|
||||
e.Row.FCTextBox("TxtPrecio").Enabled = False
|
||||
ElseIf NuevaFactura = 1 Or CveContrato > 0 Then
|
||||
e.Row.FCDropDownList("DdlUnidadMedida").Enabled = False
|
||||
e.Row.FCDropDownList("DdlClasificacion").Enabled = False
|
||||
e.Row.FCDropDownLost("DdlPS").Enabled = False
|
||||
e.Row.FCTextBox("TxtCantidad").Enabled = False
|
||||
e.Row.FCTextBox("TxtPrecio").Enabled = False
|
||||
e.Row.FCTextBox("TxtDescuento").Enabled = False
|
||||
|
||||
If TieneAlmacen Then e.Row.FCLinkButton("imgD").Visible = False
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(222) Then
|
||||
e.Row.FCDropDownList("DdlUnidadMedida").Enabled = True
|
||||
e.Row.FCDropDownList("DdlClasificacion").Enabled = True
|
||||
e.Row.FCDropDownLost("DdlPS").Enabled = True
|
||||
e.Row.FCTextBox("TxtCantidad").Enabled = True
|
||||
e.Row.FCTextBox("TxtPrecio").Enabled = True
|
||||
e.Row.FCTextBox("TxtDescuento").Enabled = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(222) Then
|
||||
e.Row.FCDropDownList("DdlUnidadMedida").Enabled = True
|
||||
e.Row.FCDropDownList("DdlClasificacion").Enabled = True
|
||||
e.Row.FCDropDownLost("DdlPS").Enabled = True
|
||||
e.Row.FCTextBox("TxtCantidad").Enabled = True
|
||||
e.Row.FCTextBox("TxtPrecio").Enabled = True
|
||||
e.Row.FCTextBox("TxtDescuento").Enabled = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'Si es facturacion de OC o Contrato
|
||||
@@ -19832,7 +19840,7 @@ Partial Class Ventas
|
||||
If TieneMovimientosContrato Then
|
||||
MovDetalle = CuadrarFacturaMovimientos(ObjVentas, CveRemision, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}"))
|
||||
Else
|
||||
MovDetalle = CuadrarFacturaMovimientos(ObjVentas, CveRemision, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND (TieneSalidaxFactura IS NULL OR SaldoAlmacen > 0)"))
|
||||
MovDetalle = CuadrarFacturaMovimientos(ObjVentas, CveRemision, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND (SaldoAlmacen > 0 AND CantidadDisponible > 0)"))
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -21466,9 +21474,14 @@ Partial Class Ventas
|
||||
'REGENERAR EL PDF
|
||||
If Not OcurrioError Then
|
||||
Try
|
||||
Dim CveEmpresaPDF As Integer = UsuarioActual.CveEmpresa
|
||||
Dim CveUsuarioPDF As Integer = UsuarioActual.CveUsuario
|
||||
|
||||
Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
Dim Hilo As New System.Threading.Thread(Sub() RegenerarPDF(CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, strURLHOST))
|
||||
Hilo.Start()
|
||||
RegenerarPDF(CveVenta, CveEmpresaPDF, CveUsuarioPDF, strURLHOST)
|
||||
'
|
||||
'Dim Hilo As New System.Threading.Thread(Sub() )
|
||||
'Hilo.Start()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al regenerar el PDF", ex)
|
||||
End Try
|
||||
@@ -22483,12 +22496,13 @@ Partial Class Ventas
|
||||
DivDireccionCliente.Visible = False
|
||||
|
||||
DivNumeroCPCliente.Visible = False
|
||||
DivColoniaTelefonoCliente.Visible = False
|
||||
'DivColoniaTelefonoCliente.Visible = False
|
||||
DivCiudadLocalidadCliente.Visible = False
|
||||
DivEstadoPaisCliente.Visible = False
|
||||
DivCorreoCuentaCliente.Visible = False
|
||||
DivBotonesAgregarCliente.Visible = False
|
||||
DivFormaCliente.Visible = False
|
||||
divRegimenCliente.Visible = False
|
||||
UpAgregarCliente.Update()
|
||||
CargaEstados()
|
||||
|
||||
@@ -22502,7 +22516,7 @@ Partial Class Ventas
|
||||
DivTipoPersona.Visible = True
|
||||
DivDireccionCliente.Visible = True
|
||||
DivNumeroCPCliente.Visible = True
|
||||
DivColoniaTelefonoCliente.Visible = True
|
||||
'DivColoniaTelefonoCliente.Visible = True
|
||||
DivCiudadLocalidadCliente.Visible = True
|
||||
DivEstadoPaisCliente.Visible = True
|
||||
DivCorreoCuentaCliente.Visible = True
|
||||
@@ -22515,9 +22529,16 @@ Partial Class Ventas
|
||||
RFVCiudadC.Visible = False
|
||||
RFVLocalidadC.Visible = False
|
||||
RFVSATPais.Visible = False
|
||||
divRegimenCliente.Visible = UsuarioActual.Empresa.Funcionalidad(350) = "1"
|
||||
|
||||
RdTipoPersona.SelectedValue = "0"
|
||||
|
||||
DdlMetodoCliente.SelectedValueExist(1)
|
||||
DdlFormaCliente.SelectedValueExist(1)
|
||||
|
||||
DdlRegimenFiscalCliente.DataSource = GlobalDTRegimenesFiscales().FiltraParametros("CveRegimenFiscal = 11")
|
||||
DdlRegimenFiscalCliente.DataBind()
|
||||
CargaComboCFDICliente()
|
||||
Else
|
||||
Dim ObjCliente As New ClsClientes
|
||||
If ObjCliente.ValidaClienteRFC(TxtRFCCliente.Text, UsuarioActual.CveEmpresa) Then
|
||||
@@ -22532,12 +22553,13 @@ Partial Class Ventas
|
||||
DivTipoPersona.Visible = True
|
||||
DivDireccionCliente.Visible = True
|
||||
DivNumeroCPCliente.Visible = True
|
||||
DivColoniaTelefonoCliente.Visible = True
|
||||
'DivColoniaTelefonoCliente.Visible = True
|
||||
DivCiudadLocalidadCliente.Visible = True
|
||||
DivEstadoPaisCliente.Visible = True
|
||||
DivCorreoCuentaCliente.Visible = True
|
||||
DivBotonesAgregarCliente.Visible = True
|
||||
DivFormaCliente.Visible = True
|
||||
divRegimenCliente.Visible = UsuarioActual.Empresa.Funcionalidad(350) = "1"
|
||||
End If
|
||||
End If
|
||||
ObjCliente.Dispose()
|
||||
@@ -22552,12 +22574,54 @@ Partial Class Ventas
|
||||
DdlMetodoCliente.SelectedValueExist(-1)
|
||||
DdlFormaCliente.SelectedValueExist(-1)
|
||||
|
||||
DdlRegimenFiscalCliente.DataSource = GlobalDTRegimenesFiscales()
|
||||
DdlRegimenFiscalCliente.DataBind()
|
||||
CargaComboCFDICliente()
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaComboCFDICliente()
|
||||
If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then
|
||||
DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI().FiltraParametros("CveUsoCFDI = 23")
|
||||
DdlUsoCFDICliente.DataBind()
|
||||
Else
|
||||
Dim RegimenFiscalCliente = DdlRegimenFiscalCliente.SelectedValue.ToString()
|
||||
If Not UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then
|
||||
RegimenFiscalCliente = "-1"
|
||||
End If
|
||||
|
||||
DdlUsoCFDICliente.Items.Clear()
|
||||
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
|
||||
Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
|
||||
DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
|
||||
Else
|
||||
DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente)
|
||||
End If
|
||||
|
||||
DdlUsoCFDICliente.DataBind()
|
||||
DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End If
|
||||
|
||||
|
||||
UpAgregarCliente.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlRegimenFiscalCliente_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CargaComboCFDICliente()
|
||||
End Sub
|
||||
|
||||
Private Sub BtnAgregarCliente_Click(sender As Object, e As EventArgs) Handles BtnAgregarCliente.Click
|
||||
Dim CvePrecioLista As Integer = -1
|
||||
Dim CveRegimenFiscal As Integer = -1
|
||||
Dim CveUsoCFDI As Integer = 3
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
|
||||
CveRegimenFiscal = DdlRegimenFiscalCliente.SelectedValue.ToEntero()
|
||||
CveUsoCFDI = DdlUsoCFDICliente.SelectedValue.ToEntero()
|
||||
End If
|
||||
|
||||
If DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then
|
||||
Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa).Rows(0)
|
||||
If Dr IsNot Nothing Then
|
||||
@@ -22575,7 +22639,7 @@ Partial Class Ventas
|
||||
TxtColoniaCliente.Text.Trim, TxtLocalidadCliente.Text.Trim, TxtCiudadCliente.Text.Trim, DdlEstadoSAT.SelectedValue.ToEntero,
|
||||
TxtRFCCliente.Text.Trim, TxtCPCliente.Text.Trim, TxtTelefonoCliente.Text.Trim, TxtCorreoCliente.Text.Trim,
|
||||
DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, CvePrecioLista:=CvePrecioLista,
|
||||
RegimenSociedad:=TxtRegimenSociedad.Text, TipoPersona:=TipoPersona) Then
|
||||
RegimenSociedad:=TxtRegimenSociedad.Text, TipoPersona:=TipoPersona, CveRegimenFiscal:=CveRegimenFiscal, CveUsoCFDI:=CveUsoCFDI) Then
|
||||
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
RegistraScript("hideDivEC();")
|
||||
@@ -22747,6 +22811,10 @@ Partial Class Ventas
|
||||
LBAplicaDevolucion.Visible = False
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Dev" AndAlso VentaSaldoAlmacen <> 0 Then
|
||||
LiDevolucionAlmacen.Visible = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
UpnTools.Update()
|
||||
@@ -33481,9 +33549,13 @@ Partial Class Ventas
|
||||
|
||||
'REGENERAR EL PDF
|
||||
Try
|
||||
Dim CveEmpresaPDF As Integer = UsuarioActual.CveEmpresa
|
||||
Dim CveUsuarioPDF As Integer = UsuarioActual.CveUsuario
|
||||
|
||||
Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port)
|
||||
Dim Hilo As New System.Threading.Thread(Sub() RegenerarPDF(CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, strURLHOST))
|
||||
Hilo.Start()
|
||||
RegenerarPDF(CveVenta, CveEmpresaPDF, CveUsuarioPDF, strURLHOST)
|
||||
'Dim Hilo As New System.Threading.Thread(Sub() )
|
||||
'Hilo.Start()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al regenerar el PDF", ex)
|
||||
End Try
|
||||
@@ -34447,6 +34519,28 @@ Partial Class Ventas
|
||||
DivRazonSocial2.Attributes.Add("class", "col-md-8")
|
||||
DVRegimenSociedad.Visible = True
|
||||
|
||||
If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then
|
||||
DdlRegimenFiscalCliente.DataSource = GlobalDTRegimenesFiscales().FiltraParametros("CveRegimenFiscal = 11")
|
||||
DdlRegimenFiscalCliente.DataBind()
|
||||
Else
|
||||
Dim dt As DataTable = GlobalDTRegimenesFiscales(RdTipoPersona.SelectedValue.ToEntero).FiltraParametros("", "CodigoRegimenFiscal")
|
||||
Dim Val As String
|
||||
|
||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||
'verifico que sino existe el valor. lo limpie
|
||||
Val = dt.FiltroPrimeroValor("CveRegimenFiscal", "CveRegimenFiscal = " & DdlRegimenFiscalCliente.SelectedValue)
|
||||
If Val = "" Then 'sino encuentra valor, lo limpia
|
||||
DdlRegimenFiscalCliente.Items.Clear()
|
||||
DdlRegimenFiscalCliente.SelectedValue = Nothing
|
||||
End If
|
||||
End If
|
||||
|
||||
DdlRegimenFiscalCliente.DataSource = dt
|
||||
DdlRegimenFiscalCliente.DataBind()
|
||||
DdlRegimenFiscalCliente.SelectedValueExist(Val)
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
UpAgregarCliente.Update()
|
||||
|
||||
Reference in New Issue
Block a user