Edicion de remision en punto de venta
This commit is contained in:
@@ -797,6 +797,21 @@ Public Class ClsAcumuladores
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function EliminarGarantiasDetalle(CveVenta As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
SqlDataAdapter("PA_Acum_GarantiasDetallePolizaRemove")
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
End With
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As SqlException
|
||||||
|
OnError("Ocurrió un error a eliminar de garantia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
@@ -863,6 +878,21 @@ Public Class ClsAcumuladores
|
|||||||
End Try
|
End Try
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function EliminarPolizaVirtual(CveVenta As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
SqlDataAdapter("PA_Vta_PolizaVirtualRemove")
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
End With
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As SqlException
|
||||||
|
OnError("Ocurrió un al eliminar poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Integer, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer,
|
Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Integer, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer,
|
||||||
|
|||||||
@@ -4496,6 +4496,25 @@ Public Class ClsVentas
|
|||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function EliminarUsados(CveVenta As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Vta_VentasUsadosRemove", CommandType.StoredProcedure)
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al eliminar los usados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
Public Function GetVentasUsados(CveVenta As Integer, CveSubProyecto As Integer, Fecha As DateTime, CveEmpresa As Integer) As Boolean
|
Public Function GetVentasUsados(CveVenta As Integer, CveSubProyecto As Integer, Fecha As DateTime, CveEmpresa As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
|||||||
@@ -1276,6 +1276,7 @@ Partial Class PV
|
|||||||
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
|
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
|
||||||
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
|
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
|
||||||
TmpDT.Columns.Add("ConsecPSPadre", GetType(Integer))
|
TmpDT.Columns.Add("ConsecPSPadre", GetType(Integer))
|
||||||
|
|
||||||
GvPS.DataSource = TmpDT
|
GvPS.DataSource = TmpDT
|
||||||
GvPS.DataBind()
|
GvPS.DataBind()
|
||||||
|
|
||||||
@@ -1656,8 +1657,8 @@ Partial Class PV
|
|||||||
'SI EL DETALLE NO TIENE MOVIMIENTOS DE INVENTARIO ES VISIBLE
|
'SI EL DETALLE NO TIENE MOVIMIENTOS DE INVENTARIO ES VISIBLE
|
||||||
Dim CantidadFacturadaRemision = 0.0
|
Dim CantidadFacturadaRemision = 0.0
|
||||||
For Each Gvr As GridViewRow In GvPS.Rows
|
For Each Gvr As GridViewRow In GvPS.Rows
|
||||||
Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
|
Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "False"
|
||||||
Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
|
Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "False"
|
||||||
CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble
|
CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble
|
||||||
Next
|
Next
|
||||||
|
|
||||||
@@ -1694,6 +1695,8 @@ Partial Class PV
|
|||||||
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
|
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
|
||||||
Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
|
Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
|
||||||
Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL())
|
Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL())
|
||||||
|
Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
|
||||||
|
|
||||||
Dim ObjAC As ClsContPAQi = Nothing
|
Dim ObjAC As ClsContPAQi = Nothing
|
||||||
|
|
||||||
Dim Moneda As Integer = DdlMoneda.SelectedValue.ToEntero
|
Dim Moneda As Integer = DdlMoneda.SelectedValue.ToEntero
|
||||||
@@ -1701,8 +1704,8 @@ Partial Class PV
|
|||||||
Try
|
Try
|
||||||
'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS
|
'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS
|
||||||
If DdlMoneda.SelectedValue.ToEntero <> 2 AndAlso ChkConvertirDolares.Checked Then
|
If DdlMoneda.SelectedValue.ToEntero <> 2 AndAlso ChkConvertirDolares.Checked Then
|
||||||
|
Dim TmpDTTotales As DataTable = TmpDT.FiltraParametros("EliminarDB = False")
|
||||||
For Each Row As DataRow In TmpDT.Rows
|
For Each Row As DataRow In TmpDTTotales.Rows
|
||||||
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, 6)
|
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, 6)
|
||||||
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
||||||
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
||||||
@@ -1721,13 +1724,13 @@ Partial Class PV
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
|
TxtSubTotal.Text = TmpDTTotales.SUM("Total").ToDecimal.FormatoNumero
|
||||||
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
|
LblDescuentos.Text = TmpDTTotales.SUM("Descuento").ToDecimal.FormatoNumero
|
||||||
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
|
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
|
||||||
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
|
TxtIVA.Text = TmpDTTotales.SUM("ImporteIVA").ToDecimal.FormatoNumero
|
||||||
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
|
TxtRetIVA.Text = TmpDTTotales.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
|
||||||
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
|
TxtRetISR.Text = TmpDTTotales.SUM("ImporteRetISR").ToDecimal.FormatoNumero
|
||||||
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
|
TxtIEPS.Text = TmpDTTotales.SUM("ImporteIEPS").ToDecimal.FormatoNumero
|
||||||
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
|
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
|
||||||
|
|
||||||
TipoCambio = TxtTipoCambioDlls.Text.Trim.ToDecimal
|
TipoCambio = TxtTipoCambioDlls.Text.Trim.ToDecimal
|
||||||
@@ -1736,9 +1739,10 @@ Partial Class PV
|
|||||||
|
|
||||||
'CONVERTIR REMISION - TIPO MONEDA -PESO A DOLARES
|
'CONVERTIR REMISION - TIPO MONEDA -PESO A DOLARES
|
||||||
If DdlMoneda.SelectedValue.ToEntero <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then
|
If DdlMoneda.SelectedValue.ToEntero <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then
|
||||||
|
Dim TmpDTTotales As DataTable = TmpDT.FiltraParametros("EliminarDB = False")
|
||||||
Dim Importe As Decimal
|
Dim Importe As Decimal
|
||||||
Dim TCC As Decimal = TxtTipoCambio.Text.Trim.ToDecimal
|
Dim TCC As Decimal = TxtTipoCambio.Text.Trim.ToDecimal
|
||||||
For Each Row As DataRow In TmpDT.Rows
|
For Each Row As DataRow In TmpDTTotales.Rows
|
||||||
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * TCC, 6)
|
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * TCC, 6)
|
||||||
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
||||||
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
||||||
@@ -1758,13 +1762,13 @@ Partial Class PV
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
|
TxtSubTotal.Text = TmpDTTotales.SUM("Total").ToDecimal.FormatoNumero
|
||||||
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
|
LblDescuentos.Text = TmpDTTotales.SUM("Descuento").ToDecimal.FormatoNumero
|
||||||
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
|
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
|
||||||
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
|
TxtIVA.Text = TmpDTTotales.SUM("ImporteIVA").ToDecimal.FormatoNumero
|
||||||
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
|
TxtRetIVA.Text = TmpDTTotales.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
|
||||||
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
|
TxtRetISR.Text = TmpDTTotales.SUM("ImporteRetISR").ToDecimal.FormatoNumero
|
||||||
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
|
TxtIEPS.Text = TmpDTTotales.SUM("ImporteIEPS").ToDecimal.FormatoNumero
|
||||||
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
|
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
|
||||||
|
|
||||||
|
|
||||||
@@ -1802,32 +1806,99 @@ Partial Class PV
|
|||||||
Exit For
|
Exit For
|
||||||
Else
|
Else
|
||||||
TmpDT.Rows(index)("CveVentaDetalle") = ObjVentas.CveVentaDetalle
|
TmpDT.Rows(index)("CveVentaDetalle") = ObjVentas.CveVentaDetalle
|
||||||
|
|
||||||
|
If TmpDTRecepcionUsados IsNot Nothing Then
|
||||||
|
If TmpDTRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then
|
||||||
|
Dim rowInv As DataRow = TmpDTRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0)
|
||||||
|
rowInv("CveVentaDetalle") = ObjVentas.CveVentaDetalle
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0 Then
|
||||||
|
If TmpDTAjustes.Select($"ConsecutivoVenta={Row("Consec").ToString.ToEntero}").Length > 0 Then
|
||||||
|
Dim DrAju As DataRow = TmpDTAjustes.Select($"ConsecutivoVenta={Row("Consec").ToString.ToEntero}")(0)
|
||||||
|
DrAju("CveVentaDetalle") = ObjVentas.CveVentaDetalle
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If TmpDTPolizaVirtual IsNot Nothing Then
|
||||||
|
If TmpDTPolizaVirtual.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then
|
||||||
|
Dim RowPoliza As DataRow = TmpDTPolizaVirtual.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0)
|
||||||
|
RowPoliza("CveVentaDetalle") = ObjVentas.CveVentaDetalle
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
index = index + 1
|
index = index + 1
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjFactura.DtDetalle = TmpDT
|
|
||||||
|
|
||||||
'ELIMINA LOS DETALLES
|
'ELIMINA LOS DETALLES
|
||||||
If Not OcurrioError Then
|
If Not OcurrioError Then
|
||||||
Dim DtEliminados As New DataTable
|
Dim DtEliminados As DataTable = TmpDT.FiltraParametros("EliminarDB = True AND CveVentaDetalle > 0", "", {"CveVentaDetalle"})
|
||||||
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
|
||||||
DtEliminados = ObjVentas.DtResultados.FiltraParametros("", "", {"CveVentaDetalle"})
|
For Each Dr1 As DataRow In DtEliminados.Rows
|
||||||
For Each Dr1 As DataRow In DtEliminados.Rows
|
If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString.ToEntero) Then
|
||||||
If TmpDT.FiltraParametros($"CveVentaDetalle = {Dr1("CveVentaDetalle")}").Rows.Count = 0 Then
|
OcurrioError = True
|
||||||
If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString.ToEntero) Then
|
End If
|
||||||
OcurrioError = True
|
Next
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Else
|
|
||||||
OcurrioError = True
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'OcurrioError = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, 1, ObjBancos, ObjVentas)
|
'RECARGA LOS DATOS
|
||||||
|
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
||||||
|
TmpDT = ObjVentas.DtResultados.Copy()
|
||||||
|
ObjFactura.DtDetalle = TmpDT
|
||||||
|
Else
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
'GUARDA USADOS
|
||||||
|
If Not ObjVentas.EliminarUsados(CveVenta) Then
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
If TmpDTRecepcionUsados IsNot Nothing Then
|
||||||
|
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
|
||||||
|
OcurrioError = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
'GUARDAR AJUSTES'
|
||||||
|
If Not ObjAcum.EliminarGarantiasDetalle(CveVenta) Then
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
If TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0 Then
|
||||||
|
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,
|
||||||
|
Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero,
|
||||||
|
Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime()) Then
|
||||||
|
ErrorList.Add("Ocurrió un error al agregar la garantia detalle.")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
'GUARDAR POLIZA VIRTUAL
|
||||||
|
If Not ObjAcum.EliminarPolizaVirtual(CveVenta) Then
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
If TmpDTPolizaVirtual IsNot Nothing Then
|
||||||
|
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,
|
||||||
|
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("FechaUsado").ToString().ToDateTime, drow("CvePSUsado").ToString.ToEntero, drow("CveBCIUsado").ToString.ToEntero) Then
|
||||||
|
Else
|
||||||
|
OcurrioError = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
'Actualizo impuestos locales
|
'Actualizo impuestos locales
|
||||||
If Not OcurrioError Then
|
If Not OcurrioError Then
|
||||||
@@ -2695,7 +2766,7 @@ Partial Class PV
|
|||||||
|
|
||||||
TmpDT.Rows.Remove(DbRow)
|
TmpDT.Rows.Remove(DbRow)
|
||||||
|
|
||||||
GvPS.DataSource = TmpDT
|
GvPS.DataSource = TmpDT.FiltraParametros("EliminarDB = False")
|
||||||
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
||||||
GvPS.DataBind()
|
GvPS.DataBind()
|
||||||
CargaGVInv(DtInv)
|
CargaGVInv(DtInv)
|
||||||
@@ -2751,7 +2822,7 @@ Partial Class PV
|
|||||||
TmpDT = resultados.CopyToDataTable
|
TmpDT = resultados.CopyToDataTable
|
||||||
CalculaTotalesVenta()
|
CalculaTotalesVenta()
|
||||||
|
|
||||||
GvPS.DataSource = TmpDT
|
GvPS.DataSource = TmpDT.FiltraParametros("EliminarDB = False")
|
||||||
GvPS.DataBind()
|
GvPS.DataBind()
|
||||||
UpPS.Update()
|
UpPS.Update()
|
||||||
|
|
||||||
@@ -2857,7 +2928,7 @@ Partial Class PV
|
|||||||
GvInv.Columns(5).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> ""
|
GvInv.Columns(5).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> ""
|
||||||
GvInv.Columns(6).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> ""
|
GvInv.Columns(6).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> ""
|
||||||
|
|
||||||
GvInv.DataSource = DtTemporal
|
GvInv.DataSource = DtTemporal.FiltraParametros("EliminarDB = False")
|
||||||
GvInv.DataBind()
|
GvInv.DataBind()
|
||||||
|
|
||||||
UpINV.Update()
|
UpINV.Update()
|
||||||
@@ -3806,6 +3877,9 @@ Partial Class PV
|
|||||||
TmpDT.Columns.Add("PUOriginal", GetType(Decimal))
|
TmpDT.Columns.Add("PUOriginal", GetType(Decimal))
|
||||||
TmpDT.Columns.Add("ConsecPSPadre", GetType(Integer))
|
TmpDT.Columns.Add("ConsecPSPadre", GetType(Integer))
|
||||||
|
|
||||||
|
TmpDT.Columns.Add("EliminarDB", GetType(Boolean))
|
||||||
|
TmpDT.Columns("EliminarDB").DefaultValue = False
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CreaDTmpC()
|
Private Sub CreaDTmpC()
|
||||||
@@ -3878,7 +3952,7 @@ Partial Class PV
|
|||||||
Row("TiempoEntrega") = TiempoEntrega
|
Row("TiempoEntrega") = TiempoEntrega
|
||||||
|
|
||||||
TmpDT.Rows.Add(Row)
|
TmpDT.Rows.Add(Row)
|
||||||
GvPS.DataSource = TmpDT
|
GvPS.DataSource = TmpDT.FiltraParametros("EliminarDB = False")
|
||||||
GvPS.DataBind()
|
GvPS.DataBind()
|
||||||
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
||||||
|
|
||||||
@@ -3999,7 +4073,7 @@ Partial Class PV
|
|||||||
Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
|
Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
|
||||||
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0,
|
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0,
|
||||||
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False,
|
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False,
|
||||||
Optional ConsecPSPadre As Integer = -1) As Integer
|
Optional ConsecPSPadre As Integer = -1, Optional EliminarDB As Boolean = False) As Integer
|
||||||
|
|
||||||
Dim Retorno As Integer = -1
|
Dim Retorno As Integer = -1
|
||||||
If Not CvePS > 0 Then
|
If Not CvePS > 0 Then
|
||||||
@@ -4170,6 +4244,8 @@ Partial Class PV
|
|||||||
Row("ConsecPSPadre") = ConsecPSPadre
|
Row("ConsecPSPadre") = ConsecPSPadre
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Row("EliminarDB") = EliminarDB
|
||||||
|
|
||||||
If UsuarioActual.CveEmpresa = 119 Then
|
If UsuarioActual.CveEmpresa = 119 Then
|
||||||
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
|
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
|
||||||
|
|
||||||
@@ -4477,8 +4553,8 @@ Partial Class PV
|
|||||||
Else
|
Else
|
||||||
If Me.CveVentaDetalle > 0 Then
|
If Me.CveVentaDetalle > 0 Then
|
||||||
For Each Gvr As GridViewRow In GvPS.Rows
|
For Each Gvr As GridViewRow In GvPS.Rows
|
||||||
Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
|
Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "False"
|
||||||
Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
|
Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "False"
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
UpVenta.Update()
|
UpVenta.Update()
|
||||||
@@ -4530,7 +4606,12 @@ Partial Class PV
|
|||||||
If ListaPSCargo.Count > 0 Then
|
If ListaPSCargo.Count > 0 Then
|
||||||
CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo)
|
CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo)
|
||||||
End If
|
End If
|
||||||
|
ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then
|
||||||
|
EliminarUsados()
|
||||||
|
Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False)
|
||||||
|
If ListaPSCargo.Count > 0 Then
|
||||||
|
CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return True
|
Return True
|
||||||
@@ -4662,6 +4743,7 @@ Partial Class PV
|
|||||||
|
|
||||||
#Region "CALCULA TOTALES"
|
#Region "CALCULA TOTALES"
|
||||||
Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True)
|
Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True)
|
||||||
|
Dim TmpDT = Me.TmpDT.FiltraParametros("EliminarDB = False", Orderby:="Consec")
|
||||||
|
|
||||||
Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal
|
Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal
|
||||||
Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal
|
Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal
|
||||||
@@ -4715,9 +4797,7 @@ Partial Class PV
|
|||||||
'JJMQ 20160506: Se agrego para la validacion de pago de contado.
|
'JJMQ 20160506: Se agrego para la validacion de pago de contado.
|
||||||
'CVImporteContado.ValueToCompare = Total.ToString
|
'CVImporteContado.ValueToCompare = Total.ToString
|
||||||
|
|
||||||
Dim view As DataView = New DataView(TmpDT)
|
GvPS.DataSource = TmpDT
|
||||||
view.Sort = "Consec"
|
|
||||||
GvPS.DataSource = view
|
|
||||||
GvPS.DataBind()
|
GvPS.DataBind()
|
||||||
|
|
||||||
'RECARGA GV INVENTARIO
|
'RECARGA GV INVENTARIO
|
||||||
@@ -6325,7 +6405,7 @@ Partial Class PV
|
|||||||
|
|
||||||
Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2)
|
Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2)
|
||||||
Dim TipoServicio As Integer = DdlTipoServicio.SelectedValue.ToEntero()
|
Dim TipoServicio As Integer = DdlTipoServicio.SelectedValue.ToEntero()
|
||||||
Dim FechaUsado As DateTime = TxtFechaAjuste.Text.ToDateTime()
|
Dim FechaUsado As DateTime = If(TxtFechaAjuste.Text.ToDateTime() < MinFecha, Now, TxtFechaAjuste.Text.ToDateTime())
|
||||||
Dim CveModeloAuto As Integer = DdlModeloAuto.SelectedValue.ToEntero()
|
Dim CveModeloAuto As Integer = DdlModeloAuto.SelectedValue.ToEntero()
|
||||||
Dim AnioVehiculo As Integer = TxtAnioVehiculo.Text.ToEntero()
|
Dim AnioVehiculo As Integer = TxtAnioVehiculo.Text.ToEntero()
|
||||||
Dim TipoPoliza As Integer = 1 'VENTA
|
Dim TipoPoliza As Integer = 1 'VENTA
|
||||||
@@ -6376,6 +6456,7 @@ Partial Class PV
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "U S A D O S"
|
#Region "U S A D O S"
|
||||||
|
|
||||||
Private Sub CreaDTmpDTRecepcionUsados()
|
Private Sub CreaDTmpDTRecepcionUsados()
|
||||||
@@ -6388,6 +6469,8 @@ Partial Class PV
|
|||||||
TmpDTRecepcionUsados.Columns.Add("PU", GetType(Double))
|
TmpDTRecepcionUsados.Columns.Add("PU", GetType(Double))
|
||||||
TmpDTRecepcionUsados.Columns.Add("CveBCIUsado", GetType(Integer))
|
TmpDTRecepcionUsados.Columns.Add("CveBCIUsado", GetType(Integer))
|
||||||
TmpDTRecepcionUsados.Columns.Add("CveModeloAuto", GetType(Integer))
|
TmpDTRecepcionUsados.Columns.Add("CveModeloAuto", GetType(Integer))
|
||||||
|
TmpDTRecepcionUsados.Columns.Add("EliminarDB", GetType(Boolean))
|
||||||
|
TmpDTRecepcionUsados.Columns("EliminarDB").DefaultValue = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
@@ -6453,7 +6536,7 @@ Partial Class PV
|
|||||||
' Exit Sub
|
' Exit Sub
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND CvePS IN ({StrCargos})").Rows
|
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})").Rows
|
||||||
|
|
||||||
Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
|
Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
|
||||||
Dim PUActual As Decimal = (TotalAnterior - TotalCargos) / Dr("Cantidad").ToString.ToDecimal
|
Dim PUActual As Decimal = (TotalAnterior - TotalCargos) / Dr("Cantidad").ToString.ToDecimal
|
||||||
@@ -6485,7 +6568,7 @@ Partial Class PV
|
|||||||
Next
|
Next
|
||||||
TmpDT.AcceptChanges()
|
TmpDT.AcceptChanges()
|
||||||
If TotalCargos > 0 Then ' cuando se entrega más valor de usados, que los cargos hechos, se descuenta sobre el PU del producto de venta
|
If TotalCargos > 0 Then ' cuando se entrega más valor de usados, que los cargos hechos, se descuenta sobre el PU del producto de venta
|
||||||
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = False AND CvePS={CvePS}").Rows
|
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}").Rows
|
||||||
|
|
||||||
Dim PUAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
|
Dim PUAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
|
||||||
Dim PUActual As Decimal = PUAnterior - (TotalCargos / Dr("Cantidad").ToString.ToDecimal)
|
Dim PUActual As Decimal = PUAnterior - (TotalCargos / Dr("Cantidad").ToString.ToDecimal)
|
||||||
@@ -6522,8 +6605,8 @@ Partial Class PV
|
|||||||
|
|
||||||
CalculaTotalesVenta()
|
CalculaTotalesVenta()
|
||||||
End Sub
|
End Sub
|
||||||
Private Function CalculaUsados(Consec As Integer) As List(Of Integer)
|
Private Function CalculaUsados(Consec As Integer, Optional LimpiarUsados As Boolean = True) As List(Of Integer)
|
||||||
If Modalidad = "U" Then
|
If Modalidad = "U" AndAlso LimpiarUsados Then
|
||||||
EliminarUsados(Consec)
|
EliminarUsados(Consec)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -6556,6 +6639,8 @@ Partial Class PV
|
|||||||
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||||
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
|
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
|
||||||
DTPSTemp.Columns.Add("ConsecPSPadre", GetType(Integer))
|
DTPSTemp.Columns.Add("ConsecPSPadre", GetType(Integer))
|
||||||
|
DTPSTemp.Columns.Add("EliminarDB", GetType(Boolean))
|
||||||
|
DTPSTemp.Columns("EliminarDB").DefaultValue = False
|
||||||
|
|
||||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
Dim ObjProductosServicios As New ClsProductosServicios()
|
||||||
For Each DrowPartidas As DataRow In TmpDT.Select($"Consec = {Consec}")
|
For Each DrowPartidas As DataRow In TmpDT.Select($"Consec = {Consec}")
|
||||||
@@ -6628,7 +6713,7 @@ Partial Class PV
|
|||||||
Dim Concec = AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
|
Dim Concec = AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
|
||||||
drowPsTamaños("CveClasificacion").ToString.ToEntero, drowPsTamaños("Clasificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
|
drowPsTamaños("CveClasificacion").ToString.ToEntero, drowPsTamaños("Clasificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
|
||||||
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
|
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
|
||||||
drowPsTamaños("SubProyecto").ToString, EsCargo:=True, ConsecPSPadre:=drowPsTamaños("ConsecPSPadre").ToString.ToEntero)
|
drowPsTamaños("SubProyecto").ToString, EsCargo:=True, ConsecPSPadre:=drowPsTamaños("ConsecPSPadre").ToString.ToEntero, EliminarDB:=CBool(drowPsTamaños("EliminarDB").ToString()))
|
||||||
If Consec > 0 Then
|
If Consec > 0 Then
|
||||||
ListaPScargo.Add(drowPsTamaños("CvePS").ToString.ToEntero)
|
ListaPScargo.Add(drowPsTamaños("CvePS").ToString.ToEntero)
|
||||||
End If
|
End If
|
||||||
@@ -6655,6 +6740,25 @@ Partial Class PV
|
|||||||
Next
|
Next
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
TmpDT.AcceptChanges()
|
||||||
|
TmpDTRecepcionUsados.AcceptChanges()
|
||||||
|
End Sub
|
||||||
|
Private Sub EliminarUsados()
|
||||||
|
|
||||||
|
'ELIMINAR EL USADO EXTRAS
|
||||||
|
For Each drow As DataRow In TmpDT.Select("EsCargo = True")
|
||||||
|
drow("EliminarDB") = True
|
||||||
|
Next
|
||||||
|
|
||||||
|
'ELIMINAR LOS USADOS QUE SE MANDAN A RECEPCION
|
||||||
|
For Each drow As DataRow In TmpDT.Select("EsCargo = True")
|
||||||
|
For Each RowRecepcionUsados As DataRow In TmpDTRecepcionUsados.Rows
|
||||||
|
If (RowRecepcionUsados("CvePSRelacionado").ToString() = drow("CvePS").ToString()) Then
|
||||||
|
RowRecepcionUsados.Delete()
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
|
||||||
TmpDT.AcceptChanges()
|
TmpDT.AcceptChanges()
|
||||||
TmpDTRecepcionUsados.AcceptChanges()
|
TmpDTRecepcionUsados.AcceptChanges()
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
Reference in New Issue
Block a user