diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index f58fdce07..016bdbaee 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -404,7 +404,7 @@ Public Class ClsProductosServicios Optional CveFraccionArancelaria As Integer = -1, Optional CveClasificacionDetalle As Integer = -1, Optional CveTamaño As Integer = -1, Optional CveModelo As Integer = -1, Optional CveMedida As Integer = -1, Optional CveRinTamaño As Integer = -1, Optional ClaveImpuestoEmpaque As String = "", Optional ClaveImpuestoUM As String = "", Optional ClaveCategoriaToxicidad As String = "", Optional ClaveImpuestoTipoProducto As String = "", Optional Litraje As Double = -1, Optional EsOutSourcing As Boolean = False, Optional AplicaSerie As Boolean = False, Optional AplicaLote As Boolean = False, - Optional AplicaCaducidad As Boolean = False, Optional AplicaSeccion As Boolean = False, Optional TiempoCaducidad As Integer = -1) As Integer + Optional AplicaCaducidad As Boolean = False, Optional AplicaSeccion As Boolean = False, Optional TiempoCaducidad As Integer = -1, Optional CvePSAdicionalVigencia As Integer = -1) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_ProductosServiciosAdd") @@ -483,7 +483,9 @@ Public Class ClsProductosServicios .Add("@AplicaLote", SqlDbType.Bit).Value = AplicaLote .Add("@AplicaCaducidad", SqlDbType.Bit).Value = AplicaCaducidad .Add("@AplicaSeccion", SqlDbType.Bit).Value = AplicaSeccion - .Add("@TiempoCaducidad", SqlDbType.SmallInt).Value = TiempoCaducidad + .Add("@TiempoCaducidad", SqlDbType.SmallInt).Value = TiempoCaducidad + + .Add("@CvePSAdicionalVigencia", SqlDbType.Int).Value = CvePSAdicionalVigencia End With Try @@ -630,7 +632,7 @@ Public Class ClsProductosServicios Optional CveFraccionArancelaria As Integer = -1, Optional CveUsuarioModifico As Integer = -1, Optional CveClasificacionDetalle As Integer = -1, Optional CveTamaño As Integer = -1, Optional CveModelo As Integer = -1, Optional CveMedida As Integer = -1, Optional CveRinTamaño As Integer = -1, Optional ClaveImpuestoEmpaque As String = "", Optional ClaveImpuestoUM As String = "", Optional ClaveCategoriaToxicidad As String = "", Optional ClaveImpuestoTipoProducto As String = "", Optional Litraje As Double = -1, Optional EsOutSourcing As Boolean = False, - Optional AplicaSerie As Boolean = False, Optional AplicaLote As Boolean = False, Optional AplicaCaducidad As Boolean = False, Optional AplicaSeccion As Boolean = False, Optional TiempoCaducidad As Integer = -1) As Boolean + Optional AplicaSerie As Boolean = False, Optional AplicaLote As Boolean = False, Optional AplicaCaducidad As Boolean = False, Optional AplicaSeccion As Boolean = False, Optional TiempoCaducidad As Integer = -1, Optional CvePSAdicionalVigencia As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -711,7 +713,9 @@ Public Class ClsProductosServicios .Add("@AplicaLote", SqlDbType.Bit).Value = AplicaLote .Add("@AplicaCaducidad", SqlDbType.Bit).Value = AplicaCaducidad .Add("@AplicaSeccion", SqlDbType.Bit).Value = AplicaSeccion - .Add("@TiempoCaducidad", SqlDbType.SmallInt).Value = TiempoCaducidad + .Add("@TiempoCaducidad", SqlDbType.SmallInt).Value = TiempoCaducidad + + .Add("@CvePSAdicionalVigencia", SqlDbType.Int).Value = CvePSAdicionalVigencia End With Try diff --git a/Inventarios/EntradasSalidas.aspx b/Inventarios/EntradasSalidas.aspx index 1bcb1d186..a58d3a14d 100644 --- a/Inventarios/EntradasSalidas.aspx +++ b/Inventarios/EntradasSalidas.aspx @@ -1,1591 +1,1754 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="EntradasSalidas.aspx.vb" Inherits="Inventarios_EntradasSalidas" EnableEventValidation="false" %> - - -<%@ Register Assembly="eWorld.UI" Namespace="eWorld.UI" TagPrefix="ew" %> - - - - - - - - - Registro de movimientos - - - - -
  • - PDF -
  • -
  • - Descargar XML SAT -
  • -
  • - Descargar PDF SAT -
  • -
  • - Descargar Carta Porte -
  • -
  • - Traspaso Almacen -
  • -
  • - -
  • -
  • - Ver PrePóliza -
  • -
  • - -
  • -
  • - -
  • -
  • - Cargar Concepto -
  • -
  • - -
  • -
    -
    -
    - - - - - <%--FILTROS--%> - - - -
    -
    -
    - -
    -
    -
    +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="EntradasSalidas.aspx.vb" Inherits="Inventarios_EntradasSalidas" EnableEventValidation="false" %> + + +<%@ Register Assembly="eWorld.UI" Namespace="eWorld.UI" TagPrefix="ew" %> + + + + + + + + + Registro de movimientos + + + + +
  • + PDF +
  • +
  • + Descargar XML SAT +
  • +
  • + Descargar PDF SAT +
  • +
  • + Descargar Carta Porte +
  • +
  • + Traspaso Almacen +
  • +
  • + +
  • +
  • + Ver PrePóliza +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + Cargar Concepto +
  • +
  • + +
  • +
    +
    +
    + + + + + <%--FILTROS--%> + + + +
    +
    +
    + +
    +
    +
    <%--
    -
    --%> - -
    - -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    - - - - -
    -
    -
    -
    - "> - -
    -
    +
    --%> + +
    + +
    + +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    + +
    + + + + +
    +
    +
    +
    + "> + +
    +
    Información del movimiento -
    -
    -
    > -
    -
    - - -
    - - - -
    - -
    - - - -
    -
    - -
    - -
    - -
    - -
    -
    - -
    - -
    - - - - - -
    -
    -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    - -
    - - -
    - -
    -
    - -
    - -
    -
    -
    - - - - - - - - - - - - - - -
    -
    -
    - - - -
    - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - - <%----%> -
    -
    -
    -
    +
    +
    > +
    +
    + + +
    + + + +
    + +
    + + + +
    +
    + +
    + +
    + +
    + +
    +
    + +
    + +
    + + + + + +
    +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    + + +
    + +
    +
    + +
    + +
    +
    +
    + + + + + + + + + + + + + + +
    +
    +
    + + + +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + + <%----%> +
    +
    +
    + -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - Proyecto: -
    - - - -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - - - - - <%--INVENTARIO INICIAL--%> - - -
    -
    -
    -
    - "> -
    -
    + + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + Proyecto: +
    + + + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    + +
    +
    + + <%--INVENTARIO INICIAL--%> + + +
    +
    +
    +
    + "> +
    +
    Agregar Producto -
    -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - - - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - - - - -
    - -
    -
    -
    - "> - -
    -
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + + + + + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + + + + + + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + + + + +
    + +
    +
    +
    + "> + +
    +
    Información de registro -
    -
    -
    -
    -
    +
    +
    +
    + -
    - -
    - -
    -
    - +
    + +
    + +
    +
    + -
    - -
    -
    -
    - +
    + +
    +
    +
    + -
    - Ver Compra - Ver Venta - Ver Póliza - Ver Orden Compra - -
    -
    -
    - +
    + Ver Compra + Ver Venta + Ver Póliza + Ver Orden Compra + +
    +
    +
    + -
    - - <%----%> -
    -
    -
    - +
    + + <%----%> +
    +
    +
    + -
    - -
    -
    -
    - +
    + +
    +
    +
    + -
    - ver -
    -
    -
    - -
    - -
    -
    -
    - "> - -
    -
    + + +
    + ver +
    +
    +
    + +
    + +
    +
    +
    + "> + +
    +
    Tipo de Cambio -
    -
    -
    - - - - - - - - - - - - -
    Moneda: - - - - - - -
    Tipo de Cambio: - - - -
    - -
    -
    -
    - - -
    -
    -
    - -
    - - - -
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    -
    -
    -
    -
    - - - - + +
    +
    +
    + + + + + + + + + + + + +
    Moneda: + + + + + + +
    Tipo de Cambio: + + + +
    + +
    +
    +
    + + +
    +
    +
    + + + + + +
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    +
    +
    +
    +
    + + + + <%--
    -
    --%> - -
    -
    - - " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
    -
    - - - - - - - -
    - - - <%-- EMPIEZA: BITACORA --%> - - - -
    -
    -
    - Bitácora -
    -
    -
    -
    - - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -
    - -
    - - - -
    -
    - <%-- TERMINA: BITACORA --%> -
    -
    - - - - - - - - - - - - - - - -
    - + + + + + + + + + + + + + + + - - + + diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 84dc61700..f06097173 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -43,6 +43,23 @@ Partial Class Inventarios_EntradasSalidas ViewState("DtMovimientosSalidaInvFisico") = value End Set End Property + Public Property DtMovimientosEntradaCambioVigencias() As DataTable + Get + Return CType(ViewState("DtMovimientosEntradaCambioVigencias"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtMovimientosEntradaCambioVigencias") = value + End Set + End Property + + Public Property DtMovimientosCambioVigencias() As DataTable + Get + Return CType(ViewState("DtMovimientosCambioVigencias"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtMovimientosCambioVigencias") = value + End Set + End Property Public Property CveMovimiento() As Integer Get @@ -366,11 +383,13 @@ Partial Class Inventarios_EntradasSalidas End If + 'HABILITA EL CAMBIO DE VIGENCIAS + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + LnkCambioVigencia.Visible = True + End If + End If - - - End Sub #Region " PERMISOS PAGINAS " @@ -470,9 +489,16 @@ Partial Class Inventarios_EntradasSalidas CargaGVM(dt) DtMovimientos = dt.Clone + DtMovimientosEntradaInvFisico = dt.Clone DtMovimientosSalidaInvFisico = dt.Clone + DtMovimientosCambioVigencias = dt.Clone + DtMovimientosCambioVigencias.Columns.Add("CvePSVigencia", Type.GetType("System.Int32")) + DtMovimientosCambioVigencias.Columns.Add("CodigoPSVigencia", Type.GetType("System.String")) + DtMovimientosCambioVigencias.Columns.Add("CveUMVigencia", Type.GetType("System.Int32")) + + End Sub Private Sub CargaCombos() 'Llenar el dropdownlist de Secciones @@ -515,15 +541,19 @@ Partial Class Inventarios_EntradasSalidas End If DdlAlmacenInventarioFisico.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen NOT IN (9,11)") 'GlobalDTAlmacen(UsuarioActual.CveEmpresa) + DdlAlmacenCambioVigencias.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen NOT IN (9,11)") DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlAlmacenInventarioFisico.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlAlmacenCambioVigencias.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlAlmacen.SelectedValue = "-1" DdlAlmacenInventarioFisico.SelectedValue = "-1" + DdlAlmacenCambioVigencias.SelectedValue = "-1" DdlAlmacen.DataBind() DdlAlmacenInventarioFisico.DataBind() + DdlAlmacenCambioVigencias.DataBind() If IsNothing(Request("CveMovimiento")) Then DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) @@ -546,6 +576,7 @@ Partial Class Inventarios_EntradasSalidas DdlProducto2.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") DdlPSSalida.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + DdlPSCambioSalida.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") If UsuarioActual.CveEmpresa = 66 Then DdlProducto2.ddlWS.Attributes.Add("data-pagina", "Inventarios") @@ -555,14 +586,17 @@ Partial Class Inventarios_EntradasSalidas DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2") DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2") DdlPSSalida.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2") + DdlPSCambioSalida.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2") DdlProducto2.DataBind() DdlPS.DataBind() DdlPSSalida.DataBind() + DdlPSCambioSalida.DataBind() DdlProducto2.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlPSSalida.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlPSCambioSalida.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) End If End Sub @@ -2492,7 +2526,7 @@ Partial Class Inventarios_EntradasSalidas 'codigo provisional, hay entradas con productos, que al asignar serie, debe de tener e ncantidad = 1 If GvRow.DataKey("Cantidad").ToEntero() > 1 Then txtCantidad.Enabled = True End If - txtCantidad.Text = GvRow.DataKey("Cantidad").ToEntero().ToString + txtCantidad.Text = GvRow.DataKey("Cantidad").ToEntero().ToString DdlProducto2.SelectedValue = GvRow.DataKey("CvePS") DdlProducto2.SelectedText = GvRow.DataKey("CodigoPS") ElProductoChange() @@ -2653,6 +2687,25 @@ Partial Class Inventarios_EntradasSalidas #Region " CONTABILIZAR " + + Public Function ContabilizaMovimientoAlmacen(ByRef ObjConta As ClsContabilidad, Fecha As Date, Concepto As String, Modulo As String, CveMovimientoSalida As Integer, CveMovimientoEntrada As Integer, Importe As Decimal, CveUsuario As Integer, CveEmpresa As Integer, Contabilizable As Boolean) As Integer + Dim Retorno As Integer = -1 + Dim ErrorMovInv As Boolean = False + + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas(Modulo, 53, 0, 0, 1, Fecha, Concepto, CveUsuario, CveEmpresa) + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, "", 68, Concepto, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=Importe, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, "", 68, Concepto, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=Importe, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + End If + + If Not ErrorMovInv Then Retorno = CvePrePoliza + + Return Retorno + End Function + Protected Sub BtnContabilizar_Click(sender As Object, e As EventArgs) Handles BtnContabilizar.Click Dim ObjContaAC As ClsContPAQi = Nothing Dim ObjInventario As New ClsInventarios @@ -3609,6 +3662,10 @@ Partial Class Inventarios_EntradasSalidas RegistraScript(String.Format("$('#{0}').modal();", "DivModalCambioFisico")) End Sub + Protected Sub LnkCambioVigencia_Click(sender As Object, e As EventArgs) + RegistraScript(String.Format("$('#{0}').modal();", "DivModalCambiarVigencias")) + End Sub + #Region "ENTRADAS" Private Sub BtnAgregarEntrada_Click(sender As Object, e As EventArgs) Handles BtnAgregarEntrada.Click If Not DdlPS.SelectedValue.ToEntero > 0 Then @@ -3809,6 +3866,127 @@ Partial Class Inventarios_EntradasSalidas CargaGvSalidas(DtMovimientosSalidaInvFisico) End Sub + +#End Region + +#Region "CAMBIO VIGENCIA" + Private Sub LnkAddSalidaCambio_Click(sender As Object, e As EventArgs) Handles LnkAddSalidaCambio.Click + If Not DdlPSCambioSalida.SelectedValue.ToEntero > 0 Then + RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") + Alert("Es necesario especificar el producto.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + AddPSCambioSalida(DdlPSCambioSalida.SelectedValue.ToEntero, TxtCantCambio.Text.ToDouble) + End Sub + + Protected Sub AddPSCambioSalida(CvePS As Integer, Cantidad As Double) + If DdlAlmacenCambioVigencias.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlPSCambioSalida.SelectedText = "" : Exit Sub + + Dim Valido As Boolean = True + + If Valido Then + Dim CveClasificacion As Integer + Dim CveUM As Double + Dim CodigoPS As String = "" + Dim PS As String = "" + + Dim CveSeccionAlmacen As Integer = DdlSeccionAlmacenSalida.SelectedValue.ToEntero + Dim Serie As String = If(TxtSerieSalida.Text = "", "", TxtSerieSalida.Text) + Dim Lote As String = If(TxtLoteSalida.Text = "", "", TxtLoteSalida.Text) + Dim Caducidad As String = If(TxtCaducidadSalida.Text = "", MinFecha.ToShortDateString, TxtCaducidadSalida.Text) + + Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimero("", "PS") + If dr IsNot Nothing Then + CveClasificacion = dr("CveClasificacion").ToString.ToEntero + CveUM = dr("CveUM").ToString.ToEntero + CodigoPS = dr("PSCodigo").ToString.ToString + PS = dr("PS").ToString.ToString + End If + + Dim registro As DataRow = DtMovimientosCambioVigencias.NewRow + registro.Item("Cantidad") = Cantidad + registro.Item("CveUM") = CveUM + registro.Item("CvePS") = CvePS + registro.Item("CodigoPS") = CodigoPS + registro.Item("PS") = PS + registro.Item("PU") = 0 + registro.Item("Total") = 0 + registro.Item("CveClasificacion") = CveClasificacion + registro.Item("Estatus") = "" + registro.Item("CveSeccionAlmacen") = CveSeccionAlmacen + registro.Item("Serie") = Serie + registro.Item("Lote") = Lote + registro.Item("FechaCaducidad") = Caducidad + + If CvePS > 0 Then + Using ObjPS As New ClsProductosServicios() + If ObjPS.GetPS(CvePS, -1, UsuarioActual.CveEmpresa) AndAlso ObjPS.DtResultados.Rows.Count > 0 Then + Dim CvePSAdicionalVigencia = ObjPS.DtResultados.Rows(0)("CvePSAdicionalVigencia").ToString.ToEntero() + Dim CodigoPSVigencia As String = ObjPS.DtResultados.Rows(0)("CodigoPSVigencia").ToString + 'SI EXISTE UN MOVIMIENTO DE VIGENCIA + If CvePSAdicionalVigencia > 0 Then + + If ObjPS.GetPS(CvePSAdicionalVigencia, -1, UsuarioActual.CveEmpresa) AndAlso ObjPS.DtResultados.Rows.Count > 0 Then + registro.Item("CvePSVigencia") = CvePSAdicionalVigencia + registro.Item("CodigoPSVigencia") = CodigoPSVigencia + registro.Item("CveUMVigencia") = ObjPS.DtResultados.Rows(0)("CveUM").ToString.ToEntero() + + DtMovimientosCambioVigencias.Rows.Add(registro) + End If + + Else + Alert("Este producto no tiene un producto de vigencia relacionado", TipoMensaje.MsgAdvertencia) + End If + End If + End Using + End If + + CargaGvCambioSalidas(DtMovimientosCambioVigencias) + + RegistraScript("playsonidito('beep-07.wav')") + End If + End Sub + + Protected Sub DeleteRowCambioVigencia(ByVal sender As Object, ByVal e As EventArgs) + Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton) + + If DtMovimientosCambioVigencias.Rows.Count > 0 And lnkRemove.CommandArgument.ToString.Length > 0 Then + Dim i As Integer + i = lnkRemove.CommandArgument.ToString.ToEntero + Dim Drs As DataRow() = DtMovimientosCambioVigencias.Select(String.Format("No = {0}", i)) + If Drs.Count > 0 Then + + Drs(0).Delete() + End If + DtMovimientosCambioVigencias.AcceptChanges() + End If + + GvSalidasCambioVigencia.EditIndex = -1 + + CargaGvCambioSalidas(DtMovimientosCambioVigencias) + End Sub + + Private Sub CargaGvCambioSalidas(DtTemp As DataTable) + GvSalidasCambioVigencia.DataSource = DtTemp + GvSalidasCambioVigencia.DataBind() + + If DtTemp IsNot Nothing AndAlso DtTemp.Rows.Count > 0 Then + GvSalidasCambioVigencia.Columns(2).Visible = DtTemp.MAX("CveSeccionAlmacen").ToEntero > 0 + GvSalidasCambioVigencia.Columns(3).Visible = DtTemp.MAX("Serie") <> "" + GvSalidasCambioVigencia.Columns(4).Visible = DtTemp.MAX("Lote") <> "" + GvSalidasCambioVigencia.Columns(5).Visible = DtTemp.MAX("FechaCaducidad").ToDate > MinFecha + GvSalidasCambioVigencia.Columns(5).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) = "Fecha Elaboración", "Fecha Elaboración", "Fecha Caducidad") + End If + UpGvCambioSalidas.Update() + End Sub + Protected Sub GvSalidasCambioVigencia_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.Cells(1).CssClass = "SubTotales" + e.Row.Cells(6).CssClass = "Totales" + End If + End Sub + #End Region #Region "GUARDAR" @@ -4034,6 +4212,133 @@ Partial Class Inventarios_EntradasSalidas ObjInventario.Dispose() 'elimino la instancia End Sub + Private Sub BtnGuardarCambiosVigencia_Click(sender As Object, e As EventArgs) Handles BtnGuardarCambiosVigencia.Click + + If GvSalidasCambioVigencia.Rows.Count = 0 Then + Alert("No hay ningun registro para generar el movimiento. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgError) + RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") + RegistraScript(String.Format("$('#{0}').modal();", "DivModalCambioFisico")) + Exit Sub + End If + + Dim ObjInventario As New ClsInventarios + Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) + Dim CveMovimientoEntrada As Integer = -1 + Dim CveMovimientoSalida As Integer = -1 + Dim ErrorMovInv As Boolean = False + Dim Mensaje As String = "" + Dim ValorEntrada As Decimal = 0 + Dim ValorSalida As Decimal = 0 + Dim ImporteConcepto As Decimal = 0 + Dim tConcepto As String = TxtObsCambioVigencia.Text.Trim + Dim Fecha = TxtFechaCambio.Text.ToDate.ToString("yyyy/MM/dd").ToDate + Dim tCveSubProyecto As Integer = -1 + Dim TipoMovto As Boolean = False + Dim idCtaContableEntrada As Integer = 0 + Dim idCtaContableSalida As Integer = 0 + + Dim FolioSalida As Integer = 0 + Dim FolioEntrada As Integer = 0 + + Dim IdCuentaOtrosIngresos As Integer = UsuarioActual.Empresa.IdCuentaOtrosIngresos + + Dim CveAlmacen As Integer = DdlAlmacenCambioVigencias.SelectedValue.ToEntero + + Dim CveModalidad As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacen).FiltroPrimeroValor("CveModalidad").ToEntero() + + Dim EsContabilizable As Boolean = (CveModalidad = 1) + + 'MOVIMIENTOS + If DtMovimientosCambioVigencias.Rows.Count > 0 Then + FolioSalida = ObjInventario.GetFolioSiguiente(8, UsuarioActual.CveEmpresa) + CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacen, 8, 1, Fecha, FolioSalida, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObsCambioVigencia.Text.Trim, Modulo:="ES/CV1") + + FolioEntrada = ObjInventario.GetFolioSiguiente(9, UsuarioActual.CveEmpresa) + CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacen, 9, 1, Fecha, FolioEntrada, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObsCambioVigencia.Text.Trim, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="ES/CV2") + End If + + + 'VALIDA, sino hay registrado ningun movimiento, que no siga + If (CveMovimientoEntrada <= 0 AndAlso CveMovimientoSalida <= 0) Then + Alert("Ocurrió un error al realizar los registros. Por favor verifique y vuelva a intentar", TipoMensaje.MsgError) + RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") + ObjInventario.RollBack() 'deshace lo insertado. + ObjInventario.Dispose() 'elimino la instancia + Exit Sub + End If + + 'VALIDA EXISTENCIAS SALIDA E INSERTA DETALLES + For Each Dr As DataRow In DtMovimientosCambioVigencias.Rows + If ObjInventario.GetExistenciasPS(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenInventarioFisico.SelectedValue.ToEntero, PendientePorSurtir:=1) >= Dr("Cantidad").ToString.ToDouble Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, + Dr("PU").ToString.ToDecimal, -1, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, + Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate) Then + Mensaje = "Ocurrió un error al guardar los movimientos de salida" + ErrorMovInv = True + Exit For + Else + 'OBTIENE EL COSTO DE LA SALIDA + If Not ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa, CveMovimientoDetalle:=ObjInventario.CveMovimientoDetalle) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then + Mensaje = "Ocurrió un error al guardar los movimientos de salida" + ErrorMovInv = True + Exit For + Else + Dim PUEntrada As Decimal = ObjInventario.DtResultados.Rows(0)("PU").ToString().ToDecimal() + ImporteConcepto += PUEntrada * Dr("Cantidad").ToString.ToDecimal() + + 'INSERTA EL MOVIMIENTO DE ENTRADA + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUMVigencia").ToString.ToEntero, Dr("CvePSVigencia").ToString.ToEntero, PUEntrada, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero) Then + Mensaje = "Ocurrió un error al guardar los movimientos de entrada" + ErrorMovInv = True + Exit For + End If + End If + End If + Else + Mensaje = String.Format("No hay existencias suficientes del producto: {0}", Dr("PS")) + RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") + ErrorMovInv = True + Exit For + End If + Next + + 'CONTABILIZAR MOVIMIENTOS + If Not ErrorMovInv Then + If Not ContabilizaMovimientoAlmacen(ObjConta, Now, "CAMBIO DE VIGENCIA", "ES/CV", CveMovimientoSalida, CveMovimientoEntrada, ImporteConcepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False) > 0 Then + ErrorMovInv = True + Mensaje = "No se pudo generar el movimiento de prepoliza" + End If + End If + + If Not ErrorMovInv Then + ObjInventario.Commit() ' aplica los movimientos insertados + + Dim Msg As New StringBuilder + Msg.AppendFormat("
    El Movimiento de entrada se registró con el Folio: {1}", CveMovimientoEntrada, FolioEntrada) + If CveMovimientoEntrada > 0 Then Msg.AppendFormat("
    Imprimir Movimiento Entrada ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada))) + Msg.AppendFormat("

    El Movimiento de salida se registró con el Folio: {1}", CveMovimientoSalida, FolioSalida) + If CveMovimientoSalida > 0 Then Msg.AppendFormat("
    Imprimir Movimiento Salida ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida))) + Alert(Msg.ToString, TipoMensaje.MsgInformacion) + + RegistraScript("playsonidito('beep-07.wav');$('#DivModalCambiarVigencias').modal('hide');") + + DtMovimientosCambioVigencias.Clear() + + GvSalidasCambioVigencia.DataSource = DtMovimientosCambioVigencias + GvSalidasCambioVigencia.DataBind() + + TxtObsCambioVigencia.Text = "" + + Else + ObjInventario.RollBack() + + Alert(Mensaje, TipoMensaje.MsgError) + + RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") + End If + ObjInventario.Dispose() 'elimino la instancia + + End Sub #End Region #End Region @@ -4530,4 +4835,6 @@ Partial Class Inventarios_EntradasSalidas End Sub + + End Class diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index d2b995433..4f19a33b8 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -2676,6 +2676,48 @@ Partial Class Inventarios_RecepcionUsados HdnPSAjusteMarca.Value = CveMarca.ToString() HdnPSAjusteClasificacion.Value = CveClasificacion.ToString() + Dim CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={DdlAlmacen.SelectedValue}").ToEntero + + If UsuarioActual.Empresa.Funcionalidad(404).ToEntero > 0 Then 'cuando el valor es 10.- secuencia Cliente/Sucursal, 20 - sucursal/cliente + Dim TipoPrecioLista As Integer = UsuarioActual.Empresa.Funcionalidad(404).ToEntero + ' si es 10. primero el cliente + Dim CvePrecioListaPS As Integer + Dim PorcentajePrecio As Decimal = 0 + + If TipoPrecioLista = 10 Then + CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=DdlClientes.SelectedValue.ToEntero()).FiltroPrimeroValor("CvePrecioLista").ToEntero() + If CvePrecioListaPS <= 0 Then + CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=CveSubProyecto, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero() + End If + Else + CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=CveSubProyecto, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero() + If CvePrecioListaPS <= 0 Then + CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=DdlClientes.SelectedValue.ToEntero()).FiltroPrimeroValor("CvePrecioLista").ToEntero() + End If + End If + + If CvePrecioListaPS > 0 Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then + PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal + PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal + End If + ObjPS.Dispose() + End If + + If PrecioSugerido = 0 Then + Dim ObjInventarios As New ClsInventarios + Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, txtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, CveSubProyecto, CveTipoAlmacen:=1) + 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal + If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, txtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1) + ObjInventarios.Dispose() + If CostoPS > 0 And PorcentajePrecio > 0 Then + PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS + End If + End If + 'CvePrecioLista = CvePrecioListaPS + End If + Dim MarcaPorcentaje As DataRow = DtPorcentajeMarcas.FiltroPrimero(String.Format("CveMarca = {0}", drPS("CveMarca").ToString)) If MarcaPorcentaje IsNot Nothing Then Dim PorcentajeProducto As Decimal = MarcaPorcentaje("PorcentajeProducto").ToString.ToDecimal / 100 @@ -2705,6 +2747,7 @@ Partial Class Inventarios_RecepcionUsados TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2) End If UpModalAgregar.Update() + UpAjuste.Update() End Sub Private Sub CargaBCIAjuste() diff --git a/Ventas/ProductosServicios.aspx b/Ventas/ProductosServicios.aspx index 91b9fb262..7a5c4faa1 100644 --- a/Ventas/ProductosServicios.aspx +++ b/Ventas/ProductosServicios.aspx @@ -224,12 +224,13 @@
    - <%-- - - --%> - <%-- - --%> + +
    +
    +
    + +

    diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 4311727ff..6f9b5de8f 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -212,6 +212,11 @@ Partial Class ProductosyServicios DdlIVA.Enabled = False End If + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + DivPSAdicionalVigencia.Visible = True + CargaPSAdicionalesVigencias() + End If + If CvePS > 0 Then CargaEquivalencias() CargaPSAdicionales() @@ -769,6 +774,12 @@ Partial Class ProductosyServicios DdlSATPS.SelectedText = $"{ObjProductosServicios.SATClavePS} - {ObjProductosServicios.SATDescripcion}" CveSATPS = ObjProductosServicios.CveSATPS End If + + If ObjProductosServicios.DtResultados.Rows(0)("CvePSAdicionalVigencia").ToString.ToEntero() > 0 Then + DdlPSAdicionalVigencia.SelectedValue = ObjProductosServicios.DtResultados.Rows(0)("CvePSAdicionalVigencia").ToString + DdlPSAdicionalVigencia.SelectedText = ObjProductosServicios.DtResultados.Rows(0)("CodigoPSVigencia").ToString + End If + If ObjProductosServicios.CveFraccionArancelaria.ToString <> Nothing Then DdlFraccionArancelaria.SelectedValue = ObjProductosServicios.CveFraccionArancelaria.ToString DdlFraccionArancelaria.SelectedText = ObjProductosServicios.ClaveSATFraccionArancelariaDescripcion @@ -918,6 +929,14 @@ Partial Class ProductosyServicios DdlSATPS.ddlWS.Attributes.Add("data-metodo", "getpssat") End Sub + Public Sub CargaPSAdicionalesVigencias() + DdlPSAdicionalVigencia.setEsWebService(True) + DdlPSAdicionalVigencia.Attributes.Add("data-cvesubproyecto", "-1") + DdlPSAdicionalVigencia.ddlWS.Attributes.Add("data-cveclasificacion", "-1") + DdlPSAdicionalVigencia.ddlWS.Attributes.Add("data-pagina", "ventas/ventas") + DdlPSAdicionalVigencia.ddlWS.Attributes.Add("data-Estatus", "1") + End Sub + Public Sub CargaDdlFraccionArancelaria() DdlFraccionArancelaria.setEsWebService(True) DdlFraccionArancelaria.Attributes.Add("data-metodo", "getfraccionarancelaria") @@ -1218,7 +1237,7 @@ Partial Class ProductosyServicios CveClasificacionDetalle:=DdlTipoPSDes.SelectedValue.ToEntero, CveTamaño:=DdlTamanio.SelectedValue.ToEntero, CveModelo:=DdlModelo.SelectedValue.ToEntero(), CveMedida:=DdlMedida.SelectedValue.ToEntero(), CveRinTamaño:=DdlRin.SelectedValue.ToEntero(), ClaveImpuestoEmpaque:=DdlImpEmpaque.SelectedValue.ToString, ClaveImpuestoUM:=DdlImpUM.SelectedValue.ToString, ClaveCategoriaToxicidad:=DdlCategoriaToxicidad.SelectedValue.ToString, - ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked, TiempoCaducidad:=TiempoCaducidad) > 0 Then + ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked, TiempoCaducidad:=TiempoCaducidad, CvePSAdicionalVigencia:=DdlPSAdicionalVigencia.SelectedValue.ToEntero()) > 0 Then ViewState("CvePS") = ObjProductosServicios.CvePS For Each GVR As GridViewRow In GvImpuestosLocales.Rows If GVR.FCCheckBox("ChkDeduccion").Checked Then @@ -1267,7 +1286,7 @@ Partial Class ProductosyServicios CveModelo:=DdlModelo.SelectedValue.ToEntero(), CveMedida:=DdlMedida.SelectedValue.ToEntero(), CveRinTamaño:=DdlRin.SelectedValue.ToEntero(), ClaveImpuestoEmpaque:=DdlImpEmpaque.SelectedValue.ToString, ClaveImpuestoUM:=DdlImpUM.SelectedValue.ToString, ClaveCategoriaToxicidad:=DdlCategoriaToxicidad.SelectedValue.ToString, ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked, - AplicaSerie:=ChkSerie.Checked, AplicaLote:=ChkLote.Checked, AplicaCaducidad:=ChkCaducidad.Checked, AplicaSeccion:=ChkSeccion.Checked, TiempoCaducidad:=TiempoCaducidad) Then + AplicaSerie:=ChkSerie.Checked, AplicaLote:=ChkLote.Checked, AplicaCaducidad:=ChkCaducidad.Checked, AplicaSeccion:=ChkSeccion.Checked, TiempoCaducidad:=TiempoCaducidad, CvePSAdicionalVigencia:=DdlPSAdicionalVigencia.SelectedValue.ToEntero()) Then If Not ObjProductosServicios.LimpiaImpuestosLocales(CvePS) Then TieneError = True