This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2020-10-14 05:40:19 -07:00
65 changed files with 4496 additions and 2594 deletions

View File

@@ -109,7 +109,7 @@ Partial Class CatClasificaciones
End If
UpModalClasif.Update()
If UsuarioActual.Empresa.UsaContabilidad Then
If UsuarioActual.Empresa.TipoContabilizacion = 1 Then
''COMENTADO DF 30 JUNIO 2017
'Dim Cuenta As New ClsContPAQi(UsuarioActual.Empresa)
@@ -118,13 +118,16 @@ Partial Class CatClasificaciones
'End If
'Cuenta.Dispose()
Else
DivCuentaIngresos.Visible = False
DivCuentaCostos.Visible = False
DivCuentaGasto.Visible = False
If UsuarioActual.Empresa.TipoContabilizacion = 2 Then
DivCuentaIngresos.Visible = False
DivCuentaCostos.Visible = False
DivCuentaGasto.Visible = False
GvDatos.Columns(1).Visible = False
GvDatos.Columns(2).Visible = False
GvDatos.Columns(3).Visible = False
End If
GvDatos.Columns(1).Visible = False
GvDatos.Columns(2).Visible = False
GvDatos.Columns(3).Visible = False
End If
DdlCuentaGasto.Items.Insert(0, New ListItem("-", "-1"))

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))
@@ -1902,7 +1923,7 @@ Partial Class Clientes
GvDireccionesEnvio.DataBind()
If TxtRFC.Text = "XAXX010101000" Then
GvDireccionesEnvio.HeaderRow.FCLiteral("LtlNombreSucursal").Text = "Cliente"
If GvDireccionesEnvio.HeaderRow IsNot Nothing AndAlso GvDireccionesEnvio.HeaderRow.FCLiteral("LtlNombreSucursal") IsNot Nothing Then GvDireccionesEnvio.HeaderRow.FCLiteral("LtlNombreSucursal").Text = "Cliente"
LtlNombreSucursal.Text = "Cliente"
LtlNombreSucursalTitulo.Text = "Cliente"
LtlTituloSurcusalCliente.Text = "Datos del cliente"

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

@@ -1162,6 +1162,16 @@ Partial Class ProductosyServicios
Return
End If
If UsuarioActual.CveEmpresa = 119 AndAlso DdlTipoPS.SelectedValue = "2" Then
If TxtVentaMinima.Text.ToDecimal <= 0 Then
Alert("La cantidad de venta mínima debe de ser especificada (mayor a cero)", TipoMensaje.MsgAdvertencia)
Return
End If
End If
Dim ObjProductosServicios As New ClsProductosServicios()
Dim ObjInv As New ClsInventarios(ObjProductosServicios.IniciaTransacSQL())
@@ -1176,6 +1186,7 @@ Partial Class ProductosyServicios
CveProveedor = DdlProveedor.txtValue.Value.ToEntero
End If
Dim CveMarca As Integer = 0
If UsuarioActual.CveEmpresa.Contiene(1, 72, 80) And CvePS = -1 Then CveMarca = DdlMarcaPSDes.SelectedValue.ToEntero Else CveMarca = DdlMarca.SelectedValue.ToEntero
@@ -2019,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

@@ -5369,6 +5369,7 @@
<div class="form-group form-md-line-input input-iconright" id="DivPSSAT" runat="server" visible="false">
<ADS:Dropdownlost runat="server" ID="DdlSATPS" CssStyle="width: 100%;" CssClass="form-control input-sm select2me" DataTextField="Descripcion" DataValueField="CveSATPS" />
<%--<asp:RequiredFieldValidator ID="RfvDdlSATPS" runat="server" CssClass="help-block errorimput" ControlToValidate="DdlSATPS" InitialValue="" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Producto SAT''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddPS"></asp:RequiredFieldValidator>--%>
<label for="<%= DdlSATPS.ClientID.ToString()%>">Producto SAT:</label>
</div>

View File

@@ -1985,7 +1985,6 @@ Partial Class Ventas
DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat")
DivPSSAT.Visible = True
SetValues()
CvePresupuesto = 0
@@ -2157,7 +2156,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
@@ -5263,7 +5262,7 @@ Partial Class Ventas
DdlSucursalCliente.DataBind()
'SI UTILIZA EL RFC GENERICO PERMITE FACTURAR SUCURSAL
If (CveVenta <= 0 OrElse NuevaFactura = 1) AndAlso LblRFC.Text.Trim() = "XAXX010101000" Then
If (Not UsuarioActual.CveEmpresa.Contiene(141)) AndAlso (CveVenta <= 0 OrElse NuevaFactura = 1) AndAlso LblRFC.Text.Trim() = "XAXX010101000" Then
HabilitarFacturacionSucursal()
End If
@@ -5663,7 +5662,7 @@ Partial Class Ventas
End If
'SI EL CLIENTE TIENE RFC GENERICO Y LA SUCURSAL TIENE RFC DEBE FACTURAR LA SUCURSAL
If LblRFC.Text.Trim() = "XAXX010101000" AndAlso Not String.IsNullOrEmpty(ObjCliente.DtResultados.Rows(0)("RFC").ToString()) Then
If (Not UsuarioActual.CveEmpresa.Contiene(141)) AndAlso LblRFC.Text.Trim() = "XAXX010101000" AndAlso Not String.IsNullOrEmpty(ObjCliente.DtResultados.Rows(0)("RFC").ToString()) Then
Me.FacturarSucursal = True
LtlTitleRFCSucursal.Text = "RFC:"
@@ -7081,7 +7080,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
@@ -12073,8 +12072,8 @@ Partial Class Ventas
Exit For
End If
End If
Dim CveSeccionAlmacen As Integer = -1
If AplicaSeccion Then CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacen, CveProducto).FiltroPrimeroValor("CveSeccionAlmacen", "").ToEntero
Dim CveSeccionAlmacen As Integer = -3
'If AplicaSeccion Then CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacen, CveProducto).FiltroPrimeroValor("CveSeccionAlmacen", "").ToEntero
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Dr("Serie").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
OcurrioError = True
@@ -12625,7 +12624,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 +12666,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 +12705,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)
@@ -14252,14 +14251,13 @@ Partial Class Ventas
End If
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {ddlAlmacen.SelectedValue}").ToEntero()
CveCuenta = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {ddlAlmacen.SelectedValue}").ToEntero()
ValorInventario = DTMovimientosDetalles.SUMD("Total", $"CveMovimiento = {Mov("CveMovimiento")}").RoundSQL()
If ValorInventario <> 0 Then
'Entrada
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveDevolucion, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=-1, CveMovimientoAlmacen:=CveMovimientoInventarioEntrada, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveDevolucion, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=-1, CveMovimientoAlmacen:=CveMovimientoInventarioEntrada, ImporteMX:=ValorInventario) Then
'Salida
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ValorInventario, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=-1, CveMovimientoAlmacen:=CveMovimientoInventarioSalida, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ValorInventario, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=-1, CveMovimientoAlmacen:=CveMovimientoInventarioSalida, ImporteMX:=ValorInventario) Then
OcurrioError = True
Exit For
End If
@@ -14555,116 +14553,116 @@ Partial Class Ventas
If UsuarioActual.TienePermisoProceso(68) AndAlso Not PSCodigoSAT.Contiene("84111506", "80141610") Then TxtPrecio.Enabled = False
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 Then
DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString())
CambiaMoneda()
DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString())
CambiaMoneda()
End If
'SUGIERE PRECIO
Dim PrecioSugerido = 0.0
PrecioSugerido = drPS("Precio").ToString().ToDouble
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
'SUGIERE PRECIO
Dim PrecioSugerido = 0.0
PrecioSugerido = drPS("Precio").ToString().ToDouble
If UsuarioActual.CveEmpresa.Contiene(1) Then
If CvePrecioListaPS > 0 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
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 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
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
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
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
'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 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
TxtPrecio.Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere
If PrecioBaseCosto > 0 Then
PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1)
End If
TxtPrecio.Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere
End If
If IsNumeric(TxtCantidad.Text.Trim) Then
LblTotalPS.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString().FormatoNumero(2)
If IsNumeric(TxtCantidad.Text.Trim) Then
LblTotalPS.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString().FormatoNumero(2)
Else
LblTotalPS.Text = "0.00"
End If
LblPrecio1.Text = TxtPrecio.Text
UPPDescuento.Update()
HdnIVAPS.Value = If(drPS("IVA").ToString() = "-1", ViewState("IVA"), drPS("IVA").ToString()).ToString()
HdnIVARetAPS.Value = drPS("RetIVA").ToString()
HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString()
HdnCtaContable.Value = drPS("IdCtaContVentas").ToString()
HdnAplicaParaConcepto.Value = drPS("AplicaParaConcepto").ToString()
HdnCodigo.Value = drPS("Codigo").ToString()
If DdlClasificacion.SelectedIndex = 0 Then
If drPS("CveClasificacion").ToString() IsNot Nothing Then
DdlClasificacion.SelectedValueExist(drPS("CveClasificacion").ToString())
Else
LblTotalPS.Text = "0.00"
End If
LblPrecio1.Text = TxtPrecio.Text
UPPDescuento.Update()
HdnIVAPS.Value = If(drPS("IVA").ToString() = "-1", ViewState("IVA"), drPS("IVA").ToString()).ToString()
HdnIVARetAPS.Value = drPS("RetIVA").ToString()
HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString()
HdnCtaContable.Value = drPS("IdCtaContVentas").ToString()
HdnAplicaParaConcepto.Value = drPS("AplicaParaConcepto").ToString()
HdnCodigo.Value = drPS("Codigo").ToString()
If DdlClasificacion.SelectedIndex = 0 Then
If drPS("CveClasificacion").ToString() IsNot Nothing Then
DdlClasificacion.SelectedValueExist(drPS("CveClasificacion").ToString())
Else
Alert("El Productos/Servicio no tiene asignada una Clasificación.", TipoMensaje.MsgInformacion)
End If
Alert("El Productos/Servicio no tiene asignada una Clasificación.", TipoMensaje.MsgInformacion)
End If
End If
ElseIf CvePSParametro = -2 Then
End If
ElseIf CvePSParametro = -2 Then
CargaPS(DdlClasificacion.SelectedValue.ToEntero(), Ddl)
End If
@@ -15774,7 +15772,7 @@ Partial Class Ventas
End If
'VERIFICA SI EN LA FACTURA PADRE SE DESGLOSO EL IEPS
Dim FacturaDesglosoIEPS As Boolean = ((CveDevolucion > 0 AndAlso NuevaFactura = 1) AndAlso (Me.ObjFacturaNC IsNot Nothing AndAlso Me.ObjFacturaNC.VentaDesglosaIEPS))
Dim FacturaDesglosoIEPS As Boolean = ((CveDevolucion > 0 AndAlso NuevaFactura = 1) AndAlso (Me.ObjFacturaNC IsNot Nothing AndAlso Not Me.ObjFacturaNC.VentaDesglosaIEPS))
If Not ClienteDesglosaIEPS Then
If Not RegeneraIEPS AndAlso Not FacturaDesglosoIEPS Then
@@ -17758,7 +17756,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
@@ -17771,12 +17769,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
@@ -17786,14 +17784,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
@@ -21287,6 +21285,11 @@ Partial Class Ventas
Return
End If
If DdlSATPS.SelectedValue = "" OrElse DdlSATPS.SelectedValue = "46920" Then
Alert("Producto SAT no valido", TipoMensaje.MsgAdvertencia)
Return
End If
Dim CveMetodoInventario As Integer = 0
If ChkRequiereSerie.Checked Then CveMetodoInventario = 5 Else CveMetodoInventario = 1
@@ -21609,11 +21612,12 @@ Partial Class Ventas
Return False
End If
If AplicaSeccion Then
CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, CveProducto).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero
Else
CveSeccionAlmacen = -1
End If
'If AplicaSeccion Then
' CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, CveProducto).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero
'Else
' CveSeccionAlmacen = -1
'End If
CveSeccionAlmacen = -3
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, 1, CveUnidad, CveProducto, 0, -1, Serie:=Dr2("Serie").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
Return False
@@ -21625,11 +21629,12 @@ Partial Class Ventas
Return False
End If
If AplicaSeccion Then
CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, CveProducto).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero
Else
CveSeccionAlmacen = -1
End If
'If AplicaSeccion Then
' CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, CveProducto).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero
'Else
' CveSeccionAlmacen = -1
'End If
CveSeccionAlmacen = -3
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, Cantidad, CveUnidad, CveProducto, 0, -1, CveSeccionAlmacen:=CveSeccionAlmacen, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
Return False
@@ -22990,6 +22995,7 @@ Partial Class Ventas
AplicaNC = False
LBNotaCredito.Visible = True
'LkNotaCredito.Visible = False
DeshabilitarAplicarNotaDeCredito(LblRFC.Text)
TxtNCPorcentaje.Attributes.Add("onkeyup", "CalculaImporteNC();")
TxtNCImporte.Attributes.Add("onkeyup", "CalculaPorcentajeNC();")
@@ -24747,6 +24753,10 @@ Partial Class Ventas
GvImpuestosLocales2.Enabled = True
If DdlTipoComprobante.SelectedValue = "Cot" Then
DdlIVA.Visible = True
End If
BloqueaCondiconesPago()
UpPS.Update()
@@ -26539,6 +26549,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()
@@ -27311,4 +27326,12 @@ Partial Class Ventas
#End Region
Protected Sub DdlClasificacionPS_SelectedIndex(sender As Object, e As EventArgs) Handles DdlClasificacionPS.SelectedIndexChanged
Dim SATPS As DataTable = GlobalDTClasificaciones(CveEmpresa:=UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionPS.SelectedValue.ToEntero)
Dim CveSATPS As String = SATPS.FiltroPrimeroValor("CveSATPS")
Dim SatPSText As String = SATPS.FiltroPrimeroValor("SATClaveProductoServicio")
DdlSATPS.SelectedValue = CveSATPS
DdlSATPS.SelectedText = SatPSText
End Sub
End Class