SOPORTES, ACTIVOS FIJIS (Interno,externo), generar remision del pescadito

This commit is contained in:
2020-09-30 19:42:31 -07:00
parent f53dc040c2
commit 338acaf0b3
3 changed files with 80 additions and 53 deletions

View File

@@ -140,7 +140,8 @@
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" DataFormatString="{0:#,##0.##}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="3%" />
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" ItemStyle-Width="40%" />
<asp:BoundField HeaderText="Contrato Externo" DataField="ContratoExterno" ItemStyle-Width="3%" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Es Interno" DataField="EsInternoTexto" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" />
</Columns>
</asp:GridView>
</div>
@@ -180,7 +181,8 @@
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" DataFormatString="{0:#,##0.##}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="3%" />
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" ItemStyle-Width="40%" />
<asp:BoundField HeaderText="Contrato Externo" DataField="ContratoExterno" ItemStyle-Width="3%" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Es Interno" DataField="EsInternoTexto" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" />
</Columns>
</asp:GridView>
</div>

View File

@@ -112,6 +112,7 @@ Partial Class Ventas_RepPedidosDevolucionesXContrato
e.Row.Cells(1).Text = ""
e.Row.Cells(5).Text = ""
e.Row.Cells(6).Text = ""
e.Row.Cells(7).Text = ""
Dim Texto = $"Pedido: <b><a href='/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveVenta")}' target='_blank'>{e.Row.DBCampo("SerieFolio")}</a></b> | "
Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: <b><a href ='/Inventarios/EntradasSalidas.aspx?CveMovimiento={e.Row.DBCampo("CveMovimiento")}' target='_blank'>{e.Row.DBCampo("Folio")}</a></b>")
@@ -135,6 +136,7 @@ Partial Class Ventas_RepPedidosDevolucionesXContrato
e.Row.Cells(1).Text = ""
e.Row.Cells(5).Text = ""
e.Row.Cells(6).Text = ""
e.Row.Cells(7).Text = ""
Dim Texto = $"Devolución: <b><a href='/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveVenta")}' target='_blank'>{e.Row.DBCampo("SerieFolio")}</a></b> | "
Texto += If(e.Row.DBCampo("CveMovimiento").ToString = "", " SIN MOVIMIENTO DE ALMACÉN", $"Folio Almacén: <b><a href ='/Inventarios/EntradasSalidas.aspx?CveMovimiento={e.Row.DBCampo("CveMovimiento")}' target='_blank'>{e.Row.DBCampo("Folio")}</a></b>")

View File

@@ -43,6 +43,7 @@ Public Class WSApp
ObjPS.Dispose()
End Get
End Property
Property GlobalDTMonedas() As DataTable
Get
GlobalDTMonedas = DirectCast(Application("GlobalDTMonedas"), DataTable)
@@ -326,32 +327,41 @@ Public Class WSApp
Application("GlobalDTCompProveedores") = value
End Set
End Property
Property GlobalDTProductosServicios(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional CveClasificacionCosto As Integer = -1, Optional Estatus As Integer = 1, Optional CvePS As Integer = -1, Optional AplicaParaVenta As Integer = -1, Optional CveTipoPS As Integer = -1) As DataTable
Public Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1) As DataTable
Get
If CveEmpresa = -1 Then
GlobalDTProductosServicios = DirectCast(Application("GlobalDTProductosServicios"), EnumerableRowCollection(Of DataRow)).CopyToDataTable
Else
Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa)
If CveEmpresa <> -1 Then
'sino existe, recarga los datos
If Application(AppNombre) Is Nothing Then
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPSSimplificado(CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados.AsEnumerable()
ObjPS.Dispose()
End If
Dim Cons = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow))
Dim Cons = DirectCast(Application("GlobalDTProductosServicios"), EnumerableRowCollection(Of DataRow))
Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa))
If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion))
If CveClasificacionCosto >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacionCosto) = CveClasificacionCosto))
If PSCodigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!PSCodigo) = PSCodigo))
If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus))
If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS))
If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta))
If CveTipoPS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveTipoPS) = CveTipoPS))
If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS))
'Try, generado para cuando el resultado no tiene valores(The source contains no DataRows.), no detenga la ejecucion, no se le puso un count previo, porque el costo se duplica, al preguntar y luego ordenar y convertir a datatable
Try
GlobalDTProductosServicios = Cons.OrderBy(Function(a) a!PS).CopyToDataTable
GlobalDTPSSimplificado = Cons.OrderBy(Function(a) a!PSCodigo).CopyToDataTable
Catch ex As Exception
GlobalDTProductosServicios = New DataTable
GlobalDTPSSimplificado = New DataTable
End Try
End If
Else
GlobalDTPSSimplificado = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable
End If
End Get
Set(value As DataTable)
Application("GlobalDTProductosServicios") = value
Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa)
Application(AppNombre) = value
End Set
End Property
Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1) As DataTable
@@ -716,25 +726,38 @@ Public Class WSApp
If ListaPS IsNot Nothing Then
Dim Continuar As Boolean = False
Dim ObjPS As New ClsProductosServicios
For Each PS In ListaPS
If ObjPS.GetPSExistencias(PS.CvePS, -1, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then
If ObjPS.DtResultados.Rows.Count > 0 Then
Dim Existencia As Decimal = ObjPS.DtResultados.Rows(0)("Existencia").ToString().ToDecimal()
Dim CveTipoPS As Integer = ObjPS.DtResultados.Rows(0)("CveTipoPS").ToString().ToEntero()
Try
For Each PS In ListaPS
Dim CveTipoPS As Integer = GlobalDTPSSimplificado(CveEmpresa, CvePS:=PS.CvePS).FiltroPrimeroValor("CveTipoPS").ToEntero()
If CveTipoPS > 0 Then
If CveTipoPS = 2 Then
If ObjPS.GetPSExistencias(PS.CvePS, -1, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then
If ObjPS.DtResultados.Rows.Count > 0 Then
Dim Existencia As Decimal = ObjPS.DtResultados.Rows(0)("Existencia").ToString().ToDecimal()
'Dim CveTipoPS As Integer = ObjPS.DtResultados.Rows(0)("CveTipoPS").ToString().ToEntero()
Continuar = (CveTipoPS = 2 AndAlso Existencia > 0) OrElse (CveTipoPS = 1)
Continuar = Existencia > 0
If Not Continuar Then
Retorno.Mensajes.Add($"El producto/servicio {ObjPS.DtResultados.Rows(0)("PS")} no tiene existencia.")
Exit For
If Not Continuar Then
Retorno.Mensajes.Add($"El producto/servicio {ObjPS.DtResultados.Rows(0)("PS")} no tiene existencia.")
Exit For
End If
Else
Continuar = False
Retorno.Mensajes.Add("No se pudo comprobar la existencia.")
Exit For
End If
End If
End If
Else
Continuar = False
Retorno.Mensajes.Add("No se pudo comprobar la existencia.")
Exit For
Retorno.Mensajes.Add("No se pudo comprobar si es producto o servicio.")
End If
End If
Next
Next
Catch ex As Exception
OnError("Ocurrió un error al consultar la existencia", ex)
Continuar = False
End Try
ObjPS.Dispose()
If Continuar Then