diff --git a/AF/AF.aspx.vb b/AF/AF.aspx.vb index f4cf2ee95..d5be1124a 100644 --- a/AF/AF.aspx.vb +++ b/AF/AF.aspx.vb @@ -105,6 +105,14 @@ Partial Class AF_AF Set(value As Integer) ViewState("AFInvCveAlmacen") = value End Set + End Property + Private Property AFInvCveSeccionAlmacen As Integer + Get + Return If(ViewState("AFInvCveSeccionAlmacen") Is Nothing, -1, ViewState("AFInvCveSeccionAlmacen").ToString.ToEntero()) + End Get + Set(value As Integer) + ViewState("AFInvCveSeccionAlmacen") = value + End Set End Property Private Property AFInvSerie As String Get @@ -2102,8 +2110,8 @@ Partial Class AF_AF If AFInvCvePS > 0 AndAlso AFInvCveAlmacen > 0 Then Dim CveUMInv = GlobalDTPS(CveEmpresaActual, CvePS:=AFInvCvePS).FiltroPrimeroValor("CveUM").ToEntero If CveUMInv > 0 Then - CveMovimientoSalidaInv = ObjInventarios.AddMovimiento(AFInvCveAlmacen, 3, 1, Now, -1, UsuarioActual.CveUsuario, CveEmpresaActual, -1, -1, -1, -1, Observaciones:=$"Salida de inventario para Activo Fijo | {TxtCodigo.Text.Trim}") - If Not ObjInventarios.AddMovimientoDetalle(CveMovimientoSalidaInv, 1, CveUMInv, AFInvCvePS, 0, -1, Serie:=AFInvSerie) Then + CveMovimientoSalidaInv = ObjInventarios.AddMovimiento(AFInvCveAlmacen, 3, 1, Now, -1, UsuarioActual.CveUsuario, CveEmpresaActual, -1, -1, -1, -1, Observaciones:=$"Salida de inventario para Activo Fijo | {TxtCodigo.Text.Trim}", Modulo:="AF1") + If Not ObjInventarios.AddMovimientoDetalle(CveMovimientoSalidaInv, 1, CveUMInv, AFInvCvePS, 0, -1, Serie:=AFInvSerie, CveSeccionAlmacen:=AFInvCveSeccionAlmacen) Then ErrorGuardar = True End If Else @@ -3051,6 +3059,7 @@ Partial Class AF_AF AFInvSerie = "" AFInvCvePS = -1 AFInvCveAlmacen = -1 + AFInvCveSeccionAlmacen = -1 Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlAFInvPS.SelectedValue.ToEntero).FiltroPrimero("") If DrPS Is Nothing Then Exit Sub @@ -3076,6 +3085,7 @@ Partial Class AF_AF AFInvSerie = "" AFInvCvePS = -1 AFInvCveAlmacen = -1 + AFInvCveSeccionAlmacen = -1 Alert("No hay existencias suficientes del producto. Por favor Verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") @@ -3094,7 +3104,7 @@ Partial Class AF_AF AFInvCvePS = DdlAFInvPS.SelectedValue.ToEntero AFInvCveAlmacen = DdlAFInvAlmacen.SelectedValue.ToEntero - + AFInvCveSeccionAlmacen = DdlSeccionAlmacen.SelectedValue.ToEntero RegistraScript("$('#ModalAFInv').modal('hide')", "hide") DivAFInvAdvertencia.Visible = True @@ -3652,12 +3662,12 @@ Partial Class AF_AF DivSeccion.Visible = CBool(drr("AplicaSeccion")) DdlSeccionAlmacen.Items.Clear() If CBool(drr("AplicaSeccion")) Then - CargaSeccionesAlmacen(DdlSeccionAlmacen, DdlAFInvAlmacen.SelectedValue.ToEntero, DdlAFInvPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) - 'Dim dtt As DataTable = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAFInvAlmacen.SelectedValue.ToEntero, DdlAFInvPS.SelectedValue.ToEntero) - 'DdlSeccionAlmacen.DataSource = dtt - 'DdlSeccionAlmacen.DataBind() + 'CargaSeccionesAlmacen(DdlSeccionAlmacen, DdlAFInvAlmacen.SelectedValue.ToEntero, DdlAFInvPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) + Dim dtt As DataTable = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAFInvAlmacen.SelectedValue.ToEntero, DdlAFInvPS.SelectedValue.ToEntero) + DdlSeccionAlmacen.DataSource = dtt + DdlSeccionAlmacen.DataBind() - 'dtt.Dispose() + dtt.Dispose() End If diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index b3d744b4c..c84577b78 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -3876,6 +3876,32 @@ Public Class ClsContabilidad Return Retorno End Function + + Public Function GetLibroDiario(FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + 'SqlAdapter.SelectCommand.t + + DataAdapter("PA_Conta_LibroDiario") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + SqlAdapter.SelectCommand.CommandTimeout = 0 + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al obtener libro diario", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + #End Region #Region "I N C O N S I S T E N C I A S" diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index f474affc2..40f6c1946 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4257,6 +4257,7 @@ Public Class ClsPaginas PaginaDict.Add("/Contabilidad2/RepAnexoCatalogoCC.aspx".ToUpper(), 594) PaginaDict.Add("/Contabilidad2/RepVariacionHaciendaPublica.aspx".ToUpper(), 595) PaginaDict.Add("/Contabilidad2/CatCuentas.aspx".ToUpper(), 596) + PaginaDict.Add("/Contabilidad2/RepLibroDiario.aspx".ToUpper(), 544) PaginaDict.Add("/Contabilidad2/RepSituacionFinancieraSAT.aspx".ToUpper(), 615) PaginaDict.Add("/Contabilidad2/RepEstadoActividadesSAT.aspx".ToUpper(), 616) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 58d72438a..5d65c848e 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -3146,6 +3146,8 @@ Partial Class Compras_Compras ViewState("CveProveedor") = ObjProveedor.CveProveedor ViewState("CveTipoProveedor") = ObjProveedor.CveTipoProveedor + If ObjProveedor.CveTipoProveedor = 1 Then LblProveedor.Text = "Proveedor:" Else LblProveedor.Text = "Acreedor:" + CveTipoConcepto = ObjProveedor.CveTipoProveedor 'Conta ContPAQ ViewState("CtaProveedor") = ObjProveedor.IdCtaContProveedores diff --git a/Contabilidad2/RepLibroDiario.aspx b/Contabilidad2/RepLibroDiario.aspx new file mode 100644 index 000000000..4224c2fa5 --- /dev/null +++ b/Contabilidad2/RepLibroDiario.aspx @@ -0,0 +1,104 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepLibroDiario.aspx.vb" Inherits="Contabilidad2_RepLibroDiario" %> + + + + + + + Libro Diario + + + + + + +
  • + Generar EXCEL +
  • +
  • + Imprimir +
  • +
    + + + + +
    +
    + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +
    + + + + + + + + + + +
    +
    + +
    +
    + + + + + + + + + + +
    +
    +
    +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    + + + diff --git a/Contabilidad2/RepLibroDiario.aspx.vb b/Contabilidad2/RepLibroDiario.aspx.vb new file mode 100644 index 000000000..3f01252dc --- /dev/null +++ b/Contabilidad2/RepLibroDiario.aspx.vb @@ -0,0 +1,144 @@ +Option Explicit On +Option Strict On +Imports System.Data +Imports Extensiones + +Partial Class Contabilidad2_RepLibroDiario + Inherits ClsPaginas + +#Region "PROPIEDADES" + Private Property DtDatos As DataTable + Get + DtDatos = DirectCast(ViewState("DtDatos"), DataTable) + End Get + + Set(ByVal value As DataTable) + ViewState("DtDatos") = value + End Set + End Property + Private Property FechaInicio As Date + Get + FechaInicio = ViewState("FechaInicio").ToString.ToDate + End Get + Set(value As Date) + ViewState("FechaInicio") = value + End Set + End Property + Private Property FechaFin As Date + Get + FechaFin = ViewState("FechaFin").ToString.ToDate + End Get + Set(value As Date) + ViewState("FechaFin") = value + End Set + End Property + +#End Region + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + + InicializaValores() + + BtnConsultar.Enabled = True + + End If + End Sub + + Private Sub InicializaValores() + + TxtFechaDel.Text = $"01/01/{Now.Year}" + TxtFechaAl.Text = Now.ToShortDateString + End Sub + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaDatos() + End Sub + +#Region "C A R G A - D A T O S" + Private Sub CargaDatos() + + FechaInicio = If(IsDate(TxtFechaDel.Text), TxtFechaDel.Text.ToDate, MinFecha) + FechaFin = If(IsDate(TxtFechaAl.Text), TxtFechaAl.Text.ToDate, MaxFecha) + + 'FechaInicio = New Date(2016, 1, 1) + 'FechaFin = New Date(2016, 1, 31) + + Dim ObjConta As New ClsContabilidad + If ObjConta.GetLibroDiario(FechaInicio, FechaFin, UsuarioActual.CveEmpresa) Then + DtDatos = ObjConta.DtResultados + Else + DtDatos = Nothing + End If + ObjConta.Dispose() + + GvDatos.DataSource = DtDatos + GvDatos.DataBind() + UpDatos.Update() + + If DtDatos IsNot Nothing Then + ImgExcel.Visible = True + Imprimir.Visible = True + + Else + ImgExcel.Visible = False + Imprimir.Visible = False + End If + + End Sub +#End Region + + Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + + ''CABECERA + 'If e.Row.DBCampo("TipoRenglon").ToString.ToEntero = 1 Then + ' e.Row.Font.Bold = True + ' e.Row.Cells(4).Text = "" + ' e.Row.Cells(5).Text = "" + ' e.Row.Cells(6).Text = "" + ' e.Row.Cells(7).Text = "" + ' e.Row.Cells(8).Text = "" + ' e.Row.CssClass = "SubTotales" ' + 'End If + + 'DETALLE + If e.Row.DBCampo("Codigo") <> "" Then + e.Row.Cells(0).Text = "" + e.Row.Cells(1).Text = "" + e.Row.Cells(2).Text = "" + e.Row.Cells(3).Text = "" + End If + + 'SUBTOTAL + If e.Row.DBCampo("Codigo") = "" Then + e.Row.Font.Bold = True + e.Row.Cells(0).Text = "" + e.Row.Cells(1).Text = "" + e.Row.Cells(2).Text = "" + e.Row.Cells(3).Text = "" + e.Row.Cells(4).Text = "" + e.Row.Cells(5).Text = "" + e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(6).Text = "Total:" + e.Row.CssClass = "SubTotales" + End If + + 'TOTAL + If e.Row.DBCampo("TipoRenglon").ToString.ToEntero = 4 Then + e.Row.Font.Bold = True + e.Row.Cells(0).Text = "" + e.Row.Cells(1).Text = "" + e.Row.Cells(2).Text = "" + e.Row.Cells(3).Text = "" + e.Row.Cells(4).Text = "" + e.Row.Cells(5).Text = "" + e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(6).Text = "Total:" + e.Row.CssClass = "Totales" + End If + + End If + End Sub + +End Class diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index c63564af6..af0790b36 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -1408,7 +1408,8 @@ Partial Class Inventarios_EntradasSalidas Else ErrorAC = True End If - + Else + ErrorAC = True End If End If diff --git a/Inventarios/PaquetesArmadoDesarmado.aspx b/Inventarios/PaquetesArmadoDesarmado.aspx index 403797160..bfd8a8fee 100644 --- a/Inventarios/PaquetesArmadoDesarmado.aspx +++ b/Inventarios/PaquetesArmadoDesarmado.aspx @@ -216,26 +216,21 @@
    - + - + - + - + - - - - - - + @@ -243,11 +238,12 @@ - + - + +
    @@ -488,7 +484,7 @@
    - + @@ -509,6 +505,11 @@ + + + + + diff --git a/Inventarios/PaquetesArmadoDesarmado.aspx.vb b/Inventarios/PaquetesArmadoDesarmado.aspx.vb index 8af94a12a..d76c06fd0 100644 --- a/Inventarios/PaquetesArmadoDesarmado.aspx.vb +++ b/Inventarios/PaquetesArmadoDesarmado.aspx.vb @@ -88,14 +88,16 @@ Partial Class Inventarios_PaquetesArmadoDesarmado ViewState("CveCliente") = value End Set End Property - Private Property CveTipoPS As Integer + + Private Property AplicaSerie As Boolean Get - Return CType(ViewState("CveTipoPS"), Integer) + Return CType(ViewState("AplicaSerie"), Boolean) End Get - Set(value As Integer) - ViewState("CveTipoPS") = value + Set(value As Boolean) + ViewState("AplicaSerie") = value End Set End Property + Private Property DtSeriesDesarmado As DataTable Get Return CType(ViewState("DtSeriesDesarmado"), DataTable) @@ -208,7 +210,9 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Dim ObjProductosServicios As New ClsProductosServicios Dim DtDatos As New DataTable - Dim CveUMTemp = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteArmado.SelectedValue.ToEntero).FiltroPrimeroValor("CveUM").ToEntero + Dim drP As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteArmado.SelectedValue.ToEntero).FiltroPrimero("") + Dim AplicaSerie As Boolean = False + Dim CveUMTemp = drP("CveUM").ToString.ToEntero If ObjProductosServicios.GetPaqueteDetalle(DdlPaqueteArmado.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, CveUMTemp, TxtCantidadArmado.Text.ToDouble, DdlAlmacenArmado.SelectedValue.ToEntero, TxtFechaArmado.Text.ToDate, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) Then DtDatos = ObjProductosServicios.DtResultados.FiltraParametros("CveTipoPS = 2").Copy Else @@ -240,15 +244,15 @@ Partial Class Inventarios_PaquetesArmadoDesarmado End If Next - Dim AplicaSerie As String = "" + If ErrorExistencias Then Alert(TextoExistencias, TipoMensaje.MsgAdvertencia) Else - AplicaSerie = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteArmado.SelectedValue.ToEntero).FiltroPrimeroValor("AplicaSerie") + AplicaSerie = CBool(drP("AplicaSerie")) BtnGuadarArmado.Visible = True End If - If AplicaSerie = "True" Then + If AplicaSerie Then DivSeriesPaqueteArmado.Visible = True Dim Dt As New DataTable Dt.Columns.Add("Row", GetType(Integer)) @@ -274,9 +278,14 @@ Partial Class Inventarios_PaquetesArmadoDesarmado GvDatosArmado.DataSource = DtDatos GvDatosArmado.DataBind() - If ErrorExistencias Then - GvDatosArmado.Columns(4).Visible = False - End If + GvDatosArmado.Columns(5).Visible = DtDatos.MAX("AplicaSeccion") = "True" + 'GvDatosArmado.Columns(6).Visible = DtDatos.MAX("Serie", "") <> "" + GvDatosArmado.Columns(6).Visible = False 'DtDatos.MAX("Lote", "") <> "" + GvDatosArmado.Columns(7).Visible = False 'DtDatos.MAX("FechaCaducidad", "FechaCaducidad is not null").ToDate > MinFecha + + 'If ErrorExistencias Then + ' GvDatosArmado.Columns(4).Visible = False + 'End If UpDatosArmado.Update() UpGeneralesArmado.Update() @@ -285,7 +294,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado DtDatosDetalle.Clear() BtnGuadarDesarmado.Visible = False TotalDesarmado.Visible = False - CveTipoPS = -1 + AplicaSerie = False TxtSerieDesarmado.Text = "" CvePaqueteDesarmado = -1 TipoMovimiento = 2 @@ -299,7 +308,9 @@ Partial Class Inventarios_PaquetesArmadoDesarmado BtnAgregarSerieDesarmado.Enabled = True - Dim CveUMTemp = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteDesarmado.SelectedValue.ToEntero).FiltroPrimeroValor("CveUM").ToEntero + Dim drP As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteDesarmado.SelectedValue.ToEntero).FiltroPrimero("") + + Dim CveUMTemp = drP("CveUM").ToString.ToEntero CveVendedor = If(RowApartadosDesarmado.Visible, DdlVendedorDesarmado.SelectedValue.ToEntero, -1) CveCliente = If(RowClienteDesarmado.Visible, DdlClienteDesarmado.SelectedValue.ToEntero, -1) Dim FechaFin As String = TxtFechaDesarmado.Text.ToDateTime.ToString("yyyy/MM/dd 23:59") @@ -314,7 +325,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Alert($"No hay existencia suficiente del paquete ""{DdlPaqueteDesarmado.SelectedItem.Text}"" para desarmar. Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) Exit Sub Else - CveTipoPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteDesarmado.SelectedValue.ToEntero).FiltroPrimeroValor("Inv_CveMetodoInventario").ToEntero + AplicaSerie = CBool(drP("AplicaSerie")) End If @@ -343,8 +354,8 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Next End If - If CveTipoPS = 5 Then - GvDatosDesarmado.Columns(4).Visible = True + If AplicaSerie Then + DivSeriesPaqueteDesarmado.Visible = True CreaDtSeriesDesarmado() DtSeriesDesarmado.Clear() @@ -363,6 +374,9 @@ Partial Class Inventarios_PaquetesArmadoDesarmado GvDatosDesarmado.DataSource = DtDatos GvDatosDesarmado.DataBind() + GvDatosDesarmado.Columns(4).Visible = CBool(DtDatos.MAX("AplicaSerie")) + GvDatosDesarmado.Columns(5).Visible = CBool(DtDatos.MAX("AplicaSeccion")) + BtnGuadarDesarmado.Visible = True TotalDesarmado.Visible = True @@ -404,7 +418,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Select Case (Tipo) Case 1 ' ARMADO For Each gvr As GridViewRow In GvDatosArmado.Rows - If gvr.DataKey("Inv_CveMetodoInventario").ToEntero = 5 Then + If gvr.DataKey("AplicaSerie") = "True" Then If gvr.DataKey("Cantidad").ToEntero <> DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec"))).Rows.Count Then Alert("Es necesario ingresas todas las series de los componentes.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -413,7 +427,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Next Case 2 ' DESARMADO For Each gvr As GridViewRow In GvDatosDesarmado.Rows - If gvr.DataKey("Inv_CveMetodoInventario").ToEntero = 5 Then + If gvr.DataKey("AplicaSerie") = "True" Then If gvr.DataKey("Cantidad").ToEntero <> DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec"))).Rows.Count Then Alert("Es necesario ingresas todas las series de los componentes.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -423,7 +437,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado End Select 'VALIDA SI EL PAQUETE ES DE SERIE QUE SE INGRESEN TODAS LAS SERIES (CANTIDAD) - If CveTipoPS = 5 Then + If AplicaSerie Then Select Case (Tipo) Case 1 ' ARMADO For Each gvr As GridViewRow In GvSeriesPaqueteArmado.Rows @@ -458,7 +472,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Case 1 ' ARMADO 'SALIDA COMPONENTES - CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenArmado, 5, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesArmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) + CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenArmado, 5, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesArmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), Modulo:="ARMPAQ1") FolioSalida = ObjInventario.Folio If CveMovimientoSalida <= 0 Then @@ -472,7 +486,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Dim Lote As String = If(Gvr.FCTextBox("TxtLote").Text = "", "-1", Gvr.FCTextBox("TxtLote").Text) Dim FechaCaducidad As String = If(Gvr.FCTextBox("TxtCaducidad").Text = "", "-1", Gvr.FCTextBox("TxtCaducidad").Text) Dim CveSeccionAlmacen As Integer = Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero() - If Gvr.DataKey("Inv_CveMetodoInventario").ToString.ToEntero = 5 Then + If CBool(Gvr.DataKey("AplicaSerie")) Then For Each Dr As DataRow In DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec").ToEntero)).Rows If Not ObjInventario.GetExistenciasPS(Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenArmado.SelectedValue.ToEntero, FechaMovto:=Fecha.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Dr("Serie").ToString, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) >= 1 Then MensajeError = String.Format("El Producto {0} con Serie: {1} no tiene existencia suficiente", Dr("PS"), Dr("Serie")) @@ -506,7 +520,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado 'ENTRADA PAQUETE If Not TieneError Then - CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenArmado, 19, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesArmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), CveMovimientoRelacionado:=CveMovimientoSalida) + CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenArmado, 19, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesArmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="ARMPAQ2") FolioEntrada = ObjInventario.Folio If CveMovimientoEntrada <= 0 Then @@ -520,14 +534,22 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Next PUTemp = PUTemp / LbCantidadArmado.Text.ToDecimal Dim CvePSTemp = CvePaqueteArmado - Dim CveUMTemp = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteArmado).FiltroPrimeroValor("CveUM").ToEntero + Dim CveSeccionAlmacen As Integer = -1 + Dim Drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteArmado).FiltroPrimero("") - If CveTipoPS = 5 Then + Dim CveUMTemp As Integer = Drp("CveUM").ToString.ToEntero + Dim AplicaSeccion As Boolean = CBool(Drp("AplicaSeccion")) + If AplicaSeccion Then + CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenArmado, CvePaqueteArmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero + End If + + + If AplicaSerie Then Dim ContadorPaquete = 1 Dim DtSeriesComponentes As New DataTable For Each Gvr As GridViewRow In GvSeriesPaqueteArmado.Rows 'AGREGA MOVTO DETALLE DE LA ENTRADA DEL PAQUETE - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 1, CveUMTemp, CvePSTemp, PUTemp, -1, Serie:=Gvr.FCTextBox("TxtSerie").Text.Trim) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 1, CveUMTemp, CvePSTemp, PUTemp, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Gvr.FCTextBox("TxtSerie").Text.Trim) Then TieneError = True MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de entrada" Exit For @@ -535,7 +557,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado 'INGRESA EN TABLA DE CONTROL DE PAQUETES CON SERIE For Each Gvr2 As GridViewRow In GvDatosArmado.Rows - If Gvr2.DataKey("Inv_CveMetodoInventario").ToString.ToEntero = 5 Then + If CBool(Gvr2.DataKey("AplicaSerie")) Then DtSeriesComponentes = New DataTable DtSeriesComponentes = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr2.DataKey("Consec").ToEntero)).Copy Dim CantidadComponente = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr2.DataKey("Consec").ToEntero)).Rows.Count / LbCantidadArmado.Text.ToEntero @@ -552,7 +574,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado ContadorPaquete = ContadorPaquete + 1 Next Else - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, LbCantidadArmado.Text.ToDouble, CveUMTemp, CvePSTemp, PUTemp, -1) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, LbCantidadArmado.Text.ToDouble, CveUMTemp, CvePSTemp, PUTemp, CveSeccionAlmacen:=CveSeccionAlmacen) Then TieneError = True MensajeError = "Ocurrió un error al guardar los detalles del movimiento de entrada" End If @@ -569,7 +591,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado 'SALIDA PAQUETE - CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenDesarmado, 20, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesDesarmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) + CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenDesarmado, 20, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesDesarmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), Modulo:="ARMPAQ3") FolioSalida = ObjInventario.Folio If CveMovimientoSalida <= 0 Then @@ -579,12 +601,18 @@ Partial Class Inventarios_PaquetesArmadoDesarmado End If Dim CvePSTemp = CvePaqueteDesarmado - Dim CveUMTemp = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimeroValor("CveUM").ToEntero + Dim CveSeccionAlmacen As Integer = -1 + Dim Drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimero("") - If CveTipoPS = 5 Then + Dim CveUMTemp As Integer = Drp("CveUM").ToString.ToEntero + Dim AplicaSeccion As Boolean = CBool(Drp("AplicaSeccion")) + If AplicaSeccion Then + CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenDesarmado, CvePaqueteDesarmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero + End If + If AplicaSerie Then For Each Gvr As GridViewRow In GvSeriesPaqueteDesarmado.Rows 'AGREGA MOVTO DETALLE DE LA SALIDA DEL PAQUETE - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, CveUMTemp, CvePSTemp, 0, -1, Serie:=Gvr.DataKey("Serie").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, CveUMTemp, CvePSTemp, 0, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Gvr.DataKey("Serie").ToString) Then TieneError = True MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de salida" Exit For @@ -598,7 +626,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado End If Next Else - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, TxtCantidadDesarmado.Text.ToDouble, CveUMTemp, CvePSTemp, 0, -1) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, TxtCantidadDesarmado.Text.ToDouble, CveUMTemp, CvePSTemp, 0, CveSeccionAlmacen:=CveSeccionAlmacen) Then TieneError = True MensajeError = "Ocurrió un error al guardar los movimientos de salida" End If @@ -607,7 +635,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado 'ENTRADA COMPONENTES If Not TieneError Then - CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenDesarmado, 4, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesDesarmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), CveMovimientoRelacionado:=CveMovimientoSalida) + CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenDesarmado, 4, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesDesarmado.Text, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="ARMPAQ4") FolioEntrada = ObjInventario.Folio If CveMovimientoEntrada <= 0 Then @@ -616,16 +644,20 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Else For Each Gvr As GridViewRow In GvDatosDesarmado.Rows If Gvr.DataKey("Cantidad").ToString.ToDouble > 0 Then - If Gvr.DataKey("Inv_CveMetodoInventario").ToString.ToEntero = 5 Then + If CBool(Gvr.DataKey("AplicaSeccion")) Then + CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenDesarmado, CvePaqueteDesarmado).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero + End If + + If CBool(Gvr.DataKey("AplicaSerie")) Then For Each Dr As DataRow In DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec").ToEntero)).Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 1, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.FCTextBox("TxtCosto").Text.ToDecimal, -1, Serie:=Dr("Serie").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 1, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.FCTextBox("TxtCosto").Text.ToDecimal, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString) Then MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de entrada. Por favor vuelva a intentar." TieneError = True Exit For End If Next Else - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Gvr.DataKey("Cantidad").ToString.ToDouble, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.FCTextBox("TxtCosto").Text.ToDecimal, -1) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Gvr.DataKey("Cantidad").ToString.ToDouble, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.FCTextBox("TxtCosto").Text.ToDecimal, CveSeccionAlmacen:=CveSeccionAlmacen) Then MensajeError = "Ocurrió un error al guardar los detalles del movimiento de entrada. Por favor vuelva a intentar." TieneError = True Exit For @@ -662,7 +694,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Private Sub Limpia(Tipo As Integer) DtDatosDetalle.Clear() - CveTipoPS = -1 + AplicaSerie = False 'If Tipo = 1 Then @@ -719,20 +751,18 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Protected Sub GvDatosArmado_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosArmado.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("Inv_CveMetodoInventario") = "5" Then + If CBool(e.Row.DBCampo("AplicaSerie")) Then e.Row.FCButton("BtnSerie").Visible = True e.Row.FCButton("BtnSerie").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°1", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PS"), e.Row.DBCampo("Cantidad"), e.Row.DBCampo("Consec")) e.Row.FCLinkButton("BtnSeriePaquete").CommandArgument = e.Row.DBCampo("Consec") 'Dim Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DBCampo("Consec"))).Rows.Count 'e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString - If CveTipoPS = 5 Then + If AplicaSerie Then e.Row.FCLinkButton("BtnSeriePaquete").Visible = True e.Row.FCLinkButton("BtnSeriePaquete").Attributes.Add("data-toggle", "tooltip") End If - GvDatosArmado.Columns(4).Visible = True - Else e.Row.FCButton("BtnSerie").Visible = False End If @@ -740,16 +770,14 @@ Partial Class Inventarios_PaquetesArmadoDesarmado If e.Row.DataKey("AplicaSeccion") = "False" Then e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False Else - e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1) - e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind() - e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) + CargaSeccionesAlmacen(e.Row.FCDropDownList("DdlSeccionAlmacen"), DdlAlmacenArmado.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero, UsuarioActual.CveEmpresa) + End If e.Row.FCTextBox("TxtCaducidad").Visible = e.Row.DataKey("AplicaCaducidad") = "True" e.Row.FCTextBox("TxtLote").Visible = e.Row.DataKey("AplicaLote") = "True" - e.Row.FCTextBox("TxtSerie").Visible = e.Row.DataKey("AplicaSerie") = "True" ''FUNCIONALIDAD PISTOLA DE CODIGOS 'If UsuarioActual.Empresa.Funcionalidad(132) = "1" And e.Row.DBCampo("CodigoBarras").Trim <> "" Then ' e.Row.FCTextBox("TbCantidadF").Enabled = False @@ -763,13 +791,17 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Protected Sub GvDatosDesarmado_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosDesarmado.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("Inv_CveMetodoInventario") = "5" Then + If CBool(e.Row.DBCampo("AplicaSerie")) Then e.Row.FCButton("BtnSerie").Visible = True e.Row.FCButton("BtnSerie").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°2", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PS"), e.Row.DBCampo("Cantidad"), e.Row.DBCampo("Consec")) Else e.Row.FCButton("BtnSerie").Visible = False End If - + If e.Row.DataKey("AplicaSeccion") = "False" Then + e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False + Else + CargaSeccionesAlmacen(e.Row.FCDropDownList("DdlSeccionAlmacen"), DdlAlmacenDesarmado.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero, UsuarioActual.CveEmpresa) + End If e.Row.FCTextBox("TxtCosto").Attributes.Add("onkeyup", "SumaValores();") diff --git a/Inventarios/RepTraspasoAlmacen.aspx b/Inventarios/RepTraspasoAlmacen.aspx index fb7c223f9..51762e3f8 100644 --- a/Inventarios/RepTraspasoAlmacen.aspx +++ b/Inventarios/RepTraspasoAlmacen.aspx @@ -204,13 +204,13 @@ + data-sort="true" GridLines="None"> - - - - + + + + diff --git a/Inventarios/RepTraspasoAlmacen.aspx.vb b/Inventarios/RepTraspasoAlmacen.aspx.vb index 56ec9a426..dfcf7ef57 100644 --- a/Inventarios/RepTraspasoAlmacen.aspx.vb +++ b/Inventarios/RepTraspasoAlmacen.aspx.vb @@ -77,7 +77,7 @@ Partial Class RepTraspasoAlmacen If ObjInventarios.RepTraspasoAlmacen(FechaI.ToDate, FechaF.ToDate, DdlAlmacenOrigen.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero, ChkRecibido.Checked, UsuarioActual.CveEmpresa) Then GvDatos.DataSource = ObjInventarios.DtResultados DtInventarios = ObjInventarios.DtResultados - + GvDatos.Columns(4).Visible = DtInventarios.MAX("Serie") <> "" End If ObjInventarios.Dispose() diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 49dd41818..be7031de6 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -1799,13 +1799,12 @@ Partial Class OC DdlProyectoContrato.Items.Insert(0, New ListItem("Seleccione", "-1")) End Sub Private Sub CargaSubProyectos() - Dim Filtro As String = If(DdlProyecto.SelectedValue.ToEntero > 0, String.Format("CveProyecto = {0}", DdlProyecto.SelectedValue.ToEntero), "") + Dim Filtro As String = If(DdlProyecto.SelectedValue.ToEntero > 0 AndAlso UsuarioActual.Empresa.Tipo_CentroCosto.Contiene(4, 5), String.Format("CveProyecto = {0}", DdlProyecto.SelectedValue.ToEntero), "") DdlSubProyecto.Items.Clear() - If Filtro <> "" Or UsuarioActual.Empresa.Tipo_CentroCosto = 1 Or UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then - DdlSubProyecto.DataSource = DtEstatusUsuarios.FiltraParametros(Filtro, "", {"CveSubProyecto", "SubProyecto"}) 'If(UsuarioActual.Empresa.Funcionalidad(102) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, DdlProyecto.SelectedValue.ToEntero, CveEmpresaActual, -1, 1), GlobalDTSubProyectos(DdlProyecto.SelectedValue.ToEntero, -1, CveEmpresaActual, 1)) 'DtEstatusUsuarios.FiltraParametros(Filtro, "", {"CveSubProyecto", "SubProyecto"}) ' GlobalDTSubProyectos(DdlProyecto.SelectedValue.ToEntero) - End If + DdlSubProyecto.DataSource = DtEstatusUsuarios.FiltraParametros(Filtro, "", {"CveSubProyecto", "SubProyecto"}) 'If(UsuarioActual.Empresa.Funcionalidad(102) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, DdlProyecto.SelectedValue.ToEntero, CveEmpresaActual, -1, 1), GlobalDTSubProyectos(DdlProyecto.SelectedValue.ToEntero, -1, CveEmpresaActual, 1)) 'DtEstatusUsuarios.FiltraParametros(Filtro, "", {"CveSubProyecto", "SubProyecto"}) ' GlobalDTSubProyectos(DdlProyecto.SelectedValue.ToEntero) DdlSubProyecto.DataBind() + DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1")) End Sub Private Sub CargaSubProyectosEdit(DdlSP As DropDownList, CveProyectoEdit As Integer) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 90183a6fb..c99cb1fd4 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -10953,7 +10953,7 @@ Partial Class Ventas If ObjFactura.TipoDocto.Contiene("Egs") Then IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() Else - IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() + IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaDescuento", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero() End If If importeMovimiento <> 0 Then