Correciones al editar remisiones en punto de venta
This commit is contained in:
@@ -1789,7 +1789,7 @@ Partial Class PV
|
|||||||
'Cargo de nueva cuenta el detalle de Ventas (Conceptos)
|
'Cargo de nueva cuenta el detalle de Ventas (Conceptos)
|
||||||
If Not OcurrioError Then
|
If Not OcurrioError Then
|
||||||
Dim index As Integer = 0
|
Dim index As Integer = 0
|
||||||
For Each Row As DataRow In TmpDT.Rows
|
For Each Row As DataRow In TmpDT.FiltraParametros("EliminarDB = False").Rows
|
||||||
Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString.ToEntero()
|
Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString.ToEntero()
|
||||||
If CveVentaDetalle > 0 Then
|
If CveVentaDetalle > 0 Then
|
||||||
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then
|
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then
|
||||||
@@ -1847,19 +1847,45 @@ Partial Class PV
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'RECARGA LOS DATOS
|
'RECARGA LOS DATOS
|
||||||
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
ObjFactura.Dispose()
|
||||||
TmpDT = ObjVentas.DtResultados.Copy()
|
ObjFactura = Nothing
|
||||||
ObjFactura.DtDetalle = TmpDT
|
ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa)
|
||||||
Else
|
|
||||||
|
If ObjFactura Is Nothing Then
|
||||||
OcurrioError = True
|
OcurrioError = True
|
||||||
|
Else
|
||||||
|
TmpDT = ObjFactura.DtDetalle
|
||||||
|
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
|
||||||
|
|
||||||
|
Dim NumRowsPS As Integer = 0
|
||||||
|
Dim CantidadPS As Decimal = 0
|
||||||
|
For Each GvRow As GridViewRow In GvPS.Rows
|
||||||
|
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||||
|
NumRowsPS += 1
|
||||||
|
CantidadPS += GvRow.DataKey("Cantidad").ToDecimal()
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
'VALIDA NUMERO DE REGISTROS
|
||||||
|
If TmpDT.Rows.Count <> NumRowsPS Then
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
'VALIDA CANTIDAD DE REGISTROS
|
||||||
|
If TmpDT.SUM("Cantidad") <> CantidadPS Then
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
'GUARDA USADOS
|
'GUARDA USADOS
|
||||||
If Not ObjVentas.EliminarUsados(CveVenta) Then
|
If Not OcurrioError AndAlso Not ObjVentas.EliminarUsados(CveVenta) Then
|
||||||
OcurrioError = True
|
OcurrioError = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If TmpDTRecepcionUsados IsNot Nothing Then
|
If Not OcurrioError AndAlso TmpDTRecepcionUsados IsNot Nothing Then
|
||||||
For Each drow As DataRow In TmpDTRecepcionUsados.Rows
|
For Each drow As DataRow In TmpDTRecepcionUsados.Rows
|
||||||
If Not ObjVentas.AddVentaUsado(CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("CveBCIUsado").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero) Then
|
If Not ObjVentas.AddVentaUsado(CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("CveBCIUsado").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero) Then
|
||||||
OcurrioError = True
|
OcurrioError = True
|
||||||
@@ -1869,11 +1895,11 @@ Partial Class PV
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'GUARDAR AJUSTES'
|
'GUARDAR AJUSTES'
|
||||||
If Not ObjAcum.EliminarGarantiasDetalle(CveVenta) Then
|
If Not OcurrioError AndAlso Not ObjAcum.EliminarGarantiasDetalle(CveVenta) Then
|
||||||
OcurrioError = True
|
OcurrioError = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0 Then
|
If Not OcurrioError AndAlso TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0 Then
|
||||||
For Each Dr As DataRow In TmpDTAjustes.Rows
|
For Each Dr As DataRow In TmpDTAjustes.Rows
|
||||||
If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero,
|
If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero,
|
||||||
Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero,
|
Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero,
|
||||||
@@ -1884,11 +1910,11 @@ Partial Class PV
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'GUARDAR POLIZA VIRTUAL
|
'GUARDAR POLIZA VIRTUAL
|
||||||
If Not ObjAcum.EliminarPolizaVirtual(CveVenta) Then
|
If Not OcurrioError AndAlso Not ObjAcum.EliminarPolizaVirtual(CveVenta) Then
|
||||||
OcurrioError = True
|
OcurrioError = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If TmpDTPolizaVirtual IsNot Nothing Then
|
If Not OcurrioError AndAlso TmpDTPolizaVirtual IsNot Nothing Then
|
||||||
For Each drow As DataRow In TmpDTPolizaVirtual.Rows
|
For Each drow As DataRow In TmpDTPolizaVirtual.Rows
|
||||||
If ObjAcum.AddPolizaVirtual(CveVenta, drow("CveVentaDetalle").ToString().ToEntero(), drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("Descuento").ToString.ToDecimal,
|
If ObjAcum.AddPolizaVirtual(CveVenta, drow("CveVentaDetalle").ToString().ToEntero(), drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("Descuento").ToString.ToDecimal,
|
||||||
drow("Total").ToString.ToDecimal, drow("TipoServicio").ToString.ToEntero, drow("TipoPoliza").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero, drow("AnioVehiculo").ToString.ToEntero, CBool(drow("TieneUsado").ToString),
|
drow("Total").ToString.ToDecimal, drow("TipoServicio").ToString.ToEntero, drow("TipoPoliza").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero, drow("AnioVehiculo").ToString.ToEntero, CBool(drow("TieneUsado").ToString),
|
||||||
@@ -2758,13 +2784,18 @@ Partial Class PV
|
|||||||
|
|
||||||
#Region "GVPS"
|
#Region "GVPS"
|
||||||
Protected Sub GvPS_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvPS.RowDeleting
|
Protected Sub GvPS_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvPS.RowDeleting
|
||||||
|
|
||||||
Dim DbRow As DataRow = Nothing
|
Dim DbRow As DataRow = Nothing
|
||||||
DbRow = TmpDT.Rows(e.RowIndex)
|
DbRow = TmpDT.Rows(e.RowIndex)
|
||||||
|
|
||||||
EliminarUsados(DbRow("Consec").ToString().ToEntero())
|
Me.CveVentaDetalle = DbRow("CveVentaDetalle").ToString().ToEntero()
|
||||||
|
|
||||||
TmpDT.Rows.Remove(DbRow)
|
If Me.CveVentaDetalle <= 0 Then
|
||||||
|
EliminarUsados(DbRow("Consec").ToString().ToEntero())
|
||||||
|
TmpDT.Rows.Remove(DbRow)
|
||||||
|
Else
|
||||||
|
EliminarUsados()
|
||||||
|
DbRow("EliminarDB") = True
|
||||||
|
End If
|
||||||
|
|
||||||
GvPS.DataSource = TmpDT.FiltraParametros("EliminarDB = False")
|
GvPS.DataSource = TmpDT.FiltraParametros("EliminarDB = False")
|
||||||
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
||||||
@@ -2774,6 +2805,9 @@ Partial Class PV
|
|||||||
|
|
||||||
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
||||||
|
|
||||||
|
Me.CveVentaDetalle = -1
|
||||||
|
|
||||||
|
|
||||||
UpContado.Update()
|
UpContado.Update()
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub GvPS_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvPS.RowDataBound
|
Protected Sub GvPS_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvPS.RowDataBound
|
||||||
|
|||||||
Reference in New Issue
Block a user