183 Karedex Wish List para prueba

This commit is contained in:
rakcsle
2025-03-25 13:13:36 -07:00
parent ba349c18fb
commit 6345d6826f
3 changed files with 159 additions and 3 deletions

View File

@@ -1424,10 +1424,10 @@
<Width>4.82589cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
<Width>1.75917cm</Width>
</TablixColumn>
<TablixColumn>
<Width>1.6882cm</Width>
<Width>2.42903cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.33651cm</Width>

View File

@@ -425,7 +425,7 @@
</asp:UpdatePanel>
<div class="row">
<div class="col-md-7">
<div class="col-md-6">
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpNumeroParte">
<ContentTemplate>
<asp:Label runat="server" ID="LblNumeroParte" Text="" Visible ="false"></asp:Label>
@@ -433,6 +433,30 @@
</asp:UpdatePanel>
</div>
<div class="col-md-1">
<asp:UpdatePanel runat="server" ID="UpAddWishList" UpdateMode="Conditional">
<ContentTemplate>
<div runat="server" id="DVWishList" visible="false">
<table style="width:170px!important" >
<td style="width:70px!important">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox runat="server" ID="TxtCantidad" Width="70px" CssClass="form-control"></asp:TextBox>
<label for="<%= TxtCantidad.ClientID.ToString()%>">Cantidad:</label>
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtCantidad" FilterType="Custom" ValidChars="1234567890." />
</div>
</td>
<td style="width:100px!important">
<asp:LinkButton ID="LnkAgrgarWishList" ClientIDMode="Static" runat="server" CssClass="btn btn-primary" OnClick="LnkAgrgarWishList_Click" Width="91px"><i class="fa fa-shopping-cart" aria-hidden="true"></i> Agregar</asp:LinkButton>
</td>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:UpdatePanel runat="server" ID="UpOCS" UpdateMode="Conditional">

View File

@@ -67,8 +67,15 @@ Partial Class Inventarios_Kardex
If UsuarioActual.CveRol = 1 Then
LblPS.ToolTip = ddlProducto2.SelectedValue
lblAlm.InnerText = ddlProducto2.SelectedValue
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
DVWishList.Visible = True
End If
End If
End If
End Sub
@@ -901,4 +908,129 @@ Partial Class Inventarios_Kardex
End Sub
Protected Sub LnkAgrgarWishList_Click(sender As Object, e As EventArgs)
AgregarAWishList()
End Sub
Private Function AgregarAWishList() As Boolean
Dim respuesta As Boolean = True
Dim CveAlmacen As Integer = -1
Dim CvePS As Integer = ddlProducto2.SelectedValue.ToEntero
Dim almacenStr As String() = ddlAlmacen.GetSelectedValues().Split(","c)
Dim CveSubProyecto As Integer = -1
Dim FolioOrdenCompra As String = ""
Dim CveOrdenCompra As Integer = -1
Dim UltimoCosto As Decimal = 0D
Dim CveProveedorCompra As Integer = -1
Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal
Dim PorcentajeIVA As Decimal = 0
Dim PorcentajeIVASucursal As Decimal = 0
Dim CveUnidadMedida As Integer = -1
Dim RetISR As Decimal = 0
Dim RetIVA As Decimal = 0
Dim PorcentajeRetISR As Decimal = 0
Dim PorcentajeRetIVA As Decimal = 0
If Not Cantidad > 0 Then
Alert("Debe indicar una cantidad.", TipoMensaje.MsgAdvertencia)
Return False
End If
If almacenStr.Length > 0 Then
CveAlmacen = almacenStr(0).ToEntero
End If
If CveAlmacen > 0 Then
CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacen).FiltroPrimeroValor("CveSubProyecto").ToEntero
If CveSubProyecto > 0 Then
Dim DRowSubProyecto As DataRow = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto).FiltroPrimero("")
If DRowSubProyecto IsNot Nothing Then
PorcentajeIVASucursal = DRowSubProyecto("IVA").ToString.ToDecimal
Else
Alert("No se encontro el subproyecto.", TipoMensaje.MsgAdvertencia)
Return False
End If
Else
Alert("No se encontro el subproyecto.", TipoMensaje.MsgAdvertencia)
Return False
End If
Else
Alert("Debe seleccionar un almacén.", TipoMensaje.MsgAdvertencia)
Return False
End If
If CvePS > 0 Then
Dim DTRowPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimero("")
If DTRowPS IsNot Nothing Then
UltimoCosto = DTRowPS("UltimoCosto").ToString.ToDecimal
CveProveedorCompra = If(DTRowPS("CveProveedorCompra").ToString.ToEntero > 0, DTRowPS("CveProveedorCompra").ToString.ToEntero, -1)
CveUnidadMedida = DTRowPS("CveUnidadMedida").ToString.ToEntero
PorcentajeIVA = If(DTRowPS("IVA").ToString.ToEntero = -1, PorcentajeIVASucursal, 0)
PorcentajeRetISR = DTRowPS("RetISR").ToString.ToDecimal
PorcentajeRetIVA = DTRowPS("RetIVA").ToString.ToDecimal
End If
Else
Alert("Debe seleccionar un producto.", TipoMensaje.MsgAdvertencia)
Return False
End If
Dim ObjOC As New ClsOC
ObjOC.IniciaTransacSQL()
If ObjOC.GetOrdenesCompraRep("REQ", -1, CveSubProyecto, -1, 0, MinFecha, MaxFecha, -1, CveProveedorCompra, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1) Then
If ObjOC.DtResultados IsNot Nothing AndAlso ObjOC.DtResultados.Rows.Count > 0 Then
CveOrdenCompra = ObjOC.DtResultados(0)("CveOrdenCompra").ToString.ToEntero
FolioOrdenCompra = ObjOC.DtResultados(0)("SerieFolio").ToString
End If
Else
respuesta = False
End If
If respuesta AndAlso Not CveOrdenCompra > 0 Then
If ObjOC.AddOrdenCompra("REQ", CveSubProyecto, "Compra de Stock", "Compra de Stock", 1, NowADS, 1, 0, NowADS.ToString("dd/MM/yyyy"), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveProveedorCompra, CveSubProyectoEntrega:=CveSubProyecto, PorcentajeIVA:=PorcentajeIVA) Then
CveOrdenCompra = ObjOC.CveOrdenCompra
FolioOrdenCompra = ObjOC.SerieFolio
Else
respuesta = False
End If
End If
If respuesta AndAlso CveOrdenCompra > 0 Then
Dim Total As Decimal = (Cantidad * UltimoCosto).RoundSQL
Dim IVA As Decimal = (Total * PorcentajeIVA).RoundSQL
RetIVA = IVA * PorcentajeRetIVA
RetISR = Total * PorcentajeRetISR
If Not ObjOC.AddOrdenCompraDetalle(CveOrdenCompra, Cantidad, CveUnidadMedida, CvePS, UltimoCosto, CveSubProyecto, -1, "Obs", UsuarioActual.CveUsuario,
IVA:=IVA, RetIVA:=RetIVA, RetISR:=RetISR, Total:=Total, IVAPorcentaje:=PorcentajeIVA, RetIVAPorcentaje:=PorcentajeRetIVA, RetISRPorcentaje:=PorcentajeRetISR) Then
respuesta = False
End If
End If
If respuesta Then
Alert($"Producto agregado a la lista, requisición: {FolioOrdenCompra}.", TipoMensaje.ToastInformacion)
ObjOC.Commit()
TxtCantidad.Text = ""
UpAddWishList.Update()
Else
Alert("No se agrego el producto a la lista.", TipoMensaje.ToastAdventencia)
ObjOC.RollBack()
End If
ObjOC.Dispose()
Return respuesta
End Function
End Class