This commit is contained in:
rrene
2020-10-13 13:38:47 -07:00
13 changed files with 2539 additions and 1571 deletions

View File

@@ -771,6 +771,11 @@ Partial Class Clientes
VerificaVinculacion()
UpAccionesCRM.Update()
End If
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(309) Then
DeshabilitarDatosClienteCajas()
End If
End If
'End If
HlEvento.Visible = True
@@ -901,17 +906,33 @@ Partial Class Clientes
End Function
Private Function PermiteEliminar() As Boolean
Return UsuarioActual.TienePermisoProceso(194)
End Function
End Function
Private Sub DeshabilitarDatosClienteCajas()
DdlSubProyecto.Enabled = False
DdlPrecioLista.Enabled = False
DdlClasificacion.Enabled = False
DdlVendedor.Enabled = False
DdlCorporativo.Enabled = False
ChkRequiereOC.Enabled = False
ChkEsDistribuidor.Enabled = False
DdlTipoCliente.Enabled = False
TxtCorreoEntregaCompras.Enabled = False
TxtCorreoEntregaAlmacen.Enabled = False
ChkCargoUsado.Enabled = False
ChkBonificacionUsado.Enabled = False
End Sub
#End Region
#Region "C A R G A S"
Private Sub CreaDtPago()
DtPagos = New DataTable
DtPagos.Columns.Add("CveTipoMovimiento", GetType(String))

View File

@@ -412,7 +412,7 @@
<td>
<asp:UpdatePanel ID="UPPVentas" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" Width="100%">
<asp:DropDownList ID="DdlVendedor" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" Width="100%">
<asp:ListItem Selected="true" Text="Sin asignar" Value="0"></asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
@@ -557,7 +557,7 @@
<tr align="left">
<td><b>Vendedor:</b>&nbsp;</td>
<td>
<asp:DropDownList ID="DdlVendedor" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" Width="150px">
<asp:DropDownList ID="DdlVendedorEstatus" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="Vendedor" DataValueField="CveVendedor" Width="150px">
<asp:ListItem Selected="true" Text="Sin asignar" Value="0"></asp:ListItem>
</asp:DropDownList>
</td>

View File

@@ -3668,6 +3668,73 @@ Partial Class PV
End If
End If
End If
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").ToDouble
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 Double = 0
If TipoPrecioLista = 10 Then
CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero()
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 = 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").ToDouble
PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDouble
End If
ObjPS.Dispose()
End If
If PrecioSugerido = 0 Then
Dim ObjInventarios As New ClsInventarios
Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.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, TxtCantidad.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
'Dim ObjClasificaciones As New ClsClasificaciones
'If ObjClasificaciones.GetClasificaciones() Then
' PrecioBaseCosto = ObjClasificaciones.DtResultados.FiltroPrimeroValor("PrecioBaseCosto", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveClasificacion = {drPS("CveClasificacion")}").ToDecimal
'End If
If PrecioSugerido > 0 Then
Dim PrecioBaseCosto As Decimal = 0
PrecioBaseCosto = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=drPS("CveClasificacion").ToString().ToEntero()).FiltroPrimeroValor("PrecioBaseCosto", "").ToDecimal
If PrecioBaseCosto > 0 Then
PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1)
End If
End If
If PrecioSugerido > 0 Then
TxtPrecio.Text = PrecioSugerido.FormatoNumero()
RegistraScript("$get('LblPrecio1').innerText = formato_numero(" + PrecioSugerido.ToString + ", 2, '.', ',');")
@@ -5591,13 +5658,13 @@ Partial Class PV
Private Sub BtnAgregarCliente_Click(sender As Object, e As EventArgs) Handles BtnAgregarCliente.Click
Dim CvePrecioLista As Integer = -1
If DdlSubProyectoDatos.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa).Rows(0)
If Dr IsNot Nothing Then
If Dr("CvePrecioLista").ToString.ToEntero > 0 Then
CvePrecioLista = Dr("CvePrecioLista").ToString.ToEntero
End If
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
If Dr("CvePrecioLista").ToString.ToEntero > 0 Then
CvePrecioLista = Dr("CvePrecioLista").ToString.ToEntero
End If
End If
End If
Dim ObjCliente As New ClsClientes
@@ -5803,18 +5870,18 @@ Partial Class PV
'ObjPS.Dispose()
End Sub
Private Sub RecargaGlobalCliente()
'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente)
'Hilo.Start()
GeneraGlobalDTCliente()
End Sub
Private Sub RecargaGlobalCliente()
'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDTCliente)
'Hilo.Start()
GeneraGlobalDTCliente()
End Sub
Private Sub GeneraGlobalDTCliente()
GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing
'Dim Objclientes As New ClsClientes
'If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1, TipoCliente:=-1) Then
' Application("GlobalDTCliente") = Objclientes.DtResultados
'End If
'Objclientes.Dispose()
GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing
'Dim Objclientes As New ClsClientes
'If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1, TipoCliente:=-1) Then
' Application("GlobalDTCliente") = Objclientes.DtResultados
'End If
'Objclientes.Dispose()
End Sub
#End Region
@@ -6815,7 +6882,7 @@ Partial Class PV
MarcaPS = ObjPS.DtResultados.FiltroPrimeroValor("Marca", String.Format("CvePS = {0}", DdlPSAjuste.SelectedValue.ToEntero))
End If
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))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim DtDatos As New DataTable

View File

@@ -2030,17 +2030,18 @@ Partial Class ProductosyServicios
#Region "SELECTED INDEX CHANGE"
Public Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClasificacion.SelectedIndexChanged
If DdlClasificacion.SelectedValue.ToEntero > 0 Then
If Not CveSATPS > 0 Or CveSATPS = 46920 Then
If Me.CvePS <= 0 AndAlso (Not CveSATPS > 0 Or CveSATPS = 46920) Then
Dim Dr = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveClasificacion={0}", DdlClasificacion.SelectedValue.ToEntero()))(0)
DdlSATPS.SelectedValue = Dr("CveSATPS").ToString
DdlSATPS.SelectedText = Dr("SATClaveProductoServicio").ToString
If UsuarioActual.CveEmpresa.Contiene(72, 80) Then
VerificaRequiereSerieLote()
If Dr IsNot Nothing Then
DdlSATPS.SelectedValue = Dr("CveSATPS").ToString
DdlSATPS.SelectedText = Dr("SATClaveProductoServicio").ToString
End If
End If
If UsuarioActual.CveEmpresa.Contiene(72, 80) Then
VerificaRequiereSerieLote()
End If
' CargaClasificacionesDetalles()
End If

View File

@@ -2157,7 +2157,7 @@ Partial Class Ventas
DdlSubProyectoDatos.Enabled = False
BtnEmitirImprimir.Visible = False
BtnCrearApartirDe.Visible = True
If UsuarioActual.TienePermisoProceso(302) Then BtnEditar.Visible = True
If UsuarioActual.TienePermisoProceso(302) AndAlso DdlTipoComprobante.SelectedValue <> "Cot" Then BtnEditar.Visible = True
'DdlEstatus.Enabled = True
DivFechaAnticipoCliente.Visible = True
@@ -7081,7 +7081,7 @@ Partial Class Ventas
Dim DtNoEncontrados As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '01010101' ")
If DtNoEncontrados IsNot Nothing AndAlso DtNoEncontrados.Rows.Count > 0 Then
Dim StrNoEncontrados As New StringBuilder
StrNoEncontrados.Append("Los siguientes productos no tiene asignado la clave Producto SAT o Unidad Medida SAT<br/><br/>")
StrNoEncontrados.Append("Los siguientes productos no existen en el catálogo del SAT<br/><br/>")
For Each drt As DataRow In DtNoEncontrados.Rows
StrNoEncontrados.AppendFormat("{0} <br/>", drt("CodigoPS"))
Next
@@ -12625,7 +12625,7 @@ Partial Class Ventas
Try
' BytesPdfCotizacion(CveVenta)
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(CveVenta, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF))
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(CveVenta, DdlTipoComprobante.SelectedValue.ToString(), LocalSerieFolio, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF))
Hilo.Start()
Catch ex As Exception
OnError("Ocurrió error al mandar Mail", ex)
@@ -12667,7 +12667,7 @@ Partial Class Ventas
Try
' BytesPdfCotizacion(CveVenta)
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(CveVenta, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF))
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(CveVenta, DdlTipoComprobante.SelectedValue.ToString(), LocalSerieFolio, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF))
Hilo.Start()
Catch ex As Exception
OnError("Ocurrió error al mandar Mail", ex)
@@ -12706,7 +12706,7 @@ Partial Class Ventas
Try
' BytesPdfCotizacion(CveVenta)
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(CveVenta, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF))
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(CveVenta, DdlTipoComprobante.SelectedValue.ToString(), LocalSerieFolio, ChkEnviarFactura.Checked, ArchivoXML, ArchivoPDF))
Hilo.Start()
Catch ex As Exception
OnError("Ocurrió error al mandar Mail", ex)
@@ -17757,7 +17757,7 @@ Partial Class Ventas
#End Region
#Region " MANDA CORREO "
Private Sub MandaMails(CveVenta As Integer, EnviarFactura As Boolean, XML As String, PDF As String)
Private Sub MandaMails(CveVenta As Integer, TipoDocto As String, SerieFolio As String, EnviarFactura As Boolean, XML As String, PDF As String)
Dim ObjMail As New ClsSisMail()
Dim ObjVentas As New ClsVentas
@@ -17770,12 +17770,12 @@ Partial Class Ventas
Dim TipoComprobante = ""
If DdlTipoComprobante.SelectedValue.ToString() = "Ing" Then TipoComprobante = "Factura"
If DdlTipoComprobante.SelectedValue.ToString() = "Egs" Then TipoComprobante = "Nota de Crédito"
If DdlTipoComprobante.SelectedValue.ToString() = "Dev" Then TipoComprobante = "Nota de Devolución"
If DdlTipoComprobante.SelectedValue.ToString() = "Rem" Then TipoComprobante = "Remisión"
If DdlTipoComprobante.SelectedValue.ToString() = "Cot" Then TipoComprobante = "Cotización"
If DdlTipoComprobante.SelectedValue.ToString() = "Ant" Then TipoComprobante = "Anticipo"
If TipoDocto = "Ing" Then TipoComprobante = "Factura"
If TipoDocto = "Egs" Then TipoComprobante = "Nota de Crédito"
If TipoDocto = "Dev" Then TipoComprobante = "Nota de Devolución"
If TipoDocto = "Rem" Then TipoComprobante = "Remisión"
If TipoDocto = "Cot" Then TipoComprobante = "Cotización"
If TipoDocto = "Ant" Then TipoComprobante = "Anticipo"
If UsuarioActual.Empresa.PlantillaMailVenta.Trim.Length > 0 Then
Cuerpo = UsuarioActual.Empresa.PlantillaMailVenta
@@ -17785,14 +17785,14 @@ Partial Class Ventas
Cuerpo = Cuerpo.Replace("{""Fecha""}", TxtFecha.Text)
Cuerpo = Cuerpo.Replace("{""Total""}", TxtTotal.Text)
Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", TxtFechaPago.Text)
Cuerpo = Cuerpo.Replace("{""SerieFolio""}", ObjFactura.SerieFolio)
Cuerpo = Cuerpo.Replace("{""SerieFolio""}", SerieFolio)
End If
If UsuarioActual.Empresa.AsuntoPlantillaMailVenta.Trim.Length > 0 Then
Asunto = UsuarioActual.Empresa.AsuntoPlantillaMailVenta
Asunto = Asunto.Replace("{""TipoDocumento""}", TipoComprobante)
Asunto = Asunto.Replace("{""Sucursal""}", DdlSubProyectoDatos.SelectedItem.Text)
Asunto = Asunto.Replace("{""SerieFolio""}", ObjFactura.SerieFolio)
Asunto = Asunto.Replace("{""SerieFolio""}", SerieFolio)
End If
If Not EnviarFactura Then
@@ -24749,6 +24749,10 @@ Partial Class Ventas
GvImpuestosLocales2.Enabled = True
If DdlTipoComprobante.SelectedValue = "Cot" Then
DdlIVA.Visible = True
End If
BloqueaCondiconesPago()
UpPS.Update()
@@ -26541,6 +26545,11 @@ Partial Class Ventas
#Region "PORCENTAJE IVA"
Protected Sub DdlIVA_SelectedIndexChanged(sender As Object, e As EventArgs)
If Not CveVenta > 0 Or EsCreaApartirDe Or CveDevolucion > 0 Then RecalculaIVA()
If ModalidadEdicion AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
RecalculaIVA()
End If
End Sub
Private Sub RecalculaIVA()