E140. asignar polizas virtuales por consecutivo
This commit is contained in:
@@ -1559,8 +1559,8 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If DtPolizasVirtuales IsNot Nothing Then
|
If DtPolizasVirtuales IsNot Nothing Then
|
||||||
If DtPolizasVirtuales.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then
|
If DtPolizasVirtuales.Select($"Consec = {Row("Consec").ToString()} AND CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then
|
||||||
Dim RowPoliza As DataRow = DtPolizasVirtuales.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0)
|
Dim RowPoliza As DataRow = DtPolizasVirtuales.Select($"Consec = {Row("Consec").ToString()} AND CvePS={Row("CvePS").ToString.ToEntero}")(0)
|
||||||
RowPoliza("CveVentaDetalle") = ObjVentas.CveVentaDetalle
|
RowPoliza("CveVentaDetalle") = ObjVentas.CveVentaDetalle
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -1620,7 +1620,7 @@ Namespace Modelos
|
|||||||
|
|
||||||
'POLIZA VIRTUAL
|
'POLIZA VIRTUAL
|
||||||
If factura.DtPolizasVirtuales IsNot Nothing AndAlso factura.DtPolizasVirtuales.Rows.Count > 0 Then
|
If factura.DtPolizasVirtuales IsNot Nothing AndAlso factura.DtPolizasVirtuales.Rows.Count > 0 Then
|
||||||
If Not GuardarPolizasVirtuales(ObjVentas.IniciaTransacSQL(), ObjFactura:=factura) Then
|
If Not GuardarPolizasVirtuales(ObjAcum, ObjFactura:=factura) Then
|
||||||
ErrorList.Add("Ocurrió un error al actualizar el distribuidor.")
|
ErrorList.Add("Ocurrió un error al actualizar el distribuidor.")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -2220,13 +2220,11 @@ Namespace Modelos
|
|||||||
|
|
||||||
Return CveMovimiento
|
Return CveMovimiento
|
||||||
End Function
|
End Function
|
||||||
Private Function GuardarPolizasVirtuales(SqlTransaccion As SqlClient.SqlTransaction, ObjFactura As Modelos.Factura) As Boolean
|
Private Function GuardarPolizasVirtuales(ByRef ObjAcum As ClsAcumuladores, ObjFactura As Modelos.Factura) As Boolean
|
||||||
Dim Resultado As Boolean = True
|
Dim Resultado As Boolean = True
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(531).ToEntero > 0 AndAlso ObjFactura.TipoDocto.Contiene("Rem") Then
|
If UsuarioActual.Empresa.Funcionalidad(531).ToEntero > 0 AndAlso ObjFactura.TipoDocto.Contiene("Rem") Then
|
||||||
|
|
||||||
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
|
|
||||||
|
|
||||||
For Each drow As DataRow In ObjFactura.DtPolizasVirtuales.Rows
|
For Each drow As DataRow In ObjFactura.DtPolizasVirtuales.Rows
|
||||||
If ObjAcum.AddPolizaVirtual(ObjFactura.CveVenta, drow("CveVentaDetalle").ToString().ToEntero(), drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("Descuento").ToString.ToDecimal,
|
If ObjAcum.AddPolizaVirtual(ObjFactura.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),
|
||||||
|
|||||||
@@ -2872,7 +2872,7 @@
|
|||||||
<label>Año:</label>
|
<label>Año:</label>
|
||||||
<br />
|
<br />
|
||||||
<asp:TextBox ID="TxtAnioVehiculo" type="number" runat="server" Height="100%" Width="100%" CssClass="form-control" ></asp:TextBox>
|
<asp:TextBox ID="TxtAnioVehiculo" type="number" runat="server" Height="100%" Width="100%" CssClass="form-control" ></asp:TextBox>
|
||||||
<asp:CustomValidator ID="CVAnio" runat="server" ClientValidationFunction="ValidaAnioVehiculo" ValidateEmptyText="true" ControlToValidate="TxtAnioVehiculo" Display="Dynamic" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Año''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:CustomValidator>
|
<asp:CustomValidator ID="CVAnio" runat="server" ClientValidationFunction="ValidaAnioVehiculo" ValidateEmptyText="true" ControlToValidate="TxtAnioVehiculo" Display="Dynamic" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Año''</b> esta vacío o no tiene el formato correcto, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:CustomValidator>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -3281,7 +3281,19 @@
|
|||||||
//VALIDA SOLO SI SE SELECCIONO UN USADO
|
//VALIDA SOLO SI SE SELECCIONO UN USADO
|
||||||
var cveUsado = ToDouble($get("C_DdlRecepcionUsados").value);
|
var cveUsado = ToDouble($get("C_DdlRecepcionUsados").value);
|
||||||
if (cveUsado > 0) {
|
if (cveUsado > 0) {
|
||||||
args.IsValid = (ToDouble(args.Value) > 0);
|
var anio = ToDouble(args.Value);
|
||||||
|
if (anio > 0) {
|
||||||
|
var valido = true;
|
||||||
|
if (anio < 1900) {
|
||||||
|
valido = false;
|
||||||
|
}
|
||||||
|
if (anio.toString().length != 4) {
|
||||||
|
valido = false;
|
||||||
|
}
|
||||||
|
args.IsValid = valido;
|
||||||
|
} else {
|
||||||
|
args.IsValid = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
args.IsValid = true;
|
args.IsValid = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3430,27 +3430,27 @@ Partial Class PV
|
|||||||
|
|
||||||
If Retorno IsNot Nothing AndAlso Retorno.CveVenta > 0 Then
|
If Retorno IsNot Nothing AndAlso Retorno.CveVenta > 0 Then
|
||||||
|
|
||||||
If ObjFactura.TipoDocto = "Rem" Then
|
'If ObjFactura.TipoDocto = "Rem" Then
|
||||||
If ObjAcum.GetPolizasVirtuales(Retorno.CveVenta) Then
|
' If ObjAcum.GetPolizasVirtuales(Retorno.CveVenta) Then
|
||||||
Dim DtPoliza As DataTable = ObjAcum.DtResultados.Copy()
|
' Dim DtPoliza As DataTable = ObjAcum.DtResultados.Copy()
|
||||||
|
|
||||||
For Each Row As DataRow In ObjFactura.DtPolizasVirtuales.Rows
|
' For Each Row As DataRow In ObjFactura.DtPolizasVirtuales.Rows
|
||||||
Dim CvePolizaVirtual As Integer = DtPoliza.FiltroPrimeroValor("CvePolizaVirtual", $"CveVentaDetalle={Row("CveVentaDetalle")}").ToEntero()
|
' Dim CvePolizaVirtual As Integer = DtPoliza.FiltroPrimeroValor("CvePolizaVirtual", $"CveVentaDetalle={Row("CveVentaDetalle")}").ToEntero()
|
||||||
|
|
||||||
If Not ObjAcum.UpdatePolizaVirtual(CvePolizaVirtual, Row("CveMarcaUsado").ToString().ToEntero(), Row("FechaUsado").ToString().ToDateTime()) Then
|
' If Not ObjAcum.UpdatePolizaVirtual(CvePolizaVirtual, Row("CveMarcaUsado").ToString().ToEntero(), Row("FechaUsado").ToString().ToDateTime()) Then
|
||||||
SbAlert.Append("Error al guardar la póliza virtual")
|
' SbAlert.Append("Error al guardar la póliza virtual")
|
||||||
TieneError = True
|
' TieneError = True
|
||||||
Exit For
|
' Exit For
|
||||||
End If
|
' End If
|
||||||
Next
|
' Next
|
||||||
|
|
||||||
DtPoliza.Dispose()
|
' DtPoliza.Dispose()
|
||||||
Else
|
' Else
|
||||||
SbAlert.Append("Error al obtener la póliza virtual")
|
' SbAlert.Append("Error al obtener la póliza virtual")
|
||||||
TieneError = True
|
' TieneError = True
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
If ObjAcum.GetGarantiasDetalle(Retorno.CveVenta) Then
|
If ObjAcum.GetGarantiasDetalle(Retorno.CveVenta) Then
|
||||||
Dim RowGarantia As DataRow = ObjAcum.DtResultados.FiltroPrimero("")
|
Dim RowGarantia As DataRow = ObjAcum.DtResultados.FiltroPrimero("")
|
||||||
@@ -4790,6 +4790,9 @@ Partial Class PV
|
|||||||
DdlRecepcionUsados.SelectedValueExist("-1")
|
DdlRecepcionUsados.SelectedValueExist("-1")
|
||||||
DivRecepcionUsados.Visible = False
|
DivRecepcionUsados.Visible = False
|
||||||
|
|
||||||
|
DdlMarca.SelectedValueExist("-1")
|
||||||
|
TxtFechaVigencia.Text = Now.ToString("dd/MM/yyyy")
|
||||||
|
|
||||||
LimpiaAjuste()
|
LimpiaAjuste()
|
||||||
|
|
||||||
UPPDescuento.Update()
|
UPPDescuento.Update()
|
||||||
@@ -5295,7 +5298,7 @@ Partial Class PV
|
|||||||
divagregrarotrops.Visible = False
|
divagregrarotrops.Visible = False
|
||||||
|
|
||||||
Ajuste()
|
Ajuste()
|
||||||
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
|
'AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
|
||||||
|
|
||||||
'BUSCA EN TMPDT LOS DATOS DE USADOS
|
'BUSCA EN TMPDT LOS DATOS DE USADOS
|
||||||
If TmpDT.Rows.Count > 0 AndAlso TmpDTRecepcionUsados IsNot Nothing AndAlso TmpDTRecepcionUsados.Rows.Count > 0 Then
|
If TmpDT.Rows.Count > 0 AndAlso TmpDTRecepcionUsados IsNot Nothing AndAlso TmpDTRecepcionUsados.Rows.Count > 0 Then
|
||||||
@@ -5334,11 +5337,29 @@ Partial Class PV
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If String.IsNullOrEmpty(TxtAnioVehiculo.Text.Trim()) Then
|
||||||
|
Alert("El campo año esta vacío.", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then
|
||||||
|
Alert("El campo año debe ser mayor a 1900.", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
If Not String.IsNullOrEmpty(TxtAnioVehiculo.Text.Trim()) Then
|
||||||
|
If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then
|
||||||
|
Alert("El año del vehiculo del vehículo no tiene el formato correcto.", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If AgregarPS() Then
|
If AgregarPS() Then
|
||||||
If ChkAjuste.Checked Then GuardaAjuste()
|
If ChkAjuste.Checked Then GuardaAjuste()
|
||||||
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
|
|
||||||
CalculaTotalesVenta()
|
CalculaTotalesVenta()
|
||||||
|
|
||||||
If ChkAgregar.Checked = True And Modalidad = "A" Then
|
If ChkAgregar.Checked = True And Modalidad = "A" Then
|
||||||
@@ -5404,17 +5425,19 @@ Partial Class PV
|
|||||||
CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text,
|
CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text,
|
||||||
Serie:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CveVentaDetalle:=CveVentaDetalle, EsCargo:=EsCargo)
|
Serie:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CveVentaDetalle:=CveVentaDetalle, EsCargo:=EsCargo)
|
||||||
|
|
||||||
|
Dim ListaPSCargo As List(Of MConceptoUsado) = Nothing
|
||||||
If CveVentaDetalle <= 0 AndAlso Not EsCargo Then
|
If CveVentaDetalle <= 0 AndAlso Not EsCargo Then
|
||||||
Dim ListaPSCargo = CalculaUsados(Consec)
|
ListaPSCargo = CalculaUsados(Consec)
|
||||||
If ListaPSCargo.Count > 0 Then
|
|
||||||
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec)
|
|
||||||
End If
|
|
||||||
ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then
|
ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then
|
||||||
EliminarUsados()
|
EliminarUsados()
|
||||||
Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False)
|
ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False)
|
||||||
If ListaPSCargo.Count > 0 Then
|
End If
|
||||||
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec)
|
|
||||||
End If
|
If ListaPSCargo IsNot Nothing AndAlso ListaPSCargo.Count > 0 Then
|
||||||
|
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec)
|
||||||
|
For Each Usado As MConceptoUsado In ListaPSCargo
|
||||||
|
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero(), Usado.Consecutivo)
|
||||||
|
Next
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return True
|
Return True
|
||||||
@@ -7386,6 +7409,7 @@ Partial Class PV
|
|||||||
#Region "P O L I Z A - V I R T U A L"
|
#Region "P O L I Z A - V I R T U A L"
|
||||||
Private Sub CreaDTmpDTPolizaVirtual()
|
Private Sub CreaDTmpDTPolizaVirtual()
|
||||||
TmpDTPolizaVirtual = New DataTable
|
TmpDTPolizaVirtual = New DataTable
|
||||||
|
TmpDTPolizaVirtual.Columns.Add("Consec", GetType(Integer))
|
||||||
TmpDTPolizaVirtual.Columns.Add("CvePS", GetType(Integer))
|
TmpDTPolizaVirtual.Columns.Add("CvePS", GetType(Integer))
|
||||||
TmpDTPolizaVirtual.Columns.Add("Cantidad", GetType(Decimal))
|
TmpDTPolizaVirtual.Columns.Add("Cantidad", GetType(Decimal))
|
||||||
TmpDTPolizaVirtual.Columns.Add("PU", GetType(Decimal))
|
TmpDTPolizaVirtual.Columns.Add("PU", GetType(Decimal))
|
||||||
@@ -7402,14 +7426,14 @@ Partial Class PV
|
|||||||
TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer))
|
TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer))
|
||||||
TmpDTPolizaVirtual.Columns.Add("CveMarcaUsado", GetType(Integer))
|
TmpDTPolizaVirtual.Columns.Add("CveMarcaUsado", GetType(Integer))
|
||||||
End Sub
|
End Sub
|
||||||
Private Function AddPolizaVirtual(CvePS As Integer) As Boolean
|
Private Function AddPolizaVirtual(CvePS As Integer, Consec As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = True
|
Dim Retorno As Boolean = True
|
||||||
|
|
||||||
If Modalidad = "U" Then
|
If Modalidad = "U" Then
|
||||||
If TmpDTPolizaVirtual.Rows.Count > 0 Then
|
If TmpDTPolizaVirtual.Rows.Count > 0 Then
|
||||||
Dim Elimino As Boolean = False
|
Dim Elimino As Boolean = False
|
||||||
For Each RowPoliza As DataRow In TmpDTPolizaVirtual.Rows
|
For Each RowPoliza As DataRow In TmpDTPolizaVirtual.Rows
|
||||||
If RowPoliza("CvePS").ToString().ToEntero() = CvePS Then
|
If RowPoliza("Consec").ToString().ToEntero() = Consec AndAlso RowPoliza("CvePS").ToString().ToEntero() = CvePS Then
|
||||||
RowPoliza.Delete()
|
RowPoliza.Delete()
|
||||||
Elimino = True
|
Elimino = True
|
||||||
Exit For
|
Exit For
|
||||||
@@ -7475,6 +7499,8 @@ Partial Class PV
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Dim Row As DataRow = TmpDTPolizaVirtual.NewRow()
|
Dim Row As DataRow = TmpDTPolizaVirtual.NewRow()
|
||||||
|
|
||||||
|
Row("Consec") = Consec
|
||||||
Row("CvePS") = CvePS
|
Row("CvePS") = CvePS
|
||||||
Row("Cantidad") = Cantidad
|
Row("Cantidad") = Cantidad
|
||||||
Row("PU") = PU
|
Row("PU") = PU
|
||||||
@@ -7524,7 +7550,7 @@ Partial Class PV
|
|||||||
|
|
||||||
EmitirImprimirNew()
|
EmitirImprimirNew()
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer), CantidadUsado As Decimal, ConsecPSPadre As Integer)
|
Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of MConceptoUsado), CantidadUsado As Decimal, ConsecPSPadre As Integer)
|
||||||
|
|
||||||
If Modalidad = "U" Then
|
If Modalidad = "U" Then
|
||||||
If TmpDTRecepcionUsados.Rows.Count > 0 Then
|
If TmpDTRecepcionUsados.Rows.Count > 0 Then
|
||||||
@@ -7600,8 +7626,8 @@ Partial Class PV
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Dim StrCargos As New StringBuilder
|
Dim StrCargos As New StringBuilder
|
||||||
For Each CvePSCargo As Integer In ListaPSCargo
|
For Each Usado As MConceptoUsado In ListaPSCargo
|
||||||
StrCargos.AppendFormat(" {0},", CvePSCargo)
|
StrCargos.AppendFormat(" {0},", Usado.CvePS)
|
||||||
Next
|
Next
|
||||||
StrCargos.Remove(StrCargos.Length - 1, 1)
|
StrCargos.Remove(StrCargos.Length - 1, 1)
|
||||||
|
|
||||||
@@ -7718,12 +7744,16 @@ Partial Class PV
|
|||||||
|
|
||||||
CalculaTotalesVenta()
|
CalculaTotalesVenta()
|
||||||
End Sub
|
End Sub
|
||||||
Private Function CalculaUsados(Consec As Integer, Optional LimpiarUsados As Boolean = True) As List(Of Integer)
|
Public Class MConceptoUsado
|
||||||
|
Public Property Consecutivo As Integer
|
||||||
|
Public Property CvePS As Integer
|
||||||
|
End Class
|
||||||
|
Private Function CalculaUsados(Consec As Integer, Optional LimpiarUsados As Boolean = True) As List(Of MConceptoUsado)
|
||||||
If Modalidad = "U" AndAlso LimpiarUsados Then
|
If Modalidad = "U" AndAlso LimpiarUsados Then
|
||||||
EliminarUsados(Consec)
|
EliminarUsados(Consec)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim ListaPScargo As New List(Of Integer)
|
Dim ListaPScargo As New List(Of MConceptoUsado)
|
||||||
|
|
||||||
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
||||||
Dim DTCvePSCostos = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
|
Dim DTCvePSCostos = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
|
||||||
@@ -7828,7 +7858,7 @@ Partial Class PV
|
|||||||
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, EliminarDB:=CBool(drowPsTamaños("EliminarDB").ToString()))
|
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(New MConceptoUsado() With {.Consecutivo = Consec, .CvePS = drowPsTamaños("CvePS").ToString.ToEntero})
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|||||||
Reference in New Issue
Block a user