E140. CveVentaDetalle en recepcion de usados desde el PV.aspx

This commit is contained in:
2022-07-01 09:16:27 -07:00
parent 523085d3bb
commit 7c2f3592d7
6 changed files with 55 additions and 35 deletions

View File

@@ -5121,7 +5121,7 @@ Public Class ClsVentas
#Region " U S A D O S " #Region " U S A D O S "
Public Function AddVentaUsado(CveVenta As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, Optional CveBCI As Integer = -1, Optional CveModeloAuto As Integer = -1) As Boolean Public Function AddVentaUsado(CveVenta As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, Optional CveBCI As Integer = -1, Optional CveModeloAuto As Integer = -1, Optional CveVentaDetalle As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasUsadosAdd", CommandType.StoredProcedure) DataAdapter("PA_Vta_VentasUsadosAdd", CommandType.StoredProcedure)
@@ -5133,6 +5133,7 @@ Public Class ClsVentas
.Add("@PU", SqlDbType.Money).Value = PU .Add("@PU", SqlDbType.Money).Value = PU
.Add("@CveBCI", SqlDbType.Int).Value = CveBCI .Add("@CveBCI", SqlDbType.Int).Value = CveBCI
.Add("@CveModeloAuto", SqlDbType.Int).Value = CveModeloAuto .Add("@CveModeloAuto", SqlDbType.Int).Value = CveModeloAuto
.Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle
End With End With
Try Try

View File

@@ -1578,10 +1578,14 @@ Namespace Modelos
End If End If
If DtRecepcionUsados IsNot Nothing Then If DtRecepcionUsados IsNot Nothing Then
If DtRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then Try
Dim rowInv As DataRow = DtRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0) If DtRecepcionUsados.Select($"ConsecUsado={Row("Consec").ToString.ToEntero}").Length > 0 Then
rowInv("CveVentaDetalle") = ObjVentas.CveVentaDetalle Dim rowUsados As DataRow = DtRecepcionUsados.Select($"ConsecUsado={Row("Consec").ToString.ToEntero}")(0)
End If rowUsados("CveVentaDetalle") = ObjVentas.CveVentaDetalle
End If
Catch ex As Exception
GuardaLog("Ocurrió un error al relacionar los usados. " & ex.ToString())
End Try
End If End If
If DtPolizasVirtuales IsNot Nothing Then If DtPolizasVirtuales IsNot Nothing Then
@@ -2138,7 +2142,7 @@ Namespace Modelos
If factura.TipoDocto.Contiene("Rem") Then If factura.TipoDocto.Contiene("Rem") Then
If factura.DtRecepcionUsados IsNot Nothing Then If factura.DtRecepcionUsados IsNot Nothing Then
For Each drow As DataRow In factura.DtRecepcionUsados.Rows For Each drow As DataRow In factura.DtRecepcionUsados.Rows
If Not ObjVentas.AddVentaUsado(factura.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(factura.CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("CveBCIUsado").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero, CveVentaDetalle:=drow("CveVentaDetalle").ToString.ToEntero) Then
Resultado = False Resultado = False
Exit For Exit For
End If End If

View File

@@ -130,7 +130,7 @@
<div id="DivCliente" runat="server" visible="true"> <div id="DivCliente" runat="server" visible="true">
<label class="col-md-1 truncate" style="width: 110px">Cliente:</label> <label class="col-md-1 truncate" style="width: 110px">Cliente:</label>
<div class="col-md-2"> <div class="col-md-2">
<asp:DropDownList ID="DdlClientes" AutoPostBack="False" OnSelectedIndexChanged="DdlClientes_SelectedIndexChanged" AppendDataBoundItems="true" runat="server" CssClass="form-control input-sm select2me" Style="max-width: 200px" DataTextField="NombreComercial" DataValueField="CveCliente"></asp:DropDownList> <ADS:Dropdownlost ID="DdlClientes" Width="100%" CssStyle="width: 100%;" UsaWebService="true" AppendDataBoundItems="true" AutoPostBack="true" CssClass="select2me" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente"></ADS:Dropdownlost>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<label class="col-md-1 truncate" style="width: 125px">Todos los clientes:</label> <label class="col-md-1 truncate" style="width: 125px">Todos los clientes:</label>

View File

@@ -15,14 +15,14 @@ Partial Class Inventarios_RecepcionUsados
Private _dtDatos As DataTable Private _dtDatos As DataTable
Public Property DtClientes() As DataTable 'Public Property DtClientes() As DataTable
Get ' Get
Return CType(ViewState("DtClientes"), DataTable) ' Return CType(ViewState("DtClientes"), DataTable)
End Get ' End Get
Set(value As DataTable) ' Set(value As DataTable)
ViewState("DtClientes") = value ' ViewState("DtClientes") = value
End Set ' End Set
End Property 'End Property
Public Property DtMovimientos() As DataTable Public Property DtMovimientos() As DataTable
Get Get
@@ -454,6 +454,7 @@ Partial Class Inventarios_RecepcionUsados
Dim Fecha As DateTime = IfNull(Request("Fecha"), Now.ToString("dd/MM/yyyy")).ToString().ToDateTime() Dim Fecha As DateTime = IfNull(Request("Fecha"), Now.ToString("dd/MM/yyyy")).ToString().ToDateTime()
If Not String.IsNullOrEmpty(RFC) Then If Not String.IsNullOrEmpty(RFC) Then
Dim DtClientes = GlobalDTCliente(UsuarioActual.CveEmpresa)
If DtClientes Is Nothing Then If DtClientes Is Nothing Then
Alert("No se encontraron clientes para filtrar", TipoMensaje.MsgError) Alert("No se encontraron clientes para filtrar", TipoMensaje.MsgError)
Exit Sub Exit Sub
@@ -476,8 +477,10 @@ Partial Class Inventarios_RecepcionUsados
End If End If
Dim CveCliente As Integer = RowCliente("CveCliente").ToString().ToEntero() Dim CveCliente As Integer = RowCliente("CveCliente").ToString().ToEntero()
Dim Cliente = RowCliente("NombreComercial").ToString()
DdlClientes.SelectedValueExist(CveCliente) DdlClientes.SelectedValue = CveCliente.ToString()
DdlClientes.SelectedText = Cliente
DdlClientes_SelectedIndexChanged(DdlClientes, EventArgs.Empty) DdlClientes_SelectedIndexChanged(DdlClientes, EventArgs.Empty)
DdlAlmacen.SelectedValueExist(CveAlmacen) DdlAlmacen.SelectedValueExist(CveAlmacen)
@@ -775,6 +778,10 @@ Partial Class Inventarios_RecepcionUsados
EsDistribuidor = False EsDistribuidor = False
InicializaClientes(True) InicializaClientes(True)
DdlClientes.Enabled = True DdlClientes.Enabled = True
If Not String.IsNullOrEmpty(DdlClientes.ddlWS.Attributes.Item("disabled")) Then
DdlClientes.ddlWS.Attributes.Remove("disabled")
End If
ChkClientesTodos.Enabled = True ChkClientesTodos.Enabled = True
SiguienteFolio() SiguienteFolio()
@@ -2008,14 +2015,11 @@ Partial Class Inventarios_RecepcionUsados
#Region "DDL CLIENTE / CLIENTE SUCURSAL - SELECTED INDEX CHANGED" #Region "DDL CLIENTE / CLIENTE SUCURSAL - SELECTED INDEX CHANGED"
Private Sub InicializaClientes(Todos As Boolean) Private Sub InicializaClientes(Todos As Boolean)
DtClientes = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltraParametros(If(Todos, "", "EsDistribuidor = 1")) DdlClientes.ddlWS.Attributes.Add("data-esdistribuidor", If(Todos, "-1", "1"))
DdlClientes.DataSource = DtClientes
DdlClientes.DataBind()
DdlClientes.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlClientes.SelectedValue = "-1" DdlClientes.SelectedValue = "-1"
DdlClientes.SelectedText = "Seleccione"
UpGenerales.Update()
End Sub End Sub
'Protected Sub ActivaClientes() 'Protected Sub ActivaClientes()
' If UsuarioActual.CveEmpresa.Contiene(72, 80) Then ' If UsuarioActual.CveEmpresa.Contiene(72, 80) Then
@@ -2027,7 +2031,7 @@ Partial Class Inventarios_RecepcionUsados
'End Sub 'End Sub
Protected Sub DdlClientes_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlClientes_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientes.selectedindexchange
CambiaCliente() CambiaCliente()
End Sub End Sub
Private Sub CambiaCliente(Optional CargaSucursales As Boolean = True, Optional CargaFacturas As Boolean = True) Private Sub CambiaCliente(Optional CargaSucursales As Boolean = True, Optional CargaFacturas As Boolean = True)
@@ -2314,11 +2318,16 @@ Partial Class Inventarios_RecepcionUsados
'RELACIONA LA VENTA DETALLA DE LA REMISION 'RELACIONA LA VENTA DETALLA DE LA REMISION
If DtUsados IsNot Nothing Then If DtUsados IsNot Nothing Then
DtUsados.Columns.Add(New DataColumn("CveVentaDetalle", GetType(Integer))) If Not DtUsados.Columns.Contains("CveVentaDetalle") Then
DtUsados.Columns.Add(New DataColumn("CveVentaDetalle", GetType(Integer)))
End If
For Each RowUsado As DataRow In DtUsados.Rows For Each RowUsado As DataRow In DtUsados.Rows
Dim CveVentaDetalle As Integer = Me.ObjFactura.DtDetalle.FiltroPrimeroValor("CveVentaDetalle", $"EsCargo = 1 AND Cantidad = {RowUsado("Cantidad")} AND CvePS = {RowUsado("CvePS")}").ToEntero() If RowUsado("CveVentaDetalle").ToString().ToEntero() <= 0 Then
If CveVentaDetalle > 0 Then Dim CveVentaDetalle As Integer = Me.ObjFactura.DtDetalle.FiltroPrimeroValor("CveVentaDetalle", $"EsCargo = 1 AND Cantidad = {RowUsado("Cantidad")} AND CvePS = {RowUsado("CvePS")}").ToEntero()
RowUsado("CveVentaDetalle") = CveVentaDetalle If CveVentaDetalle > 0 Then
RowUsado("CveVentaDetalle") = CveVentaDetalle
End If
End If End If
Next Next
End If End If
@@ -2330,13 +2339,15 @@ Partial Class Inventarios_RecepcionUsados
If CveCliente > 0 Then If CveCliente > 0 Then
DivCliente.Visible = True DivCliente.Visible = True
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveCliente = {0}", CveCliente)) Dim Cliente = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimeroValor("NombreComercial")
DdlClientes.DataBind()
DdlClientes.SelectedValue = CveCliente.ToString()
DdlClientes.SelectedText = Cliente
DdlClientes.SelectedValueExist(CveCliente)
CambiaCliente(False, False) CambiaCliente(False, False)
DdlClientes.Enabled = False DdlClientes.Enabled = False
DdlClientes.ddlWS.Attributes.Add("disabled", "disabled")
ChkClientesTodos.Enabled = False ChkClientesTodos.Enabled = False
End If End If
@@ -3414,7 +3425,6 @@ Partial Class Inventarios_RecepcionUsados
#End Region #End Region
Protected Sub SeleccionarTipoDeClientes(sender As Object, e As EventArgs) Protected Sub SeleccionarTipoDeClientes(sender As Object, e As EventArgs)
DdlClientes.Items.Clear()
InicializaClientes(ChkClientesTodos.Checked) InicializaClientes(ChkClientesTodos.Checked)
End Sub End Sub

View File

@@ -2482,7 +2482,7 @@
<div class="row" style="padding-left: 16px;"> <div class="row" style="padding-left: 16px;">
<div class="form-group form-md-line-input input-iconright col-xs-9"> <div class="form-group form-md-line-input input-iconright col-xs-9">
<asp:TextBox ID="TxtRFCCliente" Text="XAXX010101000" Style="text-transform: uppercase;" placeholder="Ingrese el RFC para su validación" runat="server" CssClass="form-control" MaxLength="13" CausesValidation="true"></asp:TextBox> <asp:TextBox ID="TxtRFCCliente" Text="XAXX010101000" Style="text-transform: uppercase;" placeholder="Ingrese el RFC para su validación" runat="server" CssClass="form-control" MaxLength="13" CausesValidation="true"></asp:TextBox>
<asp:RegularExpressionValidator ID="REVRFCCliente" runat="server" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''RFC''</b> es incorrecto, por favor ingréselo." ValidationGroup="GrpGuardarCliente" ControlToValidate="TxtRFCCliente" ValidationExpression="[a-z,ñ,A-Z,Ñ,&]{3,4}[0-9]{2}[0-1][0-9][0-3][0-9][A-Z,0-9]?[A-Z,0-9]?[0-9,A-Z]?"></asp:RegularExpressionValidator> <asp:RegularExpressionValidator ID="REVRFCCliente" runat="server" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''RFC''</b> es incorrecto, por favor ingréselo." ValidationGroup="GrpGuardarCliente" ControlToValidate="TxtRFCCliente" ValidationExpression="^[a-zñA-ZÑ.)(/\\&-]{3,4}(\d{6})((\D|\d){2})((\D|\d){1})$"></asp:RegularExpressionValidator>
<label for="<%= TxtRFCCliente.ClientID.ToString()%>">RFC:</label> <label for="<%= TxtRFCCliente.ClientID.ToString()%>">RFC:</label>
</div> </div>
<div class="form-group form-md-line-input input-iconright col-xs-3"> <div class="form-group form-md-line-input input-iconright col-xs-3">

View File

@@ -5014,7 +5014,7 @@ Partial Class PV
If Modalidad = "A" Then If Modalidad = "A" Then
Row("Consec") = TmpDT.MAX("Consec").ToEntero() + 1 Row("Consec") = TmpDT.MAX("Consec").ToEntero() + 1
If Not EsCargo Then If Not EsCargo Then
ConsecutivoVenta = TmpDT.MAX("Consec").ToEntero() + 1 ConsecutivoVenta = Row("Consec").ToString.ToEntero
End If End If
ElseIf Modalidad = "U" Then ElseIf Modalidad = "U" Then
If Not EsCargo Then If Not EsCargo Then
@@ -7661,6 +7661,7 @@ Partial Class PV
TmpDTRecepcionUsados = New DataTable TmpDTRecepcionUsados = New DataTable
TmpDTRecepcionUsados.Columns.Add("CvePS", GetType(Integer)) TmpDTRecepcionUsados.Columns.Add("CvePS", GetType(Integer))
TmpDTRecepcionUsados.Columns.Add("CvePSRelacionado", GetType(Integer)) TmpDTRecepcionUsados.Columns.Add("CvePSRelacionado", GetType(Integer))
TmpDTRecepcionUsados.Columns.Add("ConsecUsado", GetType(Integer))
TmpDTRecepcionUsados.Columns.Add("ConsecRelacionado", GetType(Integer)) TmpDTRecepcionUsados.Columns.Add("ConsecRelacionado", GetType(Integer))
TmpDTRecepcionUsados.Columns.Add("Cantidad", GetType(Decimal)) TmpDTRecepcionUsados.Columns.Add("Cantidad", GetType(Decimal))
TmpDTRecepcionUsados.Columns.Add("AnioVehiculo", GetType(String)) TmpDTRecepcionUsados.Columns.Add("AnioVehiculo", GetType(String))
@@ -7743,6 +7744,9 @@ Partial Class PV
Row("PU") = DrTamanio("Cargo").ToString().ToDecimal Row("PU") = DrTamanio("Cargo").ToString().ToDecimal
Row("CveBCIUsado") = DdlBCIUsado.SelectedValue.ToEntero Row("CveBCIUsado") = DdlBCIUsado.SelectedValue.ToEntero
Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero
If ListaPSCargo IsNot Nothing AndAlso ListaPSCargo.Count = 1 Then
Row("ConsecUsado") = ListaPSCargo.FirstOrDefault().ConsecutivoUsado
End If
Row("ConsecRelacionado") = ConsecPSPadre Row("ConsecRelacionado") = ConsecPSPadre
Row("FechaUsado") = TxtFechaVigencia.Text.ToDateTime() Row("FechaUsado") = TxtFechaVigencia.Text.ToDateTime()
Row("AnioVehiculo") = TxtAnioVehiculo.Text Row("AnioVehiculo") = TxtAnioVehiculo.Text
@@ -7878,6 +7882,7 @@ Partial Class PV
End Sub End Sub
Public Class MConceptoUsado Public Class MConceptoUsado
Public Property Consecutivo As Integer Public Property Consecutivo As Integer
Public Property ConsecutivoUsado As Integer
Public Property CvePS As Integer Public Property CvePS As Integer
End Class End Class
Private Function CalculaUsados(Consec As Integer, Optional LimpiarUsados As Boolean = True) As List(Of MConceptoUsado) Private Function CalculaUsados(Consec As Integer, Optional LimpiarUsados As Boolean = True) As List(Of MConceptoUsado)
@@ -7985,12 +7990,12 @@ Partial Class PV
For Each drowPsTamaños As DataRow In DTPSTemp.Rows For Each drowPsTamaños As DataRow In DTPSTemp.Rows
If drowPsTamaños("PU").ToString.ToDecimal > 0 Then If drowPsTamaños("PU").ToString.ToDecimal > 0 Then
Dim Concec = AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString, Dim ConsecutivoUsado As Integer = 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, 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(New MConceptoUsado() With {.Consecutivo = Consec, .CvePS = drowPsTamaños("CvePS").ToString.ToEntero}) ListaPScargo.Add(New MConceptoUsado() With {.Consecutivo = Consec, .ConsecutivoUsado = ConsecutivoUsado, .CvePS = drowPsTamaños("CvePS").ToString.ToEntero})
End If End If
End If End If
Next Next