Correciones en edicion de cotizaciones en PV

This commit is contained in:
2022-01-20 15:43:12 -07:00
parent b4443fb0d8
commit 4db6b3eef7

View File

@@ -559,12 +559,12 @@ Partial Class PV
ViewState("Modalidad") = value
End Set
End Property
Private Property Index As Integer
Private Property GvPSRowIndexEdit As Integer
Get
Return ViewState("Index").ToString.ToEntero
Return ViewState("GvPSRowIndexEdit").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("Index") = value
ViewState("GvPSRowIndexEdit") = value
End Set
End Property
Private Property CveVentaDetalle As Integer
@@ -1086,7 +1086,7 @@ Partial Class PV
DtPUFacturas = New DataTable
Modalidad = ""
Index = -1
GvPSRowIndexEdit = -1
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
ChkAjuste.Visible = True
@@ -3770,7 +3770,7 @@ Partial Class PV
Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33
Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33
Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT
Timbre.Comprobante.Subtotal = Obj.SubTotal
Timbre.Comprobante.SubTotal = Obj.SubTotal
Timbre.Comprobante.Descuentos = Obj.Descuento
Timbre.Comprobante.Moneda = Obj.MonedaSAT
Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString)
@@ -4592,13 +4592,7 @@ Partial Class PV
ElseIf Modalidad = "U" Then
Dim Contador As Integer = 0
If CveVentaDetalle <= 0 Then
For Each Dr As DataRow In TmpDT.Rows
If Dr("Consec").ToString.ToEntero = Index Then
Exit For
End If
Contador = Contador + 1
Next
Row = TmpDT.Rows(Contador)
Row = TmpDT.Rows(GvPSRowIndexEdit)
Else
Row = TmpDT.Select($"CveVentaDetalle={CveVentaDetalle}")(0)
End If
@@ -4666,9 +4660,9 @@ Partial Class PV
Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion")
If Modalidad = "A" Then
Row("Consec") = TmpDT.Rows.Count + 1
Row("Consec") = TmpDT.MAX("Consec").ToEntero() + 1
If Not EsCargo Then
ConsecutivoVenta = TmpDT.Rows.Count + 1
ConsecutivoVenta = TmpDT.MAX("Consec").ToEntero() + 1
End If
ElseIf Modalidad = "U" Then
If Not EsCargo Then
@@ -5008,10 +5002,10 @@ Partial Class PV
Public Sub Edit_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Modalidad = "U"
Index = GvRow.DataKey("Consec").ToEntero
GvPSRowIndexEdit = GvRow.RowIndex
ConsecutivoVenta = GvRow.DataKey("Consec").ToEntero
CveVentaDetalle = GvRow.DataKey("CveVentaDetalle").ToEntero
Dim EsCargo = CBool(GvRow.DataKey("EsCargo"))
LnkAgregarPS.Text = "Actualizar"
DdlClasificacion.SelectedValueExist(GvRow.DataKey("CveClasificacion"))
CargaPS(DdlClasificacion.SelectedValue.ToEntero, DdlPS)
@@ -5056,7 +5050,27 @@ Partial Class PV
Ajuste()
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
'BUSCA EN TMPDT LOS DATOS DE USADOS
If TmpDT.Rows.Count > 0 AndAlso TmpDTRecepcionUsados IsNot Nothing AndAlso TmpDTRecepcionUsados.Rows.Count > 0 Then
If Not EsCargo Then
Dim RowUsado As DataRow = TmpDTRecepcionUsados.Select($"ConsecRelacionado={ConsecutivoVenta}").FirstOrDefault()
If RowUsado IsNot Nothing Then
DdlRecepcionUsados.SelectedValueExist(RowUsado("CvePS"))
DdlRecepcionUsados_SelectedIndexChanged(DdlRecepcionUsados, EventArgs.Empty)
DdlBCIUsado.SelectedValueExist(RowUsado("CveBCIUsado"))
DdlModeloAuto.SelectedValueExist(RowUsado("CveModeloAuto"))
TxtAnioVehiculo.Text = RowUsado("AnioVehiculo").ToString()
TxtFechaVigencia.Text = RowUsado("FechaUsado").ToString().ToDate().ToString("dd/MM/yyyy")
End If
End If
End If
UpVenta.Update()
UpAddVenta.Update()
RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});", "EdicionVenta")
End Sub
Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs)
@@ -5113,14 +5127,7 @@ Partial Class PV
CvePSAmortizacion = DdlPS.SelectedValue.ToEntero.ToEntero
End If
Dim Descuento As Decimal = HdnDescuento.Value.ToDecimal
If HdnTipoDescuento.Value = "0" Then
Descuento = HdnDescuento.Value.ToDecimal * TxtCantidad.Text.ToDecimal
End If
If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then
Descuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero))
End If
Dim Descuento As Decimal = TxtDescuento.Text.ToDecimal()
Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero
Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString
@@ -6706,7 +6713,7 @@ Partial Class PV
Dim Contador As Integer = 1
Dim PUFactura As Decimal = 0
For Each Dr As DataRow In DtPUFacturas.Rows
If Index = Contador Then
If GvPSRowIndexEdit = Contador Then
PUFactura = Dr("PU").ToString.ToDecimal
End If
Contador += 1
@@ -7137,7 +7144,7 @@ Partial Class PV
End If
Next
If Elimino Then
TmpDTRecepcionUsados.AcceptChanges()
TmpDTPolizaVirtual.AcceptChanges()
End If
End If
End If
@@ -7224,12 +7231,15 @@ Partial Class PV
TmpDTRecepcionUsados = New DataTable
TmpDTRecepcionUsados.Columns.Add("CvePS", GetType(Integer))
TmpDTRecepcionUsados.Columns.Add("CvePSRelacionado", GetType(Integer))
TmpDTRecepcionUsados.Columns.Add("ConsecRelacionado", GetType(Integer))
TmpDTRecepcionUsados.Columns.Add("Cantidad", GetType(Decimal))
TmpDTRecepcionUsados.Columns.Add("AnioVehiculo", GetType(String))
TmpDTRecepcionUsados.Columns.Add("CveUM", GetType(Integer))
TmpDTRecepcionUsados.Columns.Add("CveVentaDetalle", GetType(Integer))
TmpDTRecepcionUsados.Columns.Add("PU", GetType(Double))
TmpDTRecepcionUsados.Columns.Add("CveBCIUsado", GetType(Integer))
TmpDTRecepcionUsados.Columns.Add("CveModeloAuto", GetType(Integer))
TmpDTRecepcionUsados.Columns.Add("FechaUsado", GetType(DateTime))
TmpDTRecepcionUsados.Columns.Add("EliminarDB", GetType(Boolean))
TmpDTRecepcionUsados.Columns("EliminarDB").DefaultValue = False
End Sub
@@ -7303,6 +7313,10 @@ Partial Class PV
Row("PU") = DrTamanio("Cargo").ToString().ToDecimal
Row("CveBCIUsado") = DdlBCIUsado.SelectedValue.ToEntero
Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero
Row("ConsecRelacionado") = ConsecPSPadre
Row("FechaUsado") = TxtFechaVigencia.Text.ToDateTime()
Row("AnioVehiculo") = TxtAnioVehiculo.Text
TmpDTRecepcionUsados.Rows.Add(Row)
End If