Poliza Virtual en Ventas
This commit is contained in:
@@ -859,6 +859,14 @@ Partial Class PV
|
||||
ViewState("TmpDTRecepcionUsados") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TmpDTPolizaVirtual As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TmpDTPolizaVirtual")), Nothing, CType(ViewState("TmpDTPolizaVirtual"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("TmpDTPolizaVirtual") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TmpDTImpuestos As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TmpDTImpuestos")), Nothing, CType(ViewState("TmpDTImpuestos"), DataTable))
|
||||
@@ -2547,6 +2555,8 @@ Partial Class PV
|
||||
|
||||
ObjFactura.DtRecepcionUsados = TmpDTRecepcionUsados
|
||||
|
||||
ObjFactura.DtPolizasVirtuales = TmpDTPolizaVirtual
|
||||
|
||||
ObjFactura.GenerarPDFFactura = False
|
||||
|
||||
Dim CveTipoAlmacen As Integer = If(TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0, 6, 22)
|
||||
@@ -3734,13 +3744,14 @@ Partial Class PV
|
||||
ChkAgregar.Checked = False
|
||||
divagregrarotrops.Visible = False
|
||||
Ajuste()
|
||||
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
|
||||
UpVenta.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta")
|
||||
End Sub
|
||||
Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs)
|
||||
If AgregarPS() Then
|
||||
If ChkAjuste.Checked Then GuardaAjuste()
|
||||
|
||||
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
|
||||
CalculaTotalesVenta()
|
||||
|
||||
If ChkAgregar.Checked = True And Modalidad = "A" Then
|
||||
@@ -5053,6 +5064,7 @@ Partial Class PV
|
||||
|
||||
CreaDTmpDTAjustes()
|
||||
CreaDTmpDTRecepcionUsados()
|
||||
CreaDTmpDTPolizaVirtual()
|
||||
CargaBCIAjuste()
|
||||
DdlDistribuidor.setEsWebService(True)
|
||||
DivChkAjuste.Visible = True
|
||||
@@ -5478,6 +5490,101 @@ Partial Class PV
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "P O L I Z A - V I R T U A L"
|
||||
Private Sub CreaDTmpDTPolizaVirtual()
|
||||
TmpDTPolizaVirtual = New DataTable
|
||||
TmpDTPolizaVirtual.Columns.Add("CvePS", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("Cantidad", GetType(Decimal))
|
||||
TmpDTPolizaVirtual.Columns.Add("PU", GetType(Decimal))
|
||||
TmpDTPolizaVirtual.Columns.Add("Descuento", GetType(Decimal))
|
||||
TmpDTPolizaVirtual.Columns.Add("Total", GetType(Decimal))
|
||||
TmpDTPolizaVirtual.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("TipoServicio", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("TipoPoliza", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("CveModeloAuto", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("AnioVehiculo", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("TieneUsado", GetType(Boolean))
|
||||
TmpDTPolizaVirtual.Columns.Add("FechaUsado", GetType(DateTime))
|
||||
TmpDTPolizaVirtual.Columns.Add("CvePSUsado", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer))
|
||||
End Sub
|
||||
Private Function AddPolizaVirtual(CvePS As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
'Dim CvePS As Integer = DdlPS.SelectedValue.ToEntero()
|
||||
Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal()
|
||||
Dim PU As Decimal = TxtPrecio.Text.ToDecimal()
|
||||
Dim Descuento As Decimal = TxtDescuento.Text.ToDecimal()
|
||||
Dim ImporteAjuste As Decimal = TxtImporteAjuste.Text.ToDecimal().RoundSQL(2)
|
||||
|
||||
If Modalidad = "U" Then
|
||||
If TmpDTRecepcionUsados.Rows.Count > 0 Then
|
||||
Dim Elimino As Boolean = False
|
||||
For Each RowPoliza As DataRow In TmpDTPolizaVirtual.Rows
|
||||
If RowPoliza("CvePS").ToString().ToEntero() = CvePS Then
|
||||
RowPoliza.Delete()
|
||||
Elimino = True
|
||||
End If
|
||||
Next
|
||||
If Elimino Then
|
||||
TmpDTRecepcionUsados.AcceptChanges()
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2)
|
||||
Dim TipoServicio As Integer = DdlTipoServicio.SelectedValue.ToEntero()
|
||||
Dim FechaUsado As DateTime = TxtFechaAjuste.Text.ToDateTime()
|
||||
Dim CveModeloAuto As Integer = DdlModeloAuto.SelectedValue.ToEntero()
|
||||
Dim AnioVehiculo As Integer = TxtAnioVehiculo.Text.ToEntero()
|
||||
Dim TipoPoliza As Integer = 1
|
||||
|
||||
If ChkAjuste.Checked Then
|
||||
If Total = ImporteAjuste Then
|
||||
TipoPoliza = 3
|
||||
Else
|
||||
TipoPoliza = 2
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim TieneUsado As Boolean = GvRecepcionUsados.Rows.Cast(Of GridViewRow).Any(Function(GvRow) GvRow.RowType = DataControlRowType.DataRow AndAlso GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0)
|
||||
Dim CvePSUsado As Integer = -1
|
||||
Dim CveBCIUsado As Integer = -1
|
||||
|
||||
If TieneUsado Then
|
||||
For Each GvRow As GridViewRow In GvRecepcionUsados.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
If GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0 Then
|
||||
CvePS = GvRow.DataKey("CvePSCargo").ToEntero()
|
||||
CveBCIUsado = GvRow.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero()
|
||||
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Dim Row As DataRow = TmpDTPolizaVirtual.NewRow()
|
||||
Row("CvePS") = CvePS
|
||||
Row("Cantidad") = Cantidad
|
||||
Row("PU") = PU
|
||||
Row("Descuento") = Descuento
|
||||
Row("Total") = Total
|
||||
Row("CveVentaDetalle") = -1
|
||||
Row("TipoServicio") = TipoServicio
|
||||
Row("TipoPoliza") = TipoPoliza
|
||||
Row("CveModeloAuto") = CveModeloAuto
|
||||
Row("AnioVehiculo") = AnioVehiculo
|
||||
Row("TieneUsado") = TieneUsado
|
||||
Row("FechaUsado") = FechaUsado
|
||||
Row("CvePSUsado") = CvePSUsado
|
||||
Row("CveBCIUsado") = CveBCIUsado
|
||||
|
||||
TmpDTPolizaVirtual.Rows.Add(Row)
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
#End Region
|
||||
#Region "U S A D O S"
|
||||
|
||||
Private Sub CreaDTmpDTRecepcionUsados()
|
||||
@@ -5492,6 +5599,7 @@ Partial Class PV
|
||||
TmpDTRecepcionUsados.Columns.Add("CveModeloAuto", GetType(Integer))
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub BtnRecepcionUsados_Click(sender As Object, e As EventArgs)
|
||||
|
||||
'CalculaRecepcionUsados(GvRecepcionUsadosModal)
|
||||
|
||||
Reference in New Issue
Block a user