merge manual

This commit is contained in:
Antonio Gonzalez
2020-10-02 12:55:11 -07:00
13 changed files with 3429 additions and 3327 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4588,6 +4588,65 @@ Public Class ClsInventarios
End Function
#End Region
#Region " FLETES COMPRAS "
Public Function GetFletesCompras(CveFlete As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_FletesComprasGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveFlete", SqlDbType.Int).Value = CveFlete
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al querer obtener las compras relacionadas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function AddFletesCompras(CveFlete As Integer, Optional CveCompra As Integer = -1, Optional CveOC As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_FletesComprasAdd")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveFlete", SqlDbType.Int).Value = CveFlete
.Add("@CveCompra", SqlDbType.Int).Value = CveCompra
.Add("@CveOC", SqlDbType.Int).Value = CveOC
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al querer agregar las compras relacionadas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function PendientesAlmacenFletesComprasGet(CveFlete As Integer, CveProveedor As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_PendientesAlmacenFletesComprasGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveFlete", SqlDbType.Int).Value = CveFlete
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener las Importaciones pendientes de almacen.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
#End Region
#Region " FLETES DETALLE "
Public Function AddFleteDetalle(CveFlete As Integer, CveCompra As Integer) As Boolean
Dim Retorno As Boolean = False

View File

@@ -403,54 +403,58 @@ Partial Class Bancos_PolizaCheque
CodigoCuenta = ""
NombreCuenta = ""
If drt("IdCtaContable").ToString.ToEntero > 0 Then 'DtCuentasContables
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString))
If drr IsNot Nothing Then
IdCuenta = drt("IdCtaContable").ToString.ToEntero
CodigoCuenta = drr("CuentaFormato").ToString()
NombreCuenta = drr("Nombre").ToString()
'Cuenta = drr("Nombre").ToString()
End If
EsComodin = 0
ElseIf drt("CveConcepto").ToString = "30" Then
'saco la clave de la cuenta bancaria seleccionada
If DdlCuenta.SelectedValue.ToEntero > 0 And drt("CveConcepto").ToString = "30" Then 'DtCuentasContables
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", IdCuentaBancos(DdlCuenta.SelectedValue.ToEntero)))
If drr IsNot Nothing Then
IdCuenta = drr("Id").ToString.ToEntero
CodigoCuenta = drr("CuentaFormato").ToString()
NombreCuenta = drr("Nombre").ToString()
' Cuenta = drr("Nombre").ToString()
EsComodin = 1
Else
' Rad.Checked = False
If UsuarioActual.CveEmpresa <> 126 Then
Alert("La Cuenta Bancaria no se ha vinculado a la cuenta contable", TipoMensaje.MsgAdvertencia)
GvMov.DataBind()
UPMovs.Update()
Exit Sub
End If
End If
End If
ElseIf drt("CveConcepto").ToString.ToEntero = 135 And IdCtaFondoGarantia > 0 Then
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", IdCtaFondoGarantia))
IdCuenta = IdCtaFondoGarantia
CodigoCuenta = drr("CuentaFormato").ToString()
NombreCuenta = drr("Nombre").ToString()
'Cuenta = drr("Nombre").ToString()
EsComodin = 0
End If
If UsuarioActual.Empresa.UsaContabilidad Then
If drt("IdCtaContable").ToString.ToEntero > 0 Then 'DtCuentasContables
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString))
If drr IsNot Nothing Then
IdCuenta = drt("IdCtaContable").ToString.ToEntero
CodigoCuenta = drr("CuentaFormato").ToString()
NombreCuenta = drr("Nombre").ToString()
'Cuenta = drr("Nombre").ToString()
End If
EsComodin = 0
ElseIf drt("CveConcepto").ToString = "30" Then
'saco la clave de la cuenta bancaria seleccionada
If DdlCuenta.SelectedValue.ToEntero > 0 And drt("CveConcepto").ToString = "30" Then 'DtCuentasContables
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", IdCuentaBancos(DdlCuenta.SelectedValue.ToEntero)))
If drr IsNot Nothing Then
IdCuenta = drr("Id").ToString.ToEntero
CodigoCuenta = drr("CuentaFormato").ToString()
NombreCuenta = drr("Nombre").ToString()
' Cuenta = drr("Nombre").ToString()
EsComodin = 1
Else
' Rad.Checked = False
If UsuarioActual.CveEmpresa <> 126 Then
Alert("La Cuenta Bancaria no se ha vinculado a la cuenta contable", TipoMensaje.MsgAdvertencia)
GvMov.DataBind()
UPMovs.Update()
Exit Sub
End If
End If
End If
ElseIf drt("CveConcepto").ToString.ToEntero = 135 And IdCtaFondoGarantia > 0 Then
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", IdCtaFondoGarantia))
IdCuenta = IdCtaFondoGarantia
CodigoCuenta = drr("CuentaFormato").ToString()
NombreCuenta = drr("Nombre").ToString()
'Cuenta = drr("Nombre").ToString()
EsComodin = 0
End If
End If
Dim dr As DataRow = DtMovimientos.NewRow
dr("IdCuenta") = IdCuenta
dr("CodigoCuenta") = CodigoCuenta & "<br>" & NombreCuenta

View File

@@ -4561,19 +4561,13 @@ Partial Class Compras_Compras
Case 237
Select Case FleteImportacionOpcion
Case 1
Dim Dr As DataRow = Nothing
If ObjInventario.GetFletes(UsuarioActual.CveEmpresa, CveFlete) Then
If ObjInventario.DtResultados.Rows.Count > 0 Then
Dr = ObjInventario.DtResultados.Rows(0)
End If
End If
If Dr IsNot Nothing Then
If Not ObjInventario.UpdateFlete(CveFlete, Dr("Descripcion").ToString, Dr("Fecha").ToString.ToDate, -1, CveCompra, UsuarioActual.CveUsuario) Then
ErrorOC = True
End If
Else
If Not ObjInventario.AddFletesCompras(CveFlete, CveCompra) Then
ErrorOC = True
End If
''actualiza la compra para que no se surta en almacen. sino por el flete o importación
'If Not ObjCompras.UpdateEstatusAlmacen(CveCompra, 2) Then
' ErrorOC = True
'End If
Case 2
If Not ObjInventario.AddFleteDetalle(CveFlete, CveCompra) Then
ErrorOC = True
@@ -19272,22 +19266,13 @@ Partial Class Compras_Compras
Case 237
Select Case FleteImportacionOpcion
Case 1
Dim Dr As DataRow = Nothing
If ObjInventario.GetFletes(UsuarioActual.CveEmpresa, CveFlete) Then
If ObjInventario.DtResultados.Rows.Count > 0 Then
Dr = ObjInventario.DtResultados.Rows(0)
End If
End If
If Dr IsNot Nothing Then
If Not ObjInventario.UpdateFlete(CveFlete, Dr("Descripcion").ToString, Dr("Fecha").ToString.ToDate, -1, CveCompra, UsuarioActual.CveUsuario) Then
ErrorTrans = True
End If
If Not ObjCompras.AddFletesCompras(CveFlete, CveCompra:=CveCompra) Then
ErrorTrans = True
End If
Else
ErrorTrans = True
If Not ObjInventario.AddFletescompras(CveFlete, CveCompra) Then
ErrorTrans = True
End If
'''actualiza la compra para que no se surta en almacen. sino por el flete o importación
''If Not ObjCompras.UpdateEstatusAlmacen(CveCompra, 2) Then
'' ErrorTrans = True
''End If
Case 2
If Not ObjInventario.AddFleteDetalle(CveFlete, CveCompra) Then
ErrorTrans = True

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

@@ -111,7 +111,8 @@ Partial Class Ventas_RepPedidosDevolucionesXContrato
e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;")
e.Row.Cells(1).Text = ""
e.Row.Cells(5).Text = ""
e.Row.Cells(6).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>")
@@ -134,7 +135,8 @@ Partial Class Ventas_RepPedidosDevolucionesXContrato
e.Row.Attributes.Add("style", "background-color:#B9B5B4 !important;")
e.Row.Cells(1).Text = ""
e.Row.Cells(5).Text = ""
e.Row.Cells(6).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

@@ -13,7 +13,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen
End Sub
Private Sub CargaCombos()
Dim DtAlmacenes As DataTable = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros("CveTipoAlmacen in (1,14)")
Dim DtAlmacenes As DataTable = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros("CveTipoAlmacen in (1,14,16)")
DdlAlmacen.DataSource = DtAlmacenes
DdlAlmacen.DataBind()
@@ -121,7 +121,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen
For Each Row As DataRow In resultado.Rows
Dim CvePS = Row("CvePS").ToString().ToEntero()
'Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
Dim PU As Decimal = Row("PUOriginal").ToString().ToDecimal()
Dim CveUM As Integer = Row("CveUM").ToString().ToEntero()
Dim CveSeccionAlmacen As Integer = Lista(Row("CvePS").ToString().ToEntero()) 'GvD.Rows(ind).FCDropDownList("DDlS").SelectedValue.ToEntero ' IfNull(Row("CveSeccionAlmacen"), "-1").ToString().ToEntero()

View File

@@ -99,7 +99,11 @@ Partial Class Compras_Fletes
Else
Alert("Ocurrió un error al cargar el detalle del flete", TipoMensaje.MsgError)
End If
CargarComprasRelacionadas()
If ObjInv.GetFletesCompras(CveFlete, UsuarioActual.CveEmpresa) Then
GvComprasVinculadas.DataSource = ObjInv.DtResultados
End If
Else
Alert("No se encontró el flete", TipoMensaje.MsgAdvertencia)
End If
@@ -109,6 +113,7 @@ Partial Class Compras_Fletes
ObjInv.Dispose()
CargaGrid()
GvComprasVinculadas.DataBind()
UpRegistro.Update()
End Sub
@@ -428,14 +433,5 @@ Partial Class Compras_Fletes
End Sub
Private Sub CargarComprasRelacionadas()
Dim ObjCompras As New ClsCompras
If ObjCompras.GetFletesCompras(CveFlete, UsuarioActual.CveEmpresa) Then
GvComprasVinculadas.DataSource = ObjCompras.DtResultados
End If
ObjCompras.Dispose()
GvComprasVinculadas.DataBind()
End Sub
End Class

View File

@@ -79,7 +79,13 @@
<label runat="server" visible="false" id="LblFletes" class="col-md-1 truncate" style="text-align: right;">Folio:</label>
<div runat="server" visible="false" id="DivFletes" class="col-md-2" style="display: inline">
<div style="width: 100px; float: left;">
<asp:DropDownList ID="DdlFletes" runat="server" DataValueField="CveFlete" DataTextField="FolioDescripcion" CssClass="select2me" Style="width: 100px !important;"></asp:DropDownList>
<asp:DropDownList ID="DdlFletes" runat="server" DataValueField="CveFlete" DataTextField="FolioDescripcion" OnSelectedIndexChanged="DdlFletes_SelectedIndexChanged" AutoPostBack="true" CssClass="select2me" Style="width: 100px !important;"></asp:DropDownList>
</div>
</div>
<label runat="server" visible="false" id="LblIndirectoFactura" class="col-md-1 truncate" style="text-align: right;">Factura:</label>
<div runat="server" visible="false" id="DivDdlIndirectoFactura" class="col-md-2" style="display: inline">
<div style="width: 100px; float: left;">
<asp:DropDownList ID="DdlIndirectoFactura" runat="server" DataValueField="CveCompra" DataTextField="SerieFolio" CssClass="select2me" Style="width: 100px !important;"></asp:DropDownList>
</div>
</div>
</div>

View File

@@ -613,6 +613,8 @@ Partial Class Inventarios_RecepcionAlmacen
Case 4
LblFletes.Visible = True
DivFletes.Visible = True
LblIndirectoFactura.Visible = True
DivDdlIndirectoFactura.Visible = True
End Select
CargaFoliosRecepcion()
@@ -711,6 +713,30 @@ Partial Class Inventarios_RecepcionAlmacen
DdlFletes.DataBind()
DdlFletes.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Sub
Protected Sub DdlFletes_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaFletesFactura()
End Sub
Private Sub CargaFletesFactura()
DdlIndirectoFactura.Items.Clear()
Dim ObjInventarios As New ClsInventarios
If DdlFletes.SelectedValue.ToEntero > 0 Then
If ObjInventarios.GetFletesCompras(DdlFletes.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
DdlIndirectoFactura.DataSource = ObjInventarios.DtResultados
Else
Alert("Ocurrió un error al obtener las Compras pendientes de recibir del proveedor. Por favor vuelva a intentar", TipoMensaje.MsgError)
End If
End If
ObjInventarios.Dispose()
DdlIndirectoFactura.DataBind()
DdlIndirectoFactura.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
#End Region
#Region " CARGA POR SURTIR - GV "
@@ -1119,7 +1145,7 @@ Partial Class Inventarios_RecepcionAlmacen
If ObjInventario.DtResultados.Rows.Count > 0 Then
CveFleteSurtir = pCveImportacion
CveFleteOrdenCompra = ObjInventario.DtResultados.Rows(0)("CveOC").ToString.ToEntero
CveFleteCompra = ObjInventario.DtResultados.Rows(0)("CveCompra").ToString.ToEntero
CveFleteCompra = DdlIndirectoFactura.SelectedValue.ToEntero 'ObjInventario.DtResultados.Rows(0)("CveCompra").ToString.ToEntero
CveImportacionCompra = CveFleteCompra ' se iguala para que al guardar el movimiento, se toma esta variable
LbProveedor.Text = ObjInventario.DtResultados.Rows(0)("RazonSocial").ToString
HLFolio.Text = ObjInventario.DtResultados.Rows(0)("Folio").ToString

View File

@@ -60,7 +60,7 @@
<asp:DropDownList ID="DdlEstatus" runat="server" CssClass=" form-control input-sm select2me" ValidationGroup="GrpFiltrar" Width="100%">
<asp:ListItem Value="-1">Todos</asp:ListItem>
<asp:ListItem Selected="True" Value="1">Activo</asp:ListItem>
<asp:ListItem Value="2">Inactivo</asp:ListItem>
<asp:ListItem Value="0">Inactivo</asp:ListItem>
</asp:DropDownList>
</div>

View File

@@ -1196,15 +1196,14 @@ Partial Class Clientes
End Sub
Private Sub CargaSubProyectoss()
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1).FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlSubProyecto.DataBind()
Private Sub CargaSubProyectoss()
'DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1).FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
'If UsuarioActual.CveSucursal = -1 Then
' DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
'Else
' DdlSubProyecto.SelectedValue = UsuarioActual.CveSucursal.ToString
'End If
DdlSubProyecto.DataBind()
End Sub
Private Sub CargaMetodosPago()
DdlMetodoPago.DataSource = GlobalDTMetodosPago.FiltraParametros("Estatus = 'Activo'", "ClaveSAT") '.FiltraParametros("CveMetodoPago > 0 ")

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,33 +327,42 @@ 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
Get
If CveEmpresa = -1 Then
GlobalDTProductosServicios = DirectCast(Application("GlobalDTProductosServicios"), EnumerableRowCollection(Of DataRow)).CopyToDataTable
Else
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 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))
'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
Catch ex As Exception
GlobalDTProductosServicios = New DataTable
End Try
End If
End Get
Set(value As DataTable)
Application("GlobalDTProductosServicios") = value
End Set
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
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))
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 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 AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta))
If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS))
Try
GlobalDTPSSimplificado = Cons.OrderBy(Function(a) a!PSCodigo).CopyToDataTable
Catch ex As Exception
GlobalDTPSSimplificado = New DataTable
End Try
Else
GlobalDTPSSimplificado = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable
End If
End Get
Set(value As DataTable)
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
Get
@@ -715,26 +725,39 @@ Public Class WSApp
End If
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()
Continuar = (CveTipoPS = 2 AndAlso Existencia > 0) OrElse (CveTipoPS = 1)
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
Next
Dim ObjPS As New ClsProductosServicios
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 = Existencia > 0
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 si es producto o servicio.")
End If
Next
Catch ex As Exception
OnError("Ocurrió un error al consultar la existencia", ex)
Continuar = False
End Try
ObjPS.Dispose()
If Continuar Then
@@ -1374,8 +1397,8 @@ Public Class WSApp
Row("Total") = (PS.Cantidad.Value * PS.Precio)
Row("TotalImporte") = Math.Round(PS.Cantidad.Value * PS.Precio, 2)
Row("SATClaveProdServ") = DrPS("SATClavePS")
Row("SATClaveProdServ") = DrPS("SATClavePS")
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
Row("EntregaDirecta") = EntregaDirecta