This commit is contained in:
2024-12-10 11:37:57 -07:00
2 changed files with 121 additions and 59 deletions

View File

@@ -511,7 +511,19 @@ Partial Class Bancos_DepositosCaja
FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha) FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha)
FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha).AddDays(1) FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha).AddDays(1)
If ObjMovtos.GetRemisionesCobranza(UsuarioActual.CveEmpresa, DdlSubProyectos.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveUsuario) Then Dim CveSubProyecto As Integer = -1
If DdlSubProyectos.SelectedValue.ToEntero > 0 Then
CveSubProyecto = DdlSubProyectos.SelectedValue.ToEntero
End If
Dim CveSubProyectoCuenta = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCajaChica.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero()
If CveSubProyectoCuenta > 0 Then
CveSubProyecto = CveSubProyectoCuenta
End If
If ObjMovtos.GetRemisionesCobranza(UsuarioActual.CveEmpresa, CveSubProyecto, FechaI, FechaF) Then
Dim dtt As DataTable = ObjMovtos.DtResultados.FiltraParametros($"CveVenta > 0 AND (CveUsuarioCobranza IS NULL OR CveUsuarioCobranza = {UsuarioActual.CveUsuario}) AND TipoDocto IN ('Ing','Rem') AND RemisionEspecial = 0") Dim dtt As DataTable = ObjMovtos.DtResultados.FiltraParametros($"CveVenta > 0 AND (CveUsuarioCobranza IS NULL OR CveUsuarioCobranza = {UsuarioActual.CveUsuario}) AND TipoDocto IN ('Ing','Rem') AND RemisionEspecial = 0")
'Dim Dtta As DataTable = dtt.FiltraParametros($"CveUsuarioCobranza = {UsuarioActual.CveUsuario} ") 'Dim Dtta As DataTable = dtt.FiltraParametros($"CveUsuarioCobranza = {UsuarioActual.CveUsuario} ")
'If Dtta IsNot Nothing AndAlso Dtta.Rows.Count > 0 Then dtt = Dtta 'If Dtta IsNot Nothing AndAlso Dtta.Rows.Count > 0 Then dtt = Dtta

View File

@@ -8715,8 +8715,25 @@ Partial Class Ventas
If UsuarioActual.Empresa.Funcionalidad(360) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1" Then If UsuarioActual.Empresa.Funcionalidad(360) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
e.Row.FCHtmlGenericControl("DivPrecioLista").Visible = True e.Row.FCHtmlGenericControl("DivPrecioLista").Visible = True
e.Row.FCDropDownList("DdlPrecioListaEdit").DataSource = GlobalDTPrecioListas(UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlPrecioListaEdit").DataSource = GlobalDTPrecioListas(UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind()
If UsuarioActual.CveEmpresa = 189 Then
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Ped") Then
Using ObjVta As New ClsVentas
If ObjVta.GetPreciosListaSPPermitidos(DdlSubProyectoDatos.SelectedValue.ToEntero(), e.Row.DBCampo("CvePS").ToEntero(), UsuarioActual.CveEmpresa) Then
Dim Dt As DataTable = Nothing
If UsuarioActual.TienePermisoProceso(384) Then
Dt = ObjVta.DtResultados.Copy()
Else
Dt = ObjVta.DtResultados.FiltraParametros("Restringuida = 'False'")
End If
e.Row.FCDropDownList("DdlPrecioListaEdit").DataSource = Dt
End If
End Using
End If
End If
e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind()
e.Row.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(e.Row.DBCampo("CvePrecioLista")) e.Row.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(e.Row.DBCampo("CvePrecioLista"))
End If End If
@@ -8993,10 +9010,17 @@ Partial Class Ventas
End If End If
If UsuarioActual.CveEmpresa = 189 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then If UsuarioActual.CveEmpresa = 189 Then
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.NewEditIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("")
If CBool(DrPS("PrecioLibre")) Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = True
Else
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False
End If End If
End If
End Sub End Sub
Protected Sub GvPS_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvPS.RowCancelingEdit Protected Sub GvPS_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvPS.RowCancelingEdit
GvPS.EditIndex = -1 GvPS.EditIndex = -1
@@ -9049,6 +9073,7 @@ Partial Class Ventas
Dim DatarowPS As DataRow = Nothing Dim DatarowPS As DataRow = Nothing
DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") ' Estado = -1 DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") ' Estado = -1
Dim PrecioLibre As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
If DdlTipoComprobante.SelectedValue = "Cot" Then If DdlTipoComprobante.SelectedValue = "Cot" Then
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
@@ -9057,6 +9082,8 @@ Partial Class Ventas
End If End If
End If End If
PrecioLibre = CBool(DatarowPS("PrecioLibre"))
If DdlTipoComprobante.SelectedValue = "Ant" Then If DdlTipoComprobante.SelectedValue = "Ant" Then
Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString
If PSCodigoSAT <> "84111506" Then If PSCodigoSAT <> "84111506" Then
@@ -9225,6 +9252,8 @@ Partial Class Ventas
'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO 'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO
Dim MensajeCosto As New StringBuilder Dim MensajeCosto As New StringBuilder
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
If Not PrecioLibre Then
If Not EsValido Then If Not EsValido Then
MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio menor de su Costo <br/>", DatarowPS("PS").ToString()) MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio menor de su Costo <br/>", DatarowPS("PS").ToString())
If TienePermisoImportes Then If TienePermisoImportes Then
@@ -9253,6 +9282,8 @@ Partial Class Ventas
e.Cancel = True e.Cancel = True
Exit Sub Exit Sub
End If End If
End If
End If End If
End If End If
@@ -18358,18 +18389,24 @@ Partial Class Ventas
tPrecioSugerido = 0 tPrecioSugerido = 0
PrecioSugerido = 0 PrecioSugerido = 0
If Not CBool(drPS("PrecioLibre")) Then
Alert("No se encontro una lista de precios permitida en la sucursal actual", TipoMensaje.MsgAdvertencia) Alert("No se encontro una lista de precios permitida en la sucursal actual", TipoMensaje.MsgAdvertencia)
End If End If
End If
Else Else
ObjPrecioSugerido.CvePrecioLista = -1 ObjPrecioSugerido.CvePrecioLista = -1
ObjPrecioSugerido.PrecioSugerido = 0 ObjPrecioSugerido.PrecioSugerido = 0
tPrecioSugerido = 0 tPrecioSugerido = 0
PrecioSugerido = 0 PrecioSugerido = 0
If Not CBool(drPS("PrecioLibre")) Then
Alert("No se encontraron listas de precio disponibles", TipoMensaje.MsgAdvertencia) Alert("No se encontraron listas de precio disponibles", TipoMensaje.MsgAdvertencia)
End If End If
End If End If
End If
End If End If
End If End If
@@ -18387,11 +18424,10 @@ Partial Class Ventas
tPrecioSugerido = 0 tPrecioSugerido = 0
PrecioSugerido = 0 PrecioSugerido = 0
TxtPrecio.Enabled = True TxtPrecio.Enabled = CBool(drPS("PrecioLibre"))
Else Else
TxtPrecio.Enabled = False TxtPrecio.Enabled = CBool(drPS("PrecioLibre"))
End If End If
End If End If
If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
@@ -18467,11 +18503,13 @@ Partial Class Ventas
ObjInventarios.Dispose() ObjInventarios.Dispose()
If Costo > 0 Then If Costo > 0 Then
If TxtPrecio.Text.ToDecimal() > 0 Then
Dim PorUtilidad = String.Format("{0:N2} %", ((TxtPrecio.Text.ToDecimal() - Costo) / TxtPrecio.Text.ToDecimal()) * 100D) Dim PorUtilidad = String.Format("{0:N2} %", ((TxtPrecio.Text.ToDecimal() - Costo) / TxtPrecio.Text.ToDecimal()) * 100D)
LtlHeaderCosto.Text = String.Format("{0:N2} <br/> {1}", Costo, PorUtilidad) LtlHeaderCosto.Text = String.Format("{0:N2} <br/> {1}", Costo, PorUtilidad)
End If End If
End If End If
End If End If
End If
If AgregarPSAutomaticamente Then If AgregarPSAutomaticamente Then
AgregarPS() AgregarPS()
@@ -19411,6 +19449,8 @@ Partial Class Ventas
Return False Return False
End If End If
Dim PrecioLibre As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DatarowPS IsNot Nothing Then If DatarowPS IsNot Nothing Then
@@ -19429,6 +19469,8 @@ Partial Class Ventas
End If End If
End If End If
PrecioLibre = CBool(DatarowPS("PrecioLibre"))
End If End If
End If End If
@@ -19647,8 +19689,10 @@ Partial Class Ventas
End If End If
'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO 'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO
If Not PrecioLibre Then
Dim MensajeCosto As New StringBuilder Dim MensajeCosto As New StringBuilder
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
If Not EsValido Then If Not EsValido Then
MensajeCosto.AppendFormat("El Producto <b>{0}-{1}</b>. No se puede vender a un precio menor de su Costo <br/>", HdnCodigoPS.Value, HdnPS.Value) MensajeCosto.AppendFormat("El Producto <b>{0}-{1}</b>. No se puede vender a un precio menor de su Costo <br/>", HdnCodigoPS.Value, HdnPS.Value)
If TienePermisoImportes Then If TienePermisoImportes Then
@@ -19672,6 +19716,7 @@ Partial Class Ventas
Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia) Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia)
Return False Return False
End If End If
End If
End If End If
End If End If
@@ -19949,10 +19994,15 @@ Partial Class Ventas
End If End If
Else Else
Dim PermiteEdicion = UsuarioActual.CveEmpresa = 189 AndAlso TxtPrecio.Enabled
If Not PermiteEdicion Then
'sino es la seleccionada se recalcula de nuevo 'sino es la seleccionada se recalcula de nuevo
CargaPrecioLista(DdlPS.SelectedValue.ToEntero) CargaPrecioLista(DdlPS.SelectedValue.ToEntero)
Exit Sub Exit Sub
End If End If
End If
Else Else
If Me.CvePrecioLista > 0 Then If Me.CvePrecioLista > 0 Then
CvePrecioListaPS = Me.CvePrecioLista CvePrecioListaPS = Me.CvePrecioLista