E140. CveVentaDetalle en recepcion de usados desde el PV.aspx
This commit is contained in:
@@ -5121,7 +5121,7 @@ Public Class ClsVentas
|
||||
|
||||
#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
|
||||
|
||||
DataAdapter("PA_Vta_VentasUsadosAdd", CommandType.StoredProcedure)
|
||||
@@ -5133,6 +5133,7 @@ Public Class ClsVentas
|
||||
.Add("@PU", SqlDbType.Money).Value = PU
|
||||
.Add("@CveBCI", SqlDbType.Int).Value = CveBCI
|
||||
.Add("@CveModeloAuto", SqlDbType.Int).Value = CveModeloAuto
|
||||
.Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle
|
||||
End With
|
||||
|
||||
Try
|
||||
|
||||
@@ -1578,10 +1578,14 @@ Namespace Modelos
|
||||
End If
|
||||
|
||||
If DtRecepcionUsados IsNot Nothing Then
|
||||
If DtRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then
|
||||
Dim rowInv As DataRow = DtRecepcionUsados.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0)
|
||||
rowInv("CveVentaDetalle") = ObjVentas.CveVentaDetalle
|
||||
End If
|
||||
Try
|
||||
If DtRecepcionUsados.Select($"ConsecUsado={Row("Consec").ToString.ToEntero}").Length > 0 Then
|
||||
Dim rowUsados As DataRow = DtRecepcionUsados.Select($"ConsecUsado={Row("Consec").ToString.ToEntero}")(0)
|
||||
rowUsados("CveVentaDetalle") = ObjVentas.CveVentaDetalle
|
||||
End If
|
||||
Catch ex As Exception
|
||||
GuardaLog("Ocurrió un error al relacionar los usados. " & ex.ToString())
|
||||
End Try
|
||||
End If
|
||||
|
||||
If DtPolizasVirtuales IsNot Nothing Then
|
||||
@@ -2138,7 +2142,7 @@ Namespace Modelos
|
||||
If factura.TipoDocto.Contiene("Rem") Then
|
||||
If factura.DtRecepcionUsados IsNot Nothing Then
|
||||
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
|
||||
Exit For
|
||||
End If
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<div id="DivCliente" runat="server" visible="true">
|
||||
<label class="col-md-1 truncate" style="width: 110px">Cliente:</label>
|
||||
<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 class="col-md-2">
|
||||
<label class="col-md-1 truncate" style="width: 125px">Todos los clientes:</label>
|
||||
|
||||
@@ -15,14 +15,14 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
Private _dtDatos As DataTable
|
||||
|
||||
Public Property DtClientes() As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtClientes"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtClientes") = value
|
||||
End Set
|
||||
End Property
|
||||
'Public Property DtClientes() As DataTable
|
||||
' Get
|
||||
' Return CType(ViewState("DtClientes"), DataTable)
|
||||
' End Get
|
||||
' Set(value As DataTable)
|
||||
' ViewState("DtClientes") = value
|
||||
' End Set
|
||||
'End Property
|
||||
|
||||
Public Property DtMovimientos() As DataTable
|
||||
Get
|
||||
@@ -454,6 +454,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Dim Fecha As DateTime = IfNull(Request("Fecha"), Now.ToString("dd/MM/yyyy")).ToString().ToDateTime()
|
||||
|
||||
If Not String.IsNullOrEmpty(RFC) Then
|
||||
Dim DtClientes = GlobalDTCliente(UsuarioActual.CveEmpresa)
|
||||
If DtClientes Is Nothing Then
|
||||
Alert("No se encontraron clientes para filtrar", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
@@ -476,8 +477,10 @@ Partial Class Inventarios_RecepcionUsados
|
||||
End If
|
||||
|
||||
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)
|
||||
|
||||
DdlAlmacen.SelectedValueExist(CveAlmacen)
|
||||
@@ -775,6 +778,10 @@ Partial Class Inventarios_RecepcionUsados
|
||||
EsDistribuidor = False
|
||||
InicializaClientes(True)
|
||||
DdlClientes.Enabled = True
|
||||
If Not String.IsNullOrEmpty(DdlClientes.ddlWS.Attributes.Item("disabled")) Then
|
||||
DdlClientes.ddlWS.Attributes.Remove("disabled")
|
||||
End If
|
||||
|
||||
ChkClientesTodos.Enabled = True
|
||||
|
||||
SiguienteFolio()
|
||||
@@ -2008,14 +2015,11 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
#Region "DDL CLIENTE / CLIENTE SUCURSAL - SELECTED INDEX CHANGED"
|
||||
Private Sub InicializaClientes(Todos As Boolean)
|
||||
DtClientes = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltraParametros(If(Todos, "", "EsDistribuidor = 1"))
|
||||
|
||||
DdlClientes.DataSource = DtClientes
|
||||
DdlClientes.DataBind()
|
||||
|
||||
DdlClientes.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlClientes.ddlWS.Attributes.Add("data-esdistribuidor", If(Todos, "-1", "1"))
|
||||
DdlClientes.SelectedValue = "-1"
|
||||
DdlClientes.SelectedText = "Seleccione"
|
||||
|
||||
UpGenerales.Update()
|
||||
End Sub
|
||||
'Protected Sub ActivaClientes()
|
||||
' If UsuarioActual.CveEmpresa.Contiene(72, 80) Then
|
||||
@@ -2027,7 +2031,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
|
||||
'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()
|
||||
End Sub
|
||||
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
|
||||
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
|
||||
Dim CveVentaDetalle As Integer = Me.ObjFactura.DtDetalle.FiltroPrimeroValor("CveVentaDetalle", $"EsCargo = 1 AND Cantidad = {RowUsado("Cantidad")} AND CvePS = {RowUsado("CvePS")}").ToEntero()
|
||||
If CveVentaDetalle > 0 Then
|
||||
RowUsado("CveVentaDetalle") = CveVentaDetalle
|
||||
If RowUsado("CveVentaDetalle").ToString().ToEntero() <= 0 Then
|
||||
Dim CveVentaDetalle As Integer = Me.ObjFactura.DtDetalle.FiltroPrimeroValor("CveVentaDetalle", $"EsCargo = 1 AND Cantidad = {RowUsado("Cantidad")} AND CvePS = {RowUsado("CvePS")}").ToEntero()
|
||||
If CveVentaDetalle > 0 Then
|
||||
RowUsado("CveVentaDetalle") = CveVentaDetalle
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
@@ -2330,13 +2339,15 @@ Partial Class Inventarios_RecepcionUsados
|
||||
If CveCliente > 0 Then
|
||||
DivCliente.Visible = True
|
||||
|
||||
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveCliente = {0}", CveCliente))
|
||||
DdlClientes.DataBind()
|
||||
Dim Cliente = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimeroValor("NombreComercial")
|
||||
|
||||
DdlClientes.SelectedValue = CveCliente.ToString()
|
||||
DdlClientes.SelectedText = Cliente
|
||||
|
||||
DdlClientes.SelectedValueExist(CveCliente)
|
||||
CambiaCliente(False, False)
|
||||
|
||||
DdlClientes.Enabled = False
|
||||
DdlClientes.ddlWS.Attributes.Add("disabled", "disabled")
|
||||
ChkClientesTodos.Enabled = False
|
||||
End If
|
||||
|
||||
@@ -3414,7 +3425,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
#End Region
|
||||
|
||||
Protected Sub SeleccionarTipoDeClientes(sender As Object, e As EventArgs)
|
||||
DdlClientes.Items.Clear()
|
||||
InicializaClientes(ChkClientesTodos.Checked)
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -2482,7 +2482,7 @@
|
||||
<div class="row" style="padding-left: 16px;">
|
||||
<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: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>
|
||||
</div>
|
||||
<div class="form-group form-md-line-input input-iconright col-xs-3">
|
||||
|
||||
@@ -5014,7 +5014,7 @@ Partial Class PV
|
||||
If Modalidad = "A" Then
|
||||
Row("Consec") = TmpDT.MAX("Consec").ToEntero() + 1
|
||||
If Not EsCargo Then
|
||||
ConsecutivoVenta = TmpDT.MAX("Consec").ToEntero() + 1
|
||||
ConsecutivoVenta = Row("Consec").ToString.ToEntero
|
||||
End If
|
||||
ElseIf Modalidad = "U" Then
|
||||
If Not EsCargo Then
|
||||
@@ -7661,6 +7661,7 @@ Partial Class PV
|
||||
TmpDTRecepcionUsados = New DataTable
|
||||
TmpDTRecepcionUsados.Columns.Add("CvePS", GetType(Integer))
|
||||
TmpDTRecepcionUsados.Columns.Add("CvePSRelacionado", GetType(Integer))
|
||||
TmpDTRecepcionUsados.Columns.Add("ConsecUsado", GetType(Integer))
|
||||
TmpDTRecepcionUsados.Columns.Add("ConsecRelacionado", GetType(Integer))
|
||||
TmpDTRecepcionUsados.Columns.Add("Cantidad", GetType(Decimal))
|
||||
TmpDTRecepcionUsados.Columns.Add("AnioVehiculo", GetType(String))
|
||||
@@ -7743,6 +7744,9 @@ Partial Class PV
|
||||
Row("PU") = DrTamanio("Cargo").ToString().ToDecimal
|
||||
Row("CveBCIUsado") = DdlBCIUsado.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("FechaUsado") = TxtFechaVigencia.Text.ToDateTime()
|
||||
Row("AnioVehiculo") = TxtAnioVehiculo.Text
|
||||
@@ -7878,6 +7882,7 @@ Partial Class PV
|
||||
End Sub
|
||||
Public Class MConceptoUsado
|
||||
Public Property Consecutivo As Integer
|
||||
Public Property ConsecutivoUsado As Integer
|
||||
Public Property CvePS As Integer
|
||||
End Class
|
||||
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
|
||||
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("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()))
|
||||
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
|
||||
Next
|
||||
|
||||
Reference in New Issue
Block a user