--FIX varios
This commit is contained in:
@@ -10,7 +10,6 @@ Imports System.Security.Cryptography.X509Certificates
|
||||
Imports ADSNetLibrary.SIGAPI.Models.CRM.Request
|
||||
Imports ADSNetLibrary.SIGAPI.Services.CRM
|
||||
Imports ADSTimbrado
|
||||
Imports com.itextpdf.text.pdf.languages
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports Modelos
|
||||
@@ -8287,7 +8286,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'SOLO HABILITAR PARA GENERAR NOTAS DE CREDITO
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Not PermiteCredito AndAlso Not LnkSolicitarCredito.Visible Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Not PermiteCredito AndAlso Not LnkSolicitarCredito.Visible Then
|
||||
LnkSolicitarCredito.Visible = True
|
||||
|
||||
If DdlSolCreditoTipoDocto.Items.FindByValue("Ing") IsNot Nothing Then
|
||||
@@ -9039,9 +9038,21 @@ Partial Class Ventas
|
||||
Protected Sub GvPS_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvPS.RowEditing
|
||||
GvPS.EditIndex = e.NewEditIndex
|
||||
GvPS.DataSource = TmpDT
|
||||
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
||||
|
||||
GvPS.DataBind()
|
||||
|
||||
If GvPS.Columns(21).Visible Then
|
||||
For Each GvRow As GridViewRow In GvPS.Rows
|
||||
If GvRow.RowType = DataControlRowType.Header Then
|
||||
GvRow.FCLinkButton("LnkOrdenarGvPS").Visible = False
|
||||
End If
|
||||
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
GvRow.FCTextBox("TxtOrden").Visible = False
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(253) Then
|
||||
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = True
|
||||
End If
|
||||
@@ -9128,9 +9139,27 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Protected Sub GvPS_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvPS.RowCancelingEdit
|
||||
GvPS.EditIndex = -1
|
||||
GvPS.DataSource = TmpDT
|
||||
|
||||
OrdenarPS()
|
||||
|
||||
If GvPS.Columns(21).Visible Then
|
||||
|
||||
For Each GvRow As GridViewRow In GvPS.Rows
|
||||
If GvRow.RowType = DataControlRowType.Header Then
|
||||
GvRow.FCLinkButton("LnkOrdenarGvPS").Visible = True
|
||||
End If
|
||||
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
GvRow.FCTextBox("TxtOrden").Visible = True
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
||||
GvPS.DataBind()
|
||||
CargaGVInv(DtInv)
|
||||
|
||||
UpPS.Update()
|
||||
End Sub
|
||||
Protected Sub GvPS_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvPS.RowUpdating
|
||||
|
||||
@@ -9203,6 +9232,7 @@ Partial Class Ventas
|
||||
'eliminar y cargar el ps ***
|
||||
|
||||
Dim ConsecutivoActual As Integer = TmpDT.Rows(e.RowIndex)("Consec").ToString().ToEntero()
|
||||
Dim OrdenOriginal As Integer = TmpDT.Rows(e.RowIndex)("Orden").ToString().ToEntero()
|
||||
|
||||
If DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then
|
||||
ObjDescuento = CalcularDescuentos(CvePSNuevo, Cantidad, PU)
|
||||
@@ -9261,14 +9291,14 @@ Partial Class Ventas
|
||||
CveProyecto, Proyecto,
|
||||
CveSubProyecto, SubProyecto,
|
||||
CuentaPredial:=CuentaPredial, CveVentaDetalle:=GvPS.Rows(e.RowIndex).DataKey("CveVentaDetalle").ToString().ToEntero(), SeActualiza:=True, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle,
|
||||
ObjDescuento:=ObjDescuento, NumTurnos:=NumTurnos, CvePrecioLista:=CvePrecioLista, PrecioLista:=PrecioLista, ConsecutivoManual:=ConsecutivoActual)
|
||||
ObjDescuento:=ObjDescuento, NumTurnos:=NumTurnos, CvePrecioLista:=CvePrecioLista, PrecioLista:=PrecioLista, ConsecutivoManual:=ConsecutivoActual, OrdenManual:=OrdenOriginal)
|
||||
|
||||
' TmpDT.Rows(e.RowIndex)("CveUM") = Ddl.SelectedValue
|
||||
' TmpDT.Rows(e.RowIndex)("UM") = Ddl.SelectedItem.Text
|
||||
GvPS.EditIndex = -1
|
||||
GvPS.DataSource = TmpDT
|
||||
OrdenarPS(False)
|
||||
|
||||
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
||||
GvPS.DataBind()
|
||||
CargaGVInv(DtInv)
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(533).ToEntero() > 0 Then
|
||||
@@ -9399,13 +9429,13 @@ Partial Class Ventas
|
||||
|
||||
CalculaPSPromocionFiltrosLubricantes(TmpDT.Rows(e.RowIndex))
|
||||
|
||||
|
||||
DrPS = Nothing
|
||||
|
||||
GvPS.EditIndex = -1
|
||||
GvPS.DataSource = TmpDT
|
||||
OrdenarPS(False)
|
||||
|
||||
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
||||
GvPS.DataBind()
|
||||
|
||||
CargaGVInv(DtInv)
|
||||
CalculaUsados()
|
||||
End If
|
||||
@@ -9425,6 +9455,18 @@ Partial Class Ventas
|
||||
'JJMQ 20160506: Se agrego para la validacion de pago de contado.
|
||||
'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "")
|
||||
|
||||
If GvPS.Columns(21).Visible Then
|
||||
For Each GvRow As GridViewRow In GvPS.Rows
|
||||
If GvRow.RowType = DataControlRowType.Header Then
|
||||
GvRow.FCLinkButton("LnkOrdenarGvPS").Visible = True
|
||||
End If
|
||||
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
GvRow.FCTextBox("TxtOrden").Visible = True
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
UpPS.Update()
|
||||
UpContado.Update()
|
||||
|
||||
@@ -20113,6 +20155,8 @@ Partial Class Ventas
|
||||
TxtCantidad.Text = "1"
|
||||
End If
|
||||
|
||||
OrdenarPS()
|
||||
|
||||
UpPS.Update()
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al agregar el producto", ex)
|
||||
@@ -20358,7 +20402,7 @@ Partial Class Ventas
|
||||
Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False,
|
||||
Optional ImporteProntoPago As Decimal = 0, Optional ByRef ObjDescuento As Modelos.VentaDescuentos = Nothing, Optional CvePrecioLista As Integer = -1, Optional PrecioLista As String = "",
|
||||
Optional CveActivoFijo As Integer = -1, Optional AFDepreciacion As Decimal = 0D, Optional AFValorInicial As Decimal = 0D, Optional NumTurnos As Decimal = 0D, Optional CantidadConversion As Decimal = 0,
|
||||
Optional Costo As Decimal = 0, Optional PorcentajeIVAFijo As Decimal = -1, Optional ConsecutivoManual As Integer = 0) As Boolean
|
||||
Optional Costo As Decimal = 0, Optional PorcentajeIVAFijo As Decimal = -1, Optional ConsecutivoManual As Integer = 0, Optional OrdenManual As Integer = 0) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
Try
|
||||
@@ -20402,17 +20446,17 @@ Partial Class Ventas
|
||||
Row("Serie") = Serie
|
||||
Row("TiempoEntrega") = TiempoEntrega
|
||||
|
||||
If ConsecutivoManual > 0 Then
|
||||
Row("Orden") = ConsecutivoManual
|
||||
If OrdenManual > 0 Then
|
||||
Row("Orden") = OrdenManual
|
||||
Else
|
||||
If Modalidad = "U" Then
|
||||
Row("Orden") = Index
|
||||
Else
|
||||
Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero()
|
||||
If ConsecutivoActual < 0 Then
|
||||
ConsecutivoActual = 0
|
||||
Dim OrdenActual As Integer = TmpDT.MAX("Orden").ToEntero()
|
||||
If OrdenActual < 0 Then
|
||||
OrdenActual = 0
|
||||
End If
|
||||
Row("Orden") = ConsecutivoActual + 1
|
||||
Row("Orden") = OrdenActual + 1
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -21328,7 +21372,7 @@ Partial Class Ventas
|
||||
ConfiguraTipoDocto()
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True, Optional NCDescuento As Boolean = False, Optional ValidarDescuentos As Boolean = False, Optional RecalcularTotalOriginal As Boolean = True)
|
||||
Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True, Optional NCDescuento As Boolean = False, Optional ValidarDescuentos As Boolean = False, Optional RecalcularTotalOriginal As Boolean = True, Optional Reordenar As Boolean = False)
|
||||
|
||||
Dim TotalSubTotal As Decimal = TmpDT.SUMD("TotalImporte")
|
||||
Dim TotalSubTotalRef As Decimal = TotalSubTotal
|
||||
@@ -21454,11 +21498,15 @@ Partial Class Ventas
|
||||
Alert($"Los siguientes conceptos hace falta especificar clave SAT <br/><br/> {MensajeCveSAT.ToString()}", TipoMensaje.MsgAdvertencia)
|
||||
MensajeCveSAT.Clear()
|
||||
End If
|
||||
|
||||
Dim view As DataView = New DataView(TmpDT)
|
||||
view.Sort = "Consec"
|
||||
GvPS.DataSource = view
|
||||
GvPS.DataBind()
|
||||
If Reordenar Then
|
||||
Dim view As DataView = New DataView(TmpDT)
|
||||
view.Sort = "Orden"
|
||||
GvPS.DataSource = view
|
||||
GvPS.DataBind()
|
||||
Else
|
||||
GvPS.DataSource = TmpDT
|
||||
GvPS.DataBind()
|
||||
End If
|
||||
|
||||
'RECARGA GV INVENTARIO
|
||||
If (Not CveVenta > 0 Or DdlTipoComprobante.SelectedValue = "Cot") OrElse (UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso EsCreaApartirDe) Then
|
||||
@@ -23888,6 +23936,12 @@ Partial Class Ventas
|
||||
LiCalcularPromociones.Visible = True
|
||||
End If
|
||||
|
||||
'NO PERMITE EDITAR FECHA DEL PAGO
|
||||
If Not UsuarioActual.TienePermisoProceso(260) Then
|
||||
TxtFechaPago.Enabled = False
|
||||
imgCalendario.Visible = False
|
||||
End If
|
||||
|
||||
TxtAtencionA.Enabled = True
|
||||
|
||||
UpCliente.Update()
|
||||
@@ -26322,22 +26376,34 @@ Partial Class Ventas
|
||||
DdlPS_SelectedIndexChanged(Nothing, Nothing)
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub OrdenarGvPS(ByVal sender As Object, ByVal e As EventArgs)
|
||||
|
||||
For Each row As GridViewRow In GvPS.Rows
|
||||
TmpDT.Rows(row.RowIndex)("Orden") = row.FCTextBox("TxtOrden").Text.ToEntero()
|
||||
Next
|
||||
Private Sub OrdenarPS(Optional Reeordenar As Boolean = True)
|
||||
|
||||
Dim resultados = From OrdenDT In TmpDT
|
||||
Order By OrdenDT("Orden").ToString().ToEntero()
|
||||
Select OrdenDT
|
||||
TmpDT = resultados.CopyToDataTable
|
||||
CalculaTotalesVenta()
|
||||
If Reeordenar Then
|
||||
For Each row As GridViewRow In GvPS.Rows
|
||||
TmpDT.Rows(row.RowIndex)("Orden") = row.FCTextBox("TxtOrden").Text.ToEntero()
|
||||
Next
|
||||
|
||||
TmpDT.AcceptChanges()
|
||||
End If
|
||||
|
||||
'Dim resultados = From OrdenDT In TmpDT
|
||||
' Order By OrdenDT("Orden").ToString().ToEntero()
|
||||
' Select OrdenDT
|
||||
'TmpDT = resultados.CopyToDataTable
|
||||
|
||||
TmpDT = TmpDT.FiltraParametros("", "Orden").Copy()
|
||||
|
||||
TmpDT.AcceptChanges()
|
||||
|
||||
GvPS.DataSource = TmpDT
|
||||
GvPS.DataBind()
|
||||
UpPS.Update()
|
||||
End Sub
|
||||
Protected Sub OrdenarGvPS(ByVal sender As Object, ByVal e As EventArgs)
|
||||
OrdenarPS()
|
||||
CalculaTotalesVenta()
|
||||
|
||||
UpPS.Update()
|
||||
End Sub
|
||||
Private Sub LkCotizacionAutorizar_Click(sender As Object, e As EventArgs) Handles LkCotizacionAutorizar.Click
|
||||
EsSupervisor = True
|
||||
@@ -33046,6 +33112,12 @@ Partial Class Ventas
|
||||
LiCalcularPromociones.Visible = True
|
||||
End If
|
||||
|
||||
'NO PERMITE EDITAR FECHA DEL PAGO
|
||||
If Not UsuarioActual.TienePermisoProceso(260) Then
|
||||
TxtFechaPago.Enabled = False
|
||||
imgCalendario.Visible = False
|
||||
End If
|
||||
|
||||
UpPS.Update()
|
||||
UPPDescuento.Update()
|
||||
UPObservaciones.Update()
|
||||
@@ -34885,6 +34957,8 @@ Partial Class Ventas
|
||||
CargaListasPrecios()
|
||||
End If
|
||||
|
||||
'BloqueaCondicionesPago()
|
||||
|
||||
BtnEditar.Visible = False
|
||||
BtnEmitir.Visible = False
|
||||
BtnPermisoEditarCotizacion.Visible = False
|
||||
@@ -36641,6 +36715,12 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
'NO PERMITE EDITAR FECHA DEL PAGO
|
||||
If Not UsuarioActual.TienePermisoProceso(260) Then
|
||||
TxtFechaPago.Enabled = False
|
||||
imgCalendario.Visible = False
|
||||
End If
|
||||
|
||||
UpCliente.Update()
|
||||
UpParametros.Update()
|
||||
UPObservaciones.Update()
|
||||
@@ -39890,7 +39970,7 @@ Partial Class Ventas
|
||||
RegistraScript("MuestraAnticipos();", "AE")
|
||||
End Sub
|
||||
|
||||
Private Sub RecalculaPrecios(ByRef RecalculoPromociones As Boolean, Optional ForzarRecalculo As Boolean = False)
|
||||
Private Sub RecalculaPrecios(ByRef RecalculoPromociones As Boolean, Optional AplicarPromociones As Boolean = False)
|
||||
Dim PuedeRecalcular As Boolean = False
|
||||
|
||||
If CveVenta <= 0 OrElse EsCreaApartirDe OrElse (ModalidadEdicion AndAlso Not DdlTipoComprobante.SelectedValue = "Cot") Then
|
||||
@@ -39902,7 +39982,7 @@ Partial Class Ventas
|
||||
PuedeRecalcular = False
|
||||
End If
|
||||
|
||||
If ForzarRecalculo Then
|
||||
If AplicarPromociones Then
|
||||
PuedeRecalcular = True
|
||||
End If
|
||||
|
||||
@@ -39912,7 +39992,18 @@ Partial Class Ventas
|
||||
Dim CveClasificacion As Integer = Row("CveClasificacion").ToString().ToEntero
|
||||
Dim CvePS As Integer = Row("CvePS").ToString().ToEntero
|
||||
|
||||
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion)
|
||||
Dim CvePrecioListaSugerido As Integer = -1
|
||||
|
||||
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = Nothing
|
||||
|
||||
If AplicarPromociones Then
|
||||
ObjPrecioSugerido = New Modelos.MPrecioSugerido()
|
||||
ObjPrecioSugerido.PrecioSugerido = Row("PU").ToString().ToDecimal()
|
||||
ObjPrecioSugerido.CvePrecioLista = Row("CvePrecioLista").ToString().ToEntero()
|
||||
Else
|
||||
ObjPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion)
|
||||
End If
|
||||
|
||||
If ObjPrecioSugerido.PrecioSugerido > 0 Then
|
||||
Dim PU As Decimal = ObjPrecioSugerido.PrecioSugerido.RoundSQL(6)
|
||||
|
||||
@@ -39921,6 +40012,11 @@ Partial Class Ventas
|
||||
PU = ObjDescuento.PU
|
||||
End If
|
||||
|
||||
'SI NO TIENE PROMOCION, NO MODIFICAR NADA
|
||||
If AplicarPromociones AndAlso ObjDescuento.CvePromocionDetalle <= 0 Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Row("PU") = PU
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento))
|
||||
@@ -40387,12 +40483,12 @@ Partial Class Ventas
|
||||
|
||||
Protected Sub LnkCalcularPromociones_Click(sender As Object, e As EventArgs)
|
||||
Dim Recalculo As Boolean = False
|
||||
RecalculaPrecios(Recalculo, ForzarRecalculo:=True)
|
||||
RecalculaPrecios(Recalculo, AplicarPromociones:=True)
|
||||
|
||||
If Recalculo Then
|
||||
Alert("Se han recalculado los precios y promociones en base a las condiciones actuales")
|
||||
Else
|
||||
Alert("No se han encontrado cambios para los precios y promociones")
|
||||
Alert("No se han encontrado cambios para las promociones")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user