--7 Ver existencias en cotizacion, actual o existente
This commit is contained in:
@@ -2258,6 +2258,25 @@ Public Class ClsInventarios
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetExistenciasPSVenta(CveVenta As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Inv_ExistenciasVentaGET")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener las existencias de los almacenes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetExistenciasProductosLike(PS As String, CveClasificacion As Integer, CveSubProyecto As Integer, Estatus As Integer, AplicaParaVenta As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional MostrarTodosAlmacenes As Boolean = False, Optional CveAlmacen As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
|
||||
@@ -411,6 +411,9 @@
|
||||
<asp:LinkButton ID="LnkCalcularPromociones" runat="server" CausesValidation="False" Text="<i class='fa fa-tag'></i> Aplicar promociones" OnClick="LnkCalcularPromociones_Click"
|
||||
data-toggle="confirmation" data-popout="true" data-original-title="¿Aplicar Promociones?" data-btn-ok-label="si" />
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LbVerificarExistencia" Visible="false" runat="server"><i class='fa fa-list-alt'></i>Verificar Existencias</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
|
||||
@@ -1982,7 +1985,7 @@
|
||||
<asp:TemplateField>
|
||||
<HeaderTemplate>Producto</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlPS" runat="server" Text='<%# Eval("CodigoPS") %>'></asp:Literal>
|
||||
<asp:Literal ID="LtlPS" runat="server" Text='<%# Eval("CodigoPS") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Serie" Visible="false">
|
||||
@@ -9281,6 +9284,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="DivModalExistenciaTotal" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Existencias</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<asp:UpdatePanel runat="server" ID="UPExist" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvExist" runat="server" AutoGenerateColumns="true" GridLines="None" BorderWidth="0" CssClass="table table-striped table-hover Widthall">
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
|
||||
@@ -5461,6 +5461,10 @@ Partial Class Ventas
|
||||
UPCondicionesPago.Update()
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DbRowVenta("TipoDocto").ToString().Contiene("Cot", "Rem") Then
|
||||
LbVerificarExistencia.Visible = True
|
||||
End If
|
||||
|
||||
'ESCONDE ACCIONES
|
||||
LnkRemisiones.Visible = False
|
||||
LnkPedido2SinFacturar.Visible = False
|
||||
@@ -40627,5 +40631,65 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub LbVerificarExistencia_Click(sender As Object, e As EventArgs) Handles LbVerificarExistencia.Click
|
||||
'RegistraScript(String.Format("AbrirVentana('/Inventarios/PopUpExistenciasAlmacenDT.aspx?CveOrdenCompra={0}',800,547,'N');", CveOrdenCompra))
|
||||
VerificarExistencias()
|
||||
End Sub
|
||||
Private Sub VerificarExistencias()
|
||||
Dim objInv As New ClsInventarios
|
||||
Dim tmpDTPS As DataTable = Nothing
|
||||
If objInv.GetExistenciasPSVenta(CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
tmpDTPS = objInv.DtResultados.Copy()
|
||||
End If
|
||||
objInv.Dispose()
|
||||
|
||||
If tmpDTPS IsNot Nothing Then
|
||||
|
||||
' limpio los almacenes donde no tiene ningun producto existencia
|
||||
For i As Integer = tmpDTPS.Columns.Count - 1 To 1 Step -1
|
||||
If Not tmpDTPS.Columns(i).ColumnName.Contiene("Producto") AndAlso tmpDTPS.SUM(String.Format("[{0}]", tmpDTPS.Columns(i).ColumnName)) = 0 Then
|
||||
tmpDTPS.Columns.RemoveAt(i)
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim DtExistencias = tmpDTPS.Clone()
|
||||
|
||||
For i As Integer = 0 To DtExistencias.Columns.Count - 1
|
||||
If DtExistencias.Columns(i).DataType <> GetType(String) Then DtExistencias.Columns(i).DataType = GetType(String)
|
||||
Next
|
||||
|
||||
For Each dr As DataRow In tmpDTPS.Rows
|
||||
DtExistencias.ImportRow(dr)
|
||||
Next
|
||||
|
||||
'FORMATEAR NUEVO DT
|
||||
For j = 0 To DtExistencias.Rows.Count - 1
|
||||
For i As Integer = DtExistencias.Columns.Count - 1 To 1 Step -1
|
||||
If Not DtExistencias.Columns(i).ColumnName.Contiene("Producto") Then
|
||||
If DtExistencias.Rows(j)(i).ToString().ToEntero() = 0 Then
|
||||
DtExistencias.Rows(j)(i) = "-"
|
||||
Else
|
||||
DtExistencias.Rows(j)(i) = DtExistencias.Rows(j)(i).ToString().Replace(".0000", "")
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
GvExist.DataSource = DtExistencias
|
||||
GvExist.DataBind()
|
||||
|
||||
'GvExist.Columns(0).ItemStyle.Width = New Unit(200, UnitType.Pixel)
|
||||
'ORDENA HACIA LA DERECHA LAS CANTIDAD - OJO!! NO SE USO GV.COLUMNS.COUNT PORQUE LAS COLUMNAS GENERADAS EN BEHIND NO LAS RECONOCE
|
||||
For index As Integer = 1 To DtExistencias.Columns.Count - 1
|
||||
For Each gvr As GridViewRow In GvExist.Rows
|
||||
gvr.Cells(index).HorizontalAlign = HorizontalAlign.Right
|
||||
Next
|
||||
Next
|
||||
End If
|
||||
|
||||
RegistraScript("$('#DivModalExistenciaTotal').modal('show');")
|
||||
UPExist.Update()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user