diff --git a/AF/AF.aspx b/AF/AF.aspx index 96b070b57..8ce476197 100644 --- a/AF/AF.aspx +++ b/AF/AF.aspx @@ -2847,7 +2847,7 @@ -
+
Serie:
diff --git a/AF/AF.aspx.vb b/AF/AF.aspx.vb index f53722f3c..d47cf410c 100644 --- a/AF/AF.aspx.vb +++ b/AF/AF.aspx.vb @@ -2052,7 +2052,7 @@ Partial Class AF_AF 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, SerieLote:=AFInvSerie) Then + If Not ObjInventarios.AddMovimientoDetalle(CveMovimientoSalidaInv, 1, CveUMInv, AFInvCvePS, 0, -1, Serie:=AFInvSerie) Then ErrorGuardar = True End If Else @@ -3001,7 +3001,7 @@ Partial Class AF_AF AFInvSerie = If(Inv_CveMetodoInventario = 5, TxtAFInvSerie.Text.Trim, "-1") Dim ObjInventario As New ClsInventarios - Dim Existencia = ObjInventario.GetExistenciasPS(DdlAFInvPS.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, DdlAFInvAlmacen.SelectedValue.ToEntero, FechaMovto:=Now.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=AFInvSerie) + Dim Existencia = ObjInventario.GetExistenciasPS(DdlAFInvPS.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, DdlAFInvAlmacen.SelectedValue.ToEntero, FechaMovto:=Now.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=AFInvSerie) Dim Costo As Decimal = 0 If Inv_CveMetodoInventario = 5 Then Costo = ObjInventario.GetCostoPSSerie(DdlAFInvPS.SelectedValue.ToEntero, AFInvSerie, DdlAFInvAlmacen.SelectedValue.ToEntero, CveEmpresaActual) @@ -3585,7 +3585,7 @@ Partial Class AF_AF End Sub #End Region Protected Sub DdlAFInvPS_SelectedIndexChanged(sender As Object, e As EventArgs) - DivSerieLote.Visible = GlobalDTPS(UsuarioActual.CveEmpresa, DdlAFInvPS.SelectedValue.ToEntero).FiltroPrimeroValor("Inv_CveMetodoInventario").ToEntero() = 5 + DivSerie.Visible = CBool(GlobalDTPS(UsuarioActual.CveEmpresa, DdlAFInvPS.SelectedValue.ToEntero).FiltroPrimeroValor("AplicaSerie")) End Sub Protected Sub BtnPDFCompras_Click(sender As Object, e As EventArgs) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 024b4fe5f..7f1096c37 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -1089,43 +1089,44 @@ Public Class ClsContabilidad End Function + Public Function ContabilizaDesContabilizaPrePoliza(CvePrePoliza As Integer, Contabilizar As Boolean, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Conta_PrePolizasContabilizarDescontabilizar") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@Contabilizar", SqlDbType.Bit).Value = Contabilizar + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FolioPoliza", SqlDbType.Int).Direction = ParameterDirection.Output + End With + Try + SqlAdapter.Fill(Data) + _ContaFolio = SqlAdapter.SelectCommand.Parameters("@FolioPoliza").Value.ToString.ToEntero + Retorno = True + Catch ex As Exception + If ex.Message.Contains("50015;") Then + OnError("No se puede actualizar una póliza en un ejercicio Cerrado", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + Else + OnError("Ocurrió un error al contabilizar las prepoliza detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + End Try + Return Retorno + End Function + Public Function ContabilizarPrePoliza(CvePrePoliza As Integer, CveUsuario As Integer, Empresa As Empresa, Optional Fecha As Date = MinFecha, Optional Concepto As String = "", Optional ObjConta As ClsContPAQi = Nothing, Optional pIDPoliza As Integer = -1) As Boolean - 'Editado Por Charlie Dim Retorno As Boolean = False - 'No modificar esta seccion bajo ninguna circunstancia -- Empresa.CvePlataforma = 3 Or - '***************************************************** - If (CveUsuario.Contiene(100, 1425) And Empresa.CveEmpresa = 1) Then - Retorno = ContabilizarPrePolizaSIG(CvePrePoliza, CveUsuario, Empresa, Fecha, Concepto) - Return Retorno - End If - '***************************************************** + If Empresa.TipoContabilizacion = 1 Then ' contabilidad en SIG - If Empresa.UsaArmonizacion Then - DataAdapter("PA_Conta_ContabilizaPrepoliza") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza - .Add("@CvePoliza", SqlDbType.Int).Direction = ParameterDirection.Output - End With + ContabilizaDesContabilizaPrePoliza(CvePrePoliza, True, Empresa.CveEmpresa) - Try - SqlAdapter.Fill(Data) - ContaIdPoliza = SqlAdapter.SelectCommand.Parameters("@CvePoliza").Value.ToString.ToEntero - If ContaIdPoliza <> 0 Then - Retorno = True - End If - Catch ex As Exception - OnError("Ocurrió un error al obtener Movimientos Prepolizas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try Else If CvePrePoliza <= 0 Then Return False Dim OcurrioError As Boolean = False - Dim ContaCompartida As Boolean = False If ObjConta Is Nothing Then @@ -1135,9 +1136,6 @@ Public Class ClsContabilidad ContaCompartida = True End If - - - Dim tIdPoliza As Integer Dim CveTipoPoliza, FolioFijo, CvePlantillaPoliza As Integer Dim Cargos As Decimal @@ -1152,23 +1150,8 @@ Public Class ClsContabilidad Dim ContabilizarCausacion As Boolean Dim ContabilizarDIOT As Boolean - 'Dim Periodo As Integer = -1 - 'Dim Ejercicio As Integer = -1 - 'Dim GuidPoliza As String = "-1" - - ' Dim FolioFiscal As String = "" - ' Dim DatosCuentas As New DataTable - ' Dim CveMoneda As Integer = 0 - ' Dim Total As Decimal = 0 - - - Try - 'If Empresa.Funcionalidad(522).ToString = "1" AndAlso ObjConta.GetCuentas(-1, "-1", -1) Then - ' DatosCuentas = ObjConta.DtResultados - 'End If - If GetEncabezadoPrePoliza(CvePrePoliza, Empresa.CveEmpresa) Then CveTipoPoliza = Data.Rows(0)("CveTipoPoliza").ToString.ToEntero Cargos = Data.Rows(0)("Cargos").ToString.ToDecimal @@ -1255,30 +1238,6 @@ Public Class ClsContabilidad Exit For End If - 'If Empresa.Funcionalidad(522).ToString = "1" Then - ' GuidPoliza = ObjConta.DtResultados.Rows(0)("Guid").ToString - ' Periodo = Data.Rows(0)("Fecha").ToString.ToDate.Month - ' Ejercicio = Data.Rows(0)("Fecha").ToString.ToDate.Year - - ' Dim CodigoCuenta As String = "" - - ' If DatosCuentas.Rows.Count > 0 Then - ' If DatosCuentas.FiltraParametros($"Id = {dr("IdCtaContable").ToString}").Rows.Count > 0 Then 'Filtra primero valorCambiar - ' CodigoCuenta = DatosCuentas.FiltraParametros($"Id = {dr("IdCtaContable").ToString}").Rows(0)("Codigo").ToString - ' If Not ObjConta.AddASocCFDIs(False, TipoPol, GuidPoliza, FolioFiscal, 0, CodigoCuenta, Empresa.BDContPAQi, -1, -1, ContaFolio) Then - ' OcurrioError = True - ' Exit For - ' End If - ' Else - ' OcurrioError = True - ' Exit For - ' End If - ' Else - ' OcurrioError = True - ' Exit For - ' End If - 'End If - Else If Not ObjConta.AddMovimiento(tIdPoliza, dr("IdCtaContable").ToString.ToEntero, tipoMovimiento, @@ -1288,29 +1247,6 @@ Public Class ClsContabilidad End If - 'If Empresa.Funcionalidad(522).ToString = "1" Then - ' GuidPoliza = ObjConta.DtResultados.Rows(0)("Guid").ToString - ' Periodo = Data.Rows(0)("Fecha").ToString.ToDate.Month - ' Ejercicio = Data.Rows(0)("Fecha").ToString.ToDate.Year - - ' Dim CodigoCuenta As String = "" - - ' If DatosCuentas.Rows.Count > 0 Then - ' If DatosCuentas.FiltraParametros($"Codigo = {dr("IdCtaContable").ToString}").Rows.Count > 0 Then - ' CodigoCuenta = DatosCuentas.FiltraParametros($"Codigo = {dr("IdCtaContable").ToString}").Rows(0)("Codigo").ToString - ' If Not ObjConta.AddASocCFDIs(False, TipoPol, GuidPoliza, FolioFiscal, 0, CodigoCuenta, Empresa.BDContPAQi, -1, -1, ContaFolio) Then - ' OcurrioError = True - ' Exit For - ' End If - ' Else - ' OcurrioError = True - ' Exit For - ' End If - ' Else - ' OcurrioError = True - ' Exit For - ' End If - 'End If End If Else @@ -1425,89 +1361,6 @@ Public Class ClsContabilidad - 'If Empresa.Funcionalidad(522).ToString = "1" And Empresa.UsaContabilidad Then - - ' Dim CodigoPersona As String = "" - ' Dim Bnefciciario As String = "" - - ' If ObjConta.GetPersona(RFC) Then - ' CodigoPersona = ObjConta.DtResultados.FiltroPrimeroValor("CodigoPersona") - ' Bnefciciario = ObjConta.DtResultados.FiltroPrimeroValor("Nombre") - ' Else - - ' OcurrioError = True - ' Mensaje.Append("Se presento un error al obtener los datos de la persona. ") - - ' End If - - - - - ' If TipoPol = 1 Then 'Ingreso - ' Dim IdDocumento As Integer = 0 - ' ' Dim UsuarioSistema As String = "" - ' Dim IdCuentaCheques As Integer = 1 - ' Dim NatBancaria As Integer = 2 - ' Dim Naturaleza As Integer = 1 - ' Dim IdIngreso As Integer - - ' If ObjConta.AddIngreso(1, 34, 42, Ejercicio, Periodo, Fecha, Ejercicio, Periodo, CodigoPersona, Bnefciciario, IdCuentaCheques, NatBancaria, Naturaleza, CveMoneda, 2, 1, Total, "", 0, 0, "", 0, - ' 0, Ejercicio, Periodo, TipoPol, ContaFolio.ToEntero, 0, 0, tIdPoliza, 11, 0, 0, 0, 0, UsuarioSistema, UsuarioSistema, 0, System.Guid.NewGuid().ToString().ToUpper, "", 0, MetodoPagoSAT) Then 'Actualizar Documento IdDocumento despues de Insertarlo - - ' If ObjConta.DtResultados.Rows.Count > 0 Then - ' IdIngreso = ObjConta.DtResultados.Rows(0)("IdIngreso").ToString.ToEntero - - ' If Not ObjConta.AddDocumentoBancario(1, 0, 0, IdIngreso, 0, 0, Fecha, Fecha, 0, 0, IdCuentaCheques) Then - ' OcurrioError = True - ' Mensaje.Append("Se presento un error al guardar el el documento. ") - ' End If - - ' Else - ' OcurrioError = True - ' Mensaje.Append("Se presento un error al guardar el Ingreso. ") - ' End If - ' Else - ' OcurrioError = True - ' Mensaje.Append("Se presento un error al guardar el Ingreso. ") - ' End If - - ' ElseIf TipoPol = 2 Then 'Egreso - - ' Dim IdDocumento As Integer = 0 - ' ' Dim UsuarioSistema As String = "" - ' Dim BancoDestino As String = "" - ' Dim CuentaDestino As String = "" - ' Dim IdCuentaCheques As Integer = 1 - ' Dim NatBancaria As Integer = 0 - ' Dim Naturaleza As Integer = 2 - ' Dim IdEgreso As Integer - - ' If ObjConta.AddEgreso(1, 36, 45, Ejercicio, Periodo, Fecha, Ejercicio, Periodo, CodigoPersona, Bnefciciario, IdCuentaCheques, NatBancaria, Naturaleza, CveMoneda, 2, 1, Total, "", 0, "", 0, 0, Ejercicio, - ' Periodo, TipoPol, NumPoliza, 0, 0, ContaIdPoliza, tIdPoliza, IdDocumento, Ejercicio, Periodo, 0, 0, 0, 0, 0, 0, UsuarioSistema, UsuarioSistema, 0, System.Guid.NewGuid().ToString().ToUpper, - ' CuentaDestino, BancoDestino, MetodoPagoSAT) Then - - ' If ObjConta.DtResultados.Rows.Count > 0 Then - ' IdEgreso = ObjConta.DtResultados.Rows(0)("IdEgreso").ToString.ToEntero - - ' If Not ObjConta.AddDocumentoBancario(1, 0, IdEgreso, 0, 0, 0, Fecha, Fecha, 0, 0, IdCuentaCheques) Then - ' OcurrioError = True - ' Mensaje.Append("Se presento un error al guardar el el documento. ") - ' End If - - ' Else - ' OcurrioError = True - ' Mensaje.Append("Se presento un error al guardar el Egreso. ") - ' End If - ' Else - ' OcurrioError = True - ' Mensaje.Append("Se presento un error al guardar el Egreso") - - ' End If 'Actualizar Documento IdDocumento despues de Insertarlo - - ' End If - - 'End If - If OcurrioError Then If Not ContaCompartida Then ObjConta.RollBack() Else @@ -1539,215 +1392,6 @@ Public Class ClsContabilidad Return Retorno End Function - 'No modificar este metodo bajo ninguna circunstancia - Public Function ContabilizarPrePolizaSIG(CvePrePoliza As Integer, CveUsuario As Integer, Empresa As Empresa, Optional Fecha As Date = MinFecha, Optional Concepto As String = "") As Boolean - - If CvePrePoliza <= 0 Then Return False - - Dim Retorno As Boolean = False - Dim OcurrioError As Boolean = False - Dim tCvePoliza As Integer - Dim CveTipoPoliza, FolioFijo As Integer - Dim Cargos As Decimal - Dim Abonos As Decimal - Dim NumPoliza As String = "" - Dim CodigoNumeroPoliza As String = "" - Dim TipoPoliza As String - - Dim ContaFolio As String = "" - Dim ContabilizarCausacion As Boolean - Dim ContabilizarDIOT As Boolean - - Dim ObjConta As New ClsContabilidad - ObjConta.IniciaTransacSQL() - - Try - - If GetEncabezadoPrePoliza(CvePrePoliza, Empresa.CveEmpresa) Then - CveTipoPoliza = Data.Rows(0)("CveTipoPoliza").ToString.ToEntero - Cargos = Data.Rows(0)("Cargos").ToString.ToDecimal - Abonos = Data.Rows(0)("Abonos").ToString.ToDecimal - FolioFijo = Data.Rows(0)("FolioFijo").ToString.ToEntero - TipoPoliza = Data.Rows(0)("TipoPoliza").ToString - CodigoNumeroPoliza = Data.Rows(0)("CodigoNumeroPoliza").ToString - - 'tiene prioridad el concepto en parametro - If Concepto = "" Then Concepto = Data.Rows(0)("Concepto").ToString - If Fecha = MinFecha Then Fecha = Data.Rows(0)("Fecha").ToString.ToDate - - If FolioFijo > 0 Then - CodigoNumeroPoliza = "CHQ" - Else - GetNumeroPoliza(CveTipoPoliza, TipoPoliza, Fecha, Empresa.CveEmpresa) - FolioFijo = Data.Rows(0)("NumPoliza").ToString.ToEntero - End If - - tCvePoliza = ObjConta.AddPoliza(CveTipoPoliza, FolioFijo, Fecha, Concepto, CveUsuario, Empresa.CveEmpresa, CvePrePoliza) - - If tCvePoliza > 0 AndAlso GetContabilizacionDiarioDetalle(CvePrePoliza) Then - Dim tipoMovimiento As Boolean = False - Dim CveConceptoContable As Integer - Dim SigReferencia As String = "" - - For Each dr As DataRow In Data.Rows - - CveConceptoContable = dr("CveConceptoContable").ToString().ToEntero - - Select Case CveConceptoContable - Case 6, 5, 17, 14, 19, 15, 16 - SigReferencia = dr("CveCompra").ToString.ContaReferencia(TipoContaReferencia.Compra) - Case 2, 4, 1, 13, 61, 62, 63, 8, 9 - SigReferencia = dr("CveVenta").ToString.ContaReferencia(TipoContaReferencia.Venta) - Case 30 - SigReferencia = dr("CveIE").ToString.ContaReferencia(TipoContaReferencia.Banco) - - End Select - - Select Case CveConceptoContable - Case 19 ' IVA Acreditable - ContabilizarDIOT = True - Case 61 ' IVA Trasladado - ContabilizarCausacion = True - Case 30 ' Bancos - If dr("Abono").ToString.ToDecimal > 0 Then ContabilizarDIOT = True - If dr("Cargo").ToString.ToDecimal > 0 Then ContabilizarCausacion = True - End Select - - tipoMovimiento = (dr("TipoMovto").ToString = "True") - - 'Si las cuentas contables estan en 0 no se debe contabilizar - If dr("CveCuenta").ToString.ToEntero > 0 Then - - 'Si ImporteMN es mayor que 0 entonces la compra es en dolares y debemos ingresar la cantidad en pesos - If dr("ImporteMN").ToString.ToDecimal <> 0 Then - If Not ObjConta.AddPolizaDetalle(tCvePoliza, dr("CveCuenta").ToString.ToEntero, "", dr("CveSubProyecto").ToString.ToEntero, tipoMovimiento, - dr("ImporteMN").ToString.ToDecimal, dr("Referencia").ToString, dr("Concepto").ToString, Fecha, ImporteMonedaExtranjera:=dr("ImporteME").ToString.ToDecimal, CvePrePolizaDetalle:=dr("CvePrePolizaDetalle").ToString.ToEntero) Then - OcurrioError = True - Exit For - End If - Else - If Not ObjConta.AddPolizaDetalle(tCvePoliza, dr("CveCuenta").ToString.ToEntero, "", dr("CveSubProyecto").ToString.ToEntero, tipoMovimiento, - dr("Importe").ToString.ToDecimal, dr("Referencia").ToString, dr("Concepto").ToString, Fecha, ImporteMonedaExtranjera:=dr("ImporteME").ToString.ToDecimal, CvePrePolizaDetalle:=dr("CvePrePolizaDetalle").ToString.ToEntero) Then - OcurrioError = True - Exit For - End If - End If - - Else - OcurrioError = True - Mensaje.Append(String.Format("
La cuenta contable {0} es invalida", dr("ConceptoContable"))) - Exit For - End If - - Next - - 'Obtenemos los valores de la causacion y los agregamos - 'If Not OcurrioError AndAlso ContabilizarCausacion Then - ' If GetCausacionesValores(CvePrePoliza) AndAlso Data.Rows.Count > 0 Then - ' Dim dr As DataRow = Data(0) - ' If Not ObjConta.AddCausacionesIVA(tIdPoliza, - ' dr("TotalTasa16").ToString.ToDecimal, - ' dr("BaseTasa16").ToString.ToDecimal, - ' dr("IvaTasa16").ToString.ToDecimal, - ' 0, - ' dr("ISRRetenido").ToString.ToDecimal, - ' dr("IVARetenido").ToString.ToDecimal, False) Then - ' OcurrioError = True - - ' End If - ' End If - 'End If - - 'Obtenemos los valores del DIOT y los agregamos - 'If Not OcurrioError AndAlso ContabilizarDIOT Then - ' If GetDIOTValores(CvePrePoliza) AndAlso Data.Rows.Count > 0 Then - ' Dim IdProveedor As Integer - ' Dim RFC, RazonSocial As String - - ' RFC = Data(0)("RFC").ToString - ' RazonSocial = Data(0)("RazonSocial").ToString - ' IdCtaContProveedores = Data(0)("IdCtaContProveedores").ToString.ToEntero - - ' If IdCtaContProveedores > 0 Then - - ' 'busco la clave del proveedor en la contabilidad por su cuenta contable - ' If ObjConta.GetProveedores(IdCuentaContable:=IdCtaContProveedores) Then - ' If ObjConta.DtResultados.Rows.Count > 0 Then - ' Dim dr As DataRow = ObjConta.DtResultados.Rows(0) : IdProveedor = dr("Id").ToString.ToEntero - ' End If - ' End If - ' Else - ' 'busco la clave del proveedor en la contabilidad por su cuenta contable - ' If ObjConta.GetProveedores(RFC:=RFC) Then - ' If ObjConta.DtResultados.Rows.Count > 0 Then - ' Dim dr As DataRow = ObjConta.DtResultados.Rows(0) : IdProveedor = dr("Id").ToString.ToEntero - ' End If - ' Else - ' 'registro el proveedor generico - ' Select Case Empresa.CveEmpresa - ' Case 66 : IdProveedor = 12726 - ' Case Else : IdProveedor = 1 - ' End Select - ' End If - - ' End If - - - ' If IdProveedor <= 0 Then - ' IdProveedor = ObjConta.AddProveedor(IdCtaContProveedores, RFC, RazonSocial, "") - ' If IdProveedor <= 0 Then - ' OcurrioError = True - ' End If - ' End If - - ' For Each dr As DataRow In Data.Rows - ' If dr("Total").ToString.ToDecimal <> 0.00 Then - ' If Not ObjConta.AddDevolucionesIVA(tIdPoliza, dr("CuentaBancos").ToString.ToEntero, - ' IdProveedor, - ' 16, - ' dr("SubTotal").ToString.ToDecimal, - ' dr("IvaAcreditable").ToString.ToDecimal, - ' dr("IVARetenido").ToString.ToDecimal, - ' dr("ISRRetenido").ToString.ToDecimal, - ' Fecha, - ' ContaFolio, - ' dr("Serie").ToString.ToString, - ' dr("Folio").ToString.StrToNum, "") Then - ' OcurrioError = True - ' Mensaje.Append("La Poliza o la Cuenta no son válidas") - ' End If - - - ' End If - - ' Next - - ' End If - 'End If - - If Not OcurrioError Then - Mensaje.Append(String.Format("{1}
", tCvePoliza, FolioFijo)) - ObjConta.Commit() - Retorno = True - _ContaIdPoliza = tCvePoliza - End If - End If - - Else - OcurrioError = True - End If - - - - Catch ex As Exception - ObjConta.RollBack() - OnError("Ocurrió un error al intentar contabilizar la PrePoliza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - Retorno = False - End Try - - ObjConta.Dispose() - Return Retorno - End Function Public Function GetCuentaDobleConta(IdCtaContable As Integer, CveEmpresa As Integer) As Boolean diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index d3694abd4..ffbec5e23 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -4840,13 +4840,14 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetProductosServiciosAlmacenSeccion(CvePS As Integer, CveAlmacen As Integer, CveAlmacenSeccion As Integer) As Boolean + Public Function GetProductosServiciosAlmacenSeccion(CvePS As Integer, CveAlmacen As Integer, CveSeccionAlmacen As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_ProductosServiciosAlmacenSeccionGet") With SqlAdapter.SelectCommand.Parameters .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen - .Add("@CveAlmacenSeccion", SqlDbType.Int).Value = CveAlmacenSeccion + .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 79134e341..389d0dbed 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -14,6 +14,7 @@ Imports CrystalDecisions.Shared Imports CrystalDecisions.ReportSource Imports Stimulsoft.Report Imports System.Xml +Imports System.Web.Http.ValueProviders 'NOTA AD TEAM @@ -1734,33 +1735,7 @@ Public Class ClsPaginas Application("GlobalDTInvConceptos") = value End Set End Property - Property GlobalDTSeccionAlmacen(CveEmpresa As Integer, CveAlmacen As Integer) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTSeccionAlmacen-{0}", CveEmpresa) - 'sino existe, recarga los datos - If Application(AppNombre) Is Nothing Then - Dim ObjInv As New ClsInventarios - If ObjInv.GetSeccionesAlmacenes(CveEmpresa, -1) Then Application(AppNombre) = ObjInv.DtResultados - ObjInv.Dispose() - End If - If CveEmpresa <> -1 Then - Dim Str As New StringBuilder - If CveEmpresa <> -1 Then Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa) - If CveAlmacen > 0 Then Str.AppendFormat("AND CveAlmacen = {0}", CveAlmacen) - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) - GlobalDTSeccionAlmacen = Dv.ToTable - Dv.Dispose() - Else - GlobalDTSeccionAlmacen = DirectCast(Application("GlobalDTSeccionAlmacen"), DataTable) - End If - - End Get - Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTSeccionAlmacen-{0}", CveEmpresa) - Application(AppNombre) = value - End Set - End Property Property GlobalDTAlmacen(CveEmpresa As Integer, Optional CveTipoAlmacen As Integer = -1, Optional CveEstatus As Integer = 1) As DataTable Get @@ -1797,6 +1772,76 @@ Public Class ClsPaginas Application("GlobalDTAlmacenUsuarios") = value End Set End Property + + Property GlobalDTSeccionAlmacen(CveEmpresa As Integer, CveAlmacen As Integer) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTSeccionAlmacen-{0}", CveEmpresa) + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjInv As New ClsInventarios + If ObjInv.GetSeccionesAlmacenes(CveEmpresa, -1) Then Application(AppNombre) = ObjInv.DtResultados + ObjInv.Dispose() + End If + If CveEmpresa <> -1 Then + Dim Str As New StringBuilder + + If CveEmpresa <> -1 Then Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa) + If CveAlmacen > 0 Then Str.AppendFormat("AND CveAlmacen = {0}", CveAlmacen) + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + GlobalDTSeccionAlmacen = Dv.ToTable + Dv.Dispose() + Else + GlobalDTSeccionAlmacen = DirectCast(Application("GlobalDTSeccionAlmacen"), DataTable) + End If + + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTSeccionAlmacen-{0}", CveEmpresa) + Application(AppNombre) = value + End Set + End Property + + Property GlobalDTInvPSSeccionesAlmacen(CveEmpresa As Integer, CveAlmacen As Integer, CvePS As Integer) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTInvPSSeccionesAlmacen-{0}", CveEmpresa) + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjInv As New ClsInventarios + If ObjInv.GetProductosServiciosAlmacenSeccion(-1, -1, -1, CveEmpresa) Then Application(AppNombre) = ObjInv.DtResultados + ObjInv.Dispose() + End If + If CveEmpresa <> -1 Then + Dim Str As New StringBuilder + + If CveEmpresa <> -1 Then Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa) + If CveAlmacen > 0 Then Str.AppendFormat("AND CveAlmacen = {0}", CveAlmacen) + If CvePS > 0 Then Str.AppendFormat("AND CvePS = {0}", CvePS) + + 'si el PS no tiene definido una seccion, toma las del Almacen + If DirectCast(Application(AppNombre), DataTable) IsNot Nothing Then + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + GlobalDTInvPSSeccionesAlmacen = Dv.ToTable + Dv.Dispose() + 'sino tiene datos registrados, toma los de almacen + If GlobalDTInvPSSeccionesAlmacen.Rows.Count = 0 Then + GlobalDTInvPSSeccionesAlmacen = GlobalDTSeccionAlmacen(CveEmpresa, CveAlmacen) + End If + Else + 'sino tiene datos registrados, toma los de almacen + GlobalDTInvPSSeccionesAlmacen = GlobalDTSeccionAlmacen(CveEmpresa, CveAlmacen) + End If + + Else + GlobalDTInvPSSeccionesAlmacen = DirectCast(Application(AppNombre), DataTable) + End If + + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTInvPSSeccionesAlmacen-{0}", CveEmpresa) + Application(AppNombre) = value + End Set + End Property + Property GlobalDTNom_Periodos() As DataTable Get GlobalDTNom_Periodos = DirectCast(Application("GlobalDTNom_Periodos"), DataTable) diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index 6b4c01406..7a8561d47 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -65,6 +65,11 @@ Public Class ClsProductosServicios Public Property AplicaIEPS As Boolean Public Property IEPSGrabaIVA As Boolean + Public Property AplicaSerie As Boolean + Public Property AplicaLote As Boolean + Public Property AplicaCaducidad As Boolean + Public Property AplicaSeccion As Boolean + Public Property CveConceptoContable As Integer 'Nuevo R: 26/09/2017' @@ -256,6 +261,11 @@ Public Class ClsProductosServicios IEPSPorcentaje = Data.Rows(0)("IEPSPorcentaje").ToString.ToDouble CveConceptoContable = Data.Rows(0)("CveConceptoContable").ToString.ToEntero + AplicaSerie = (Data.Rows(0)("AplicaSerie").ToString) = "True" + AplicaLote = (Data.Rows(0)("AplicaLote").ToString) = "True" + AplicaCaducidad = (Data.Rows(0)("AplicaCaducidad").ToString) = "True" + AplicaSeccion = (Data.Rows(0)("AplicaSeccion").ToString) = "True" + 'Nuevo R: 26/09/2017' Inventariable = Data.Rows(0)("Inventariable").ToString = "True" @@ -614,8 +624,9 @@ Public Class ClsProductosServicios Optional CveMoneda As Integer = 1, Optional RetISR As Double = 0, Optional PrecioMinimo As Decimal = Nothing, Optional CveTipoFactor As Integer = 1, 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) As Boolean + 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) As Boolean + Dim Retorno As Boolean = False DataAdapter("PA_ProductosServiciosUpdate") @@ -1792,7 +1803,7 @@ Public Class ClsProductosServicios Public Function GetPSExistencias(CvePS As Integer, CvePrecioLista As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional CveTipoAlmacen As Integer = -1, Optional CveSubProyecto As Integer = -1, - Optional FechaMovto As String = "-1", Optional SerieLote As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, + Optional FechaMovto As String = "-1", Optional Serie As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, Optional ExcluyeAdelantado As Integer = -1, Optional PendientePorSurtir As Integer = -1, Optional Lote As String = "-1", Optional Batch As String = "-1", Optional ExcluyeApartados As Integer = 1, Optional RestringirAlmacenes As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -1808,7 +1819,7 @@ Public Class ClsProductosServicios .Add("@CveTipoAlmacen", SqlDbType.Int).Value = CveTipoAlmacen .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@FechaMovto", SqlDbType.DateTime).Value = DateTime.ParseExact(FechaMovto, "yyyy/MM/dd HH:mm", Nothing) - .Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote + .Add("@Serie", SqlDbType.VarChar).Value = Serie .Add("@Lote", SqlDbType.VarChar).Value = Lote .Add("@Batch", SqlDbType.VarChar).Value = Batch .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 5d07b8c90..efc1d2d3f 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -1209,7 +1209,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function UpdateVentaDetalleRemision(CveVenta As Integer, CvePS As Integer, Cantidad As Double, PU As Double, IEPS As Double, Observaciones As String, Optional CveUsuarioModifico As Integer = -1) As Boolean + Public Function UpdateVentaDetalleRemision(CveVenta As Integer, CvePS As Integer, Cantidad As Double, PU As Double, IEPS As Double, PorcentajeIEPS As Decimal, Observaciones As String, Optional CveUsuarioModifico As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_VentasDetalleRemisionUpdate") @@ -1219,6 +1219,7 @@ Public Class ClsVentas .Add("@Cantidad", SqlDbType.Float).Value = Cantidad .Add("@PU", SqlDbType.Float).Value = PU .Add("@IEPS", SqlDbType.Float).Value = IEPS + .Add("@PorcentajeIEPS", SqlDbType.Float).Value = PorcentajeIEPS .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico End With diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index cda859572..d19de8eef 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -3369,7 +3369,7 @@ Namespace Modelos CveUnidad = Dr("CveUM").ToString.ToEntero Cantidad = Dr("Cantidad").ToString.ToDouble - If Dr("CveTipoInvPS").ToString.ToEntero = 5 And Dr("SerieLote").ToString = "" Then + If Dr("CveTipoInvPS").ToString.ToEntero = 5 And Dr("Serie").ToString = "" Then OcurrioError = True ErrorList.Add("Se deben especificar las Series de los productos de almacén") Exit For @@ -3510,7 +3510,7 @@ Namespace Modelos 'Si no se ha terminado de surtir agregamos el movimiento If Indice >= 0 Then - ' rowSurtidos("Surtido").ToString.ToDouble < rowSurtidos("Cantidad").ToString.ToDouble AndAlso (dr("CantidadDisponible").ToString.ToDouble - rowSurtidos("Surtido").ToString.ToDouble > 0 Or dr("SerieLote").ToString <> "") + ' rowSurtidos("Surtido").ToString.ToDouble < rowSurtidos("Cantidad").ToString.ToDouble AndAlso (dr("CantidadDisponible").ToString.ToDouble - rowSurtidos("Surtido").ToString.ToDouble > 0 Or dr("Serie").ToString <> "") If rowSurtidos("Surtido").ToString.ToDecimal < rowSurtidos("Cantidad").ToString.ToDecimal Then Dim CantidadSurtida As Double = If(dr("CantidadDisponible").ToString.ToDecimal < rowSurtidos("Cantidad").ToString.ToDouble, dr("CantidadDisponible").ToString.ToDecimal, rowSurtidos("Cantidad").ToString.ToDecimal) MovDTCuadrados.ImportRow(dr) @@ -3653,7 +3653,7 @@ Namespace Modelos Dim CveUnidad As Integer = MovDet("CveUM").ToString.ToEntero Dim PU As Decimal = MovDet("PU").ToString.ToDecimal Dim CveProducto As Integer = MovDet("CvePS").ToString.ToEntero - Dim SerieLote As String = MovDet("SerieLote").ToString + Dim Serie As String = MovDet("Serie").ToString Dim Consec As Integer = DtRemisiones.FiltroPrimeroValor("Consec", $"CveVentaDetalle = {MovDet("CveVentaDetalle").ToString}").ToEntero 'COMIENZA: VENTADETALLE @@ -3672,7 +3672,7 @@ Namespace Modelos Exit For End If - If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Lote:=SerieLote, CveVentaDetalle:=CveVentaDetalle) Then + If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle) Then ContadorMovtosDetalles += 1 Else OcurrioError = True @@ -4436,7 +4436,7 @@ Namespace Modelos If CveMovimientoDevolucion > 0 Then For Each Dr As DataRow In DtExistencias.FiltraParametros($"CveMovimiento = {RowMovimiento("CveMovimiento").ToString()}").Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoDevolucion, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoDevolucion, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, -1, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then ErrorCancelar = True MensajeError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar." Exit For @@ -4936,7 +4936,7 @@ Namespace Modelos End If For Each Dr As DataRow In DtMovtosDev.FiltraParametros($"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Serie:=Dr("Serie").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString) Then ErrorCancelar = True Exit For End If @@ -5018,7 +5018,7 @@ Namespace Modelos Exit For End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, DrRem("Cantidad").ToString.ToDecimal, DrRem("CveUM").ToString.ToEntero, DrRem("CvePS").ToString.ToEntero, DrRem("PU").ToString.ToDecimal, DrRem("CveActivoFijo").ToString.ToEntero, -1, DrRem("SerieLote").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=DrRem("Lote").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, DrRem("Cantidad").ToString.ToDecimal, DrRem("CveUM").ToString.ToEntero, DrRem("CvePS").ToString.ToEntero, DrRem("PU").ToString.ToDecimal, CveAF:=DrRem("CveActivoFijo").ToString.ToEntero, Serie:=DrRem("Serie").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=DrRem("Lote").ToString) Then ErrorCancelar = True Exit For End If @@ -5033,7 +5033,7 @@ Namespace Modelos If Not ErrorCancelar Then If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString) Then ErrorCancelar = True Exit For End If @@ -5088,7 +5088,7 @@ Namespace Modelos Exit For End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaApartado, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaApartado, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString) Then ErrorCancelar = True Exit For End If @@ -5111,7 +5111,7 @@ Namespace Modelos If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString) Then ErrorCancelar = True Exit For End If diff --git a/Ashx/SIGFacturacion.ashx b/Ashx/SIGFacturacion.ashx index a98d3c130..461d85c62 100644 --- a/Ashx/SIGFacturacion.ashx +++ b/Ashx/SIGFacturacion.ashx @@ -542,7 +542,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState TmpDT.Columns.Add("NoIdentificacion", GetType(String)) TmpDT.Columns.Add("CveTipoPS", GetType(Integer)) TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) - TmpDT.Columns.Add("SerieLote", GetType(String)) + TmpDT.Columns.Add("Serie", GetType(String)) TmpDT.Columns.Add("CuentaPredial", GetType(String)) TmpDT.Columns.Add("Obs", GetType(String)) TmpDT.Columns.Add("TiempoEntrega", GetType(String)) @@ -629,7 +629,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Private Function AgregarProductoServicio(ByRef Retorno As Modelos.Factura.MMensajeFactura, UsuarioActual As Usuario, TmpDT As DataTable, Consec As Integer, Cantidad As Double, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String, PU As Decimal, Descuento As Decimal, CveSubProyecto As Integer, - Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, + Optional Serie As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, @@ -682,7 +682,7 @@ Public Class SIGFacturacion : Implements IHttpHandler, IRequiresSessionState Row("Proyecto") = DrSubProyecto("Proyecto").ToString() Row("CveSubProyecto") = CveSubProyecto Row("SubProyecto") = DrSubProyecto("SubProyecto").ToString() - Row("SerieLote") = SerieLote + Row("Serie") = Serie Row("TiempoEntrega") = TiempoEntrega Row("Orden") = TmpDT.Rows.Count + 1 Row("Cantidad") = Cantidad diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index 8ae61eb7e..ff6662eda 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -533,11 +533,11 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState retorno = JsonConvert.SerializeObject(DtPSRetorno).ToString context.Response.Write(retorno) - + DtPSRetorno.Dispose() Else context.Response.Write("[]") End If - DtPSRetorno.Dispose() + End If Return retorno diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index beb0c14e3..7e142edeb 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -5049,7 +5049,7 @@ Partial Class Bancos_IE Filtro = "" End If - If ObjBancos.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) And ObjBancos.DtResultados.FiltraParametros(Filtro).Rows.Count > 0 Then + If CveIE > 0 AndAlso ObjBancos.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) AndAlso ObjBancos.DtResultados.FiltraParametros(Filtro).Rows.Count > 0 Then Retorno = True Else Retorno = False diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index 6d65cb6d8..587e2dafd 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -1392,8 +1392,8 @@ Partial Class Bancos_PopIEVentas End If Dim MsgError As String = "" - Dim CveConcepto As Integer = -1 - Dim CveConcepto2 As Integer = -1 + Dim CveConceptoPrePoliza As Integer = -1 + Dim CveConceptoPrePoliza2 As Integer = -1 Dim CvePersonal As Integer = -1 Dim Inserta As Boolean = True Dim ImportePagado As Decimal = 0 @@ -1412,7 +1412,7 @@ Partial Class Bancos_PopIEVentas Case "2" 'FyE ImportePagado = TxtImporte.Text.Trim.ToDecimal Fecha = TxtFechaDocumento.Text.Trim.ToDate - CveConcepto = 29 + CveConceptoPrePoliza = 29 CveIE = -1 TipoMovimiento = True Dim stringPersonal As String = DdlFuncionarioEmpleado.SelectedItem.ToString @@ -1421,8 +1421,8 @@ Partial Class Bancos_PopIEVentas ImportePagado = TxtImporte.Text.Trim.ToDecimal Case "4" 'Deudores Diversos ImportePagado = TxtImporte.Text.Trim.ToDecimal - CveConcepto = 17 - CveConcepto2 = 37 + CveConceptoPrePoliza = 17 + CveConceptoPrePoliza2 = 37 CveIE = -1 Case "5" 'Compras ImportePagado = TxtImporte.Text.Trim.ToDecimal @@ -1526,7 +1526,7 @@ Partial Class Bancos_PopIEVentas CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, Fecha, TxtFolio.Text.Trim, TxtPagueseA.Text.Trim, ImportePagado, CveMoneda, tipoCambioPago, TxtObservaciones.Text.Trim, "", True, True, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaTarjeta:=If(DivTarjeta.Visible, DdlTarjeta.SelectedValue.ToEntero, -1), CveCuentaDeposito:=CveCuentaDeposito, Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"), CveCorte:=CveCorte) If CveIE > 0 Then If CveVenta > 0 Then - CveConcepto = 2 + CveConceptoPrePoliza = 2 End If Else MsgError = "Ocurrio un Error al registrarse el movimiento bancario." @@ -1534,8 +1534,8 @@ Partial Class Bancos_PopIEVentas End If Case "3" 'Ingresos x Comprobar If CveVenta > 0 Then - CveConcepto = 2 - CveConcepto2 = 92 + CveConceptoPrePoliza = 2 + CveConceptoPrePoliza2 = 92 CveCliente = DdlIngreso.SelectedValue.ToEntero CveIE = -1 ImportePagado = TxtImporte.Text.Trim.ToDecimal @@ -1543,18 +1543,20 @@ Partial Class Bancos_PopIEVentas Case "4" 'Deudores Diversos If CveVenta > 0 Then ImportePagado = TxtImporte.Text.Trim.ToDecimal - CveConcepto = 2 - CveConcepto2 = 43 + CveConceptoPrePoliza = 2 + CveConceptoPrePoliza2 = 43 CveProveedor2 = DdlDeudor.SelectedValue.ToEntero CveIE = -1 End If Case "5" 'Compras If CveVenta > 0 Then ImportePagado = TxtImporte.Text.Trim.ToDecimal - CveConcepto = 2 + CveConceptoPrePoliza = 2 'CveConcepto2 = 43 CveIE = -1 End If + Case Else + MsgError = "No se ha especificada opcion." End Select @@ -1871,17 +1873,17 @@ Partial Class Bancos_PopIEVentas ImporteMX = ImporteMovimiento ElseIf CveMoneda = 1 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = MovimientoPagar.IVA * PorcentajePago + ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * tipoCambioVenta ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 1 Then ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago) ImporteMX = ImporteMovimiento ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = MovimientoPagar.IVA * PorcentajePago + ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * tipoCambioVenta End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL ImporteMX = Math.Round(ImporteMX, 2) TimpocambioGeneral = tipoCambioVenta CveSubProyectoContabilizar = CveSubProyectoVenta @@ -1907,17 +1909,17 @@ Partial Class Bancos_PopIEVentas ImporteMX = ImporteMovimiento ElseIf CveMoneda = 1 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 1 Then ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago) ImporteMX = ImporteMovimiento ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = MovimientoPagar.IVA * PorcentajePago + ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL ImporteMX = Math.Round(ImporteMX, 2) TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) CveSubProyectoContabilizar = CveSubProyectoVenta @@ -1942,17 +1944,17 @@ Partial Class Bancos_PopIEVentas ImporteMX = ImporteMovimiento ElseIf CveMoneda = 1 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = MovimientoPagar.IEPS * PorcentajePago + ImporteMovimiento = (MovimientoPagar.IEPS * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * tipoCambioVenta ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 1 Then ImporteMovimiento = (MovimientoPagar.IEPS * PorcentajePago) ImporteMX = ImporteMovimiento ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = (MovimientoPagar.IEPS * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.IEPS * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * tipoCambioVenta End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL ImporteMX = Math.Round(ImporteMX, 2) TimpocambioGeneral = tipoCambioVenta CveSubProyectoContabilizar = CveSubProyectoVenta @@ -1970,17 +1972,17 @@ Partial Class Bancos_PopIEVentas ImporteMX = ImporteMovimiento ElseIf CveMoneda = 1 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = (MovimientoPagar.IEPS * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.IEPS * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 1 Then ImporteMovimiento = (MovimientoPagar.IEPS * PorcentajePago) ImporteMX = ImporteMovimiento ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = (MovimientoPagar.IEPS * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.IEPS * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL ImporteMX = Math.Round(ImporteMX, 2) TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) CveSubProyectoContabilizar = CveSubProyectoVenta @@ -1999,14 +2001,14 @@ Partial Class Bancos_PopIEVentas ImporteMX = ImporteMovimiento ElseIf CveMoneda = 1 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 1 Then ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago) ImporteMX = ImporteMovimiento ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) End If ImporteMovimiento = Math.Round(ImporteMovimiento, 2) @@ -2045,14 +2047,14 @@ Partial Class Bancos_PopIEVentas ImporteMX = ImporteMovimiento ElseIf CveMoneda = 1 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = (MovimientoPagar.RetISR * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.RetISR * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 1 Then ImporteMovimiento = (MovimientoPagar.RetISR * PorcentajePago) ImporteMX = ImporteMovimiento ElseIf CveMoneda = 2 AndAlso CveMonedaVenta = 2 Then tipoCambioVenta = TipoCambioOriginal - ImporteMovimiento = (MovimientoPagar.RetISR * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.RetISR * PorcentajePago).RoundSQL ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) End If ImporteMovimiento = Math.Round(ImporteMovimiento, 2) @@ -2109,9 +2111,13 @@ Partial Class Bancos_PopIEVentas If tImporteVenta <> tImportePago Then If tImporteVenta < tImportePago Then - CveConcepto = 64 + ConceptoContable = 64 + IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria + TipoMovimiento = True Else - CveConcepto = 65 + ConceptoContable = 65 + IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria + TipoMovimiento = False End If Diferencia = Math.Abs(tImporteVenta - tImportePago) End If @@ -2128,6 +2134,8 @@ Partial Class Bancos_PopIEVentas Diferencia = Math.Round(Diferencia, 2) End If + ImporteMovimiento = Math.Abs(Diferencia) + ImporteMX = ImporteMovimiento '' se considera, las diferencias, y no el tipo de cambio, por el caso de las fluctuaciones @@ -3455,27 +3463,22 @@ Partial Class Bancos_PopIEVentas ImporteMovimiento = 0 End Select - If ImporteMovimiento <> 0 Then + If ImporteMovimiento <> 0 AndAlso MsgError = "" Then 'Conta ContPAQ If IdCtaContable = 0 Then CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) idCuentaContabilizacion = 0 End If - 'Conta SIG - If CveCuenta = 0 Then - CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) - CveCuentaContabilizacion = 0 - End If - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ReferenciaConcepto, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, CveCliente:=CveClienteOriginal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, CvePersonal:=CvePersonal, TipoCambio:=TimpocambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto) Then MsgError = "No se pudo insertar la póliza" + Exit For End If End If Next - If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 3) Then + If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 3) Then If ObjMov.ValorPolizaDescuadre > 0 Then MsgError = ObjMov.MensajePolizaDescuadre End If diff --git a/Bancos/ProductosServicios.aspx.vb b/Bancos/ProductosServicios.aspx.vb deleted file mode 100644 index bf0e4c9d4..000000000 --- a/Bancos/ProductosServicios.aspx.vb +++ /dev/null @@ -1,840 +0,0 @@ -Option Explicit On -Option Strict On - -Imports Extensiones -Imports System.Data - -Partial Class ProductosyServicios - Inherits ClsPaginas - -#Region " Propiedades " - Private ReadOnly Property CvePS As Integer - Get - Return ViewState("CvePS").ToString.ToEntero - End Get - End Property - Private Property Ret As String - Get - Return ViewState("Ret").ToString - End Get - Set(value As String) - ViewState("Ret") = value - End Set - End Property - Public Property dtPaqueteDetalles() As DataTable - Get - Return CType(ViewState("dtPaqueteDetalles"), DataTable) - End Get - Set(value As DataTable) - ViewState("dtPaqueteDetalles") = value - End Set - End Property - Public Property dtFamily() As DataTable - Get - Return CType(ViewState("dtFamily"), DataTable) - End Get - Set(value As DataTable) - ViewState("dtFamily") = value - End Set - End Property -#End Region - - - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - ViewState("OrdenO") = "" - ViewState("OrdenC") = "" - ViewState("DTProductosServiciosCaracteristicas") = Nothing - ViewState("DTProductosServiciosCaracteristicasOpciones") = Nothing - ViewState("CveSubFamilia") = "-1" - Ret = "-1" - 'CType(Me.Master, BaseMasterPage).EsPopup = True - 'CType(Me.Master, BaseMasterPage).PopupWidth = 700 - 'RegistraScript("$get('tdContenido').style.height='350px'") - - CargaClasificaciones() - CargaUnidadesMedida() - CargarMetodosInv() - - - If UsuarioActual.Empresa.UsaContabilidad Then - CargaCuentasContables() - End If - If Request("CvePS") IsNot Nothing AndAlso IsNumeric(Request("CvePS")) AndAlso Request("CvePS").ToEntero > 0 Then - ViewState("CvePS") = Request("CvePS") - CargaDatos() - 'Configuración de Modalidad Update - BtnGuardar.Text = "Guardar Cambios" - - LoadCaracteristicas() - CargarAlias() - Else - 'Configuración de Modalidad Insert - ViewState("CvePS") = -1 - ChkEstado.Enabled = False - ChkEstado.Checked = True - LblFechaCaptura.Text = Now.ToShortDateString() - LblUsuarioCapturo.Text = UsuarioActual.Usuario - BtnEliminar.Visible = False - End If - - If Request("Ret") IsNot Nothing AndAlso Request("Ret").ToString <> "" Then - Ret = Request("Ret") - End If - CargaFamilia(ViewState("CveSubFamilia").ToString.ToEntero) - CargaDefault() - CargaSucursaless() - - - If UsuarioActual.TienePermisoProceso(122) Then - BtnEliminar.Visible = False - BtnGuardar.Visible = False - End If - End If - End Sub - -#Region "S U C U R S A L E S" - Private Sub CargaSucursaless() - 'Dim dtSuc As DataTable = GlobalDTSucursales().FiltraParametros("CveEmpresa = " + UsuarioActual.CveEmpresa.ToString) - 'dtSuc.AcceptChanges() - - 'dtSuc.Columns.Add("Importe") - 'dtSuc.Columns.Add("Activo") - - 'For Each row As DataRow In dtSuc.Rows - ' row("Activo") = False - 'Next - 'dtSuc.AcceptChanges() - - 'If Not ViewState("CvePS") Is Nothing Then - ' Dim ObjPS As New ClsProductosServicios - - ' If ObjPS.GetPSSucursales(CvePS) Then - ' Dim dtSucP As DataTable = ObjPS.DtResultados - - ' For Each Row As DataRow In dtSucP.Rows - ' Dim rowsToUpdate = dtSuc.AsEnumerable().Where(Function(r) r.Field(Of Integer)("CveSucursal") = Row("CveSucursal").ToString.ToEntero AndAlso r!CveSucursal.ToString.ToEntero > 0) - - ' For Each roww As DataRow In rowsToUpdate - ' roww.SetField("Importe", Row("Importe")) - ' roww.SetField("Activo", True) - ' Next - - ' 'For Each drtt As DataRow In TmpDT.Select(String.Format("PS='{0}' AND CvePS=0", Row("PS"))) - ' ' drtt("CvePS") = tCve - ' 'Next - - - ' dtSuc.AcceptChanges() - ' Next - ' End If - - ' ObjPS.Dispose() - 'End If - - 'gvSucursal.DataSource = dtSuc - 'gvSucursal.DataBind() - - Dim ObjPS As New ClsProductosServicios - - If ObjPS.GetPSSucursales(CvePS, UsuarioActual.CveEmpresa) Then - gvSucursal.DataSource = ObjPS.DtResultados - gvSucursal.DataBind() - End If - - ObjPS.Dispose() - End Sub - - Protected Sub gvSucursal_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles gvSucursal.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(50) - e.Row.Cells(1).Width = Unit.Pixel(100) - e.Row.Cells(2).Width = Unit.Pixel(100) - End If - - ' If e.Row.FCCheckBox("chkSucursal").Checked = True Then e.Row.Cells(0).BackColor = Drawing.Color.Yellow - End If - End Sub -#End Region - -#Region "C A R A C T E R I S T I C A S" - Private Sub LoadCaracteristicas() - ViewState("OrdenC") = "" - CargaDatosC() - - CargaProductosServiciosCaracteristicas() - CargaDatosO() - End Sub - - Public Sub CargaDefault() - - Dim ObjCaracteristicas As New ClsGralProductosServiciosCaracteristicas - If ObjCaracteristicas.GetProductosServiciosCaracteristicas() Then - ViewState("DTProductosServiciosCaracteristicas") = ObjCaracteristicas.DtResultados.Clone - End If - - If ObjCaracteristicas.GetProductosServiciosCaracteristicasOpciones() Then - ViewState("DTProductosServiciosCaracteristicasOpciones") = ObjCaracteristicas.DtResultados.Clone - End If - ObjCaracteristicas.Dispose() - End Sub - - Public Sub CargaDatosC() - Dim ObjCaracteristicas As New ClsGralProductosServiciosCaracteristicas - If ObjCaracteristicas.GetProductosServiciosCaracteristicas() Then - ViewState("DTProductosServiciosCaracteristicas") = ObjCaracteristicas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTProductosServiciosCaracteristicas(UsuarioActual.CveEmpresa) = ObjCaracteristicas.DtResultados - Else - Me.GvDatosCaracteristicas.DataSource = Nothing - End If - - If ViewState("OrdenC").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenC").ToString(), 0) - Else - CargaGrid("", 0) - End If - End Sub - - Public Sub CargaDatosO() - Dim ObjOpciones As New ClsGralProductosServiciosCaracteristicas - If ObjOpciones.GetProductosServiciosCaracteristicasOpciones() Then - ViewState("DTProductosServiciosCaracteristicasOpciones") = ObjOpciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTProductosServiciosCaracteristicasOpciones(UsuarioActual.CveEmpresa) = ObjOpciones.DtResultados - Else - GvDatosOpciones.DataSource = Nothing - End If - - If ViewState("OrdenO").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenO").ToString(), 1) - Else - CargaGrid("", 1) - End If - End Sub - - Protected Sub LbAgregarC_Click(sender As Object, e As System.EventArgs) Handles LbAgregarC.Click - Dim ObjCaracteristicas As New ClsGralProductosServiciosCaracteristicas - If ObjCaracteristicas.AddProductosServiciosCaracteristicas(TxtCaracteristica.Text.Trim, CvePS, ChkEsOpcion.Checked, UsuarioActual.CveUsuario) Then - TxtCaracteristica.Text = "" - Alert("La nueva Característica de Producto o Servicio se guardó correctamente.", TipoMensaje.MsgInformacion) - ViewState("DTProductosServiciosCaracteristicas") = ObjCaracteristicas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTProductosServiciosCaracteristicas(UsuarioActual.CveEmpresa) = ObjCaracteristicas.DtResultados - - CambioProductosServiciosCaracteristicas() - End If - ObjCaracteristicas.Dispose() - End Sub - - Protected Sub LbAgregarO_Click(sender As Object, e As System.EventArgs) Handles LbAgregarO.Click - Dim ObjOpciones As New ClsGralProductosServiciosCaracteristicas - If ObjOpciones.AddProductosServiciosCaracteristicasOpciones(TxtOpcion.Text.Trim, DdlCaracteristica.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then - TxtOpcion.Text = "" - Alert("La nueva Opción para Característica de Producto o Servicio se guardó correctamente.", TipoMensaje.MsgInformacion) - ViewState("DTProductosServiciosCaracteristicasOpciones") = ObjOpciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTProductosServiciosCaracteristicasOpciones(UsuarioActual.CveEmpresa) = ObjOpciones.DtResultados - - CambioProductosServiciosCaracteristicasOpciones() - End If - ObjOpciones.Dispose() - End Sub - - Private Sub CargaProductosServiciosCaracteristicas() - DdlCaracteristica.Items.Clear() - DdlCaracteristica.DataSource = GlobalDTProductosServiciosCaracteristicas(UsuarioActual.CveEmpresa).FiltraParametros("EsOpcion = 'Sí' AND CvePS = " + CvePS.ToString) - DdlCaracteristica.DataBind() - End Sub - - Protected Sub DdlCaracteristica_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCaracteristica.SelectedIndexChanged - If ViewState("OrdenO").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenO").ToString(), 1) - Else - CargaGrid("", 1) - End If - End Sub - - Protected Sub CambioProductosServiciosCaracteristicas() - CargaProductosServiciosCaracteristicas() - UpTitulosC.Update() - CargaDatosC() - CambioProductosServiciosCaracteristicasOpciones() - End Sub - - Protected Sub CambioProductosServiciosCaracteristicasOpciones() - UpTitulosO.Update() - CargaDatosO() - End Sub -#End Region - -#Region "G V C A R A C T E R I S T I C A S" - - Protected Sub GvDatosCaracteristicas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatosCaracteristicas.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(150) - e.Row.Cells(1).Width = Unit.Pixel(100) - e.Row.Cells(2).Width = Unit.Pixel(100) - e.Row.Cells(3).Width = Unit.Pixel(100) - e.Row.Cells(4).Width = Unit.Pixel(50) - e.Row.Cells(5).Width = Unit.Pixel(50) - End If - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - - If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then - 'e.Row.FCDropDownList("DdlPSEdit").DataSource = ViewState("DTPS") - 'e.Row.FCDropDownList("DdlPSEdit").DataBind() - 'e.Row.FCDropDownList("DdlPSEdit").SelectedValue = e.Row.DBCampo("CvePS") - End If - End If - End Sub - - Protected Sub GvDatosCaracteristicas_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatosCaracteristicas.RowDeleting - Dim ObjCaracteristicas As New ClsGralProductosServiciosCaracteristicas - If ObjCaracteristicas.RemoveProductosServiciosCaracteristica(GvDatosCaracteristicas.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - GvDatosCaracteristicas.EditIndex = -1 - ViewState("DTProductosServiciosCaracteristicas") = ObjCaracteristicas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTProductosServiciosCaracteristicas(UsuarioActual.CveEmpresa) = ObjCaracteristicas.DtResultados - Alert("La Característica del Producto o Servicio se eliminó correctamente.", TipoMensaje.MsgInformacion) - - CambioProductosServiciosCaracteristicas() - End If - - ObjCaracteristicas.Dispose() - End Sub - - Protected Sub GvDatosCaracteristicas_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvDatosCaracteristicas.RowCancelingEdit - GvDatosCaracteristicas.EditIndex = -1 - If ViewState("OrdenC").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenC").ToString(), 0) - Else - CargaGrid("", 0) - End If - End Sub - - Protected Sub GvDatosCaracteristicas_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatosCaracteristicas.RowUpdating - Dim ObjCaracteristicas As New ClsGralProductosServiciosCaracteristicas - Dim CveCaracteristica As Integer = GvDatosCaracteristicas.DataKeys(e.RowIndex).Value.ToString.ToEntero - - Dim Caracteristica As String = DirectCast(GvDatosCaracteristicas.Rows(e.RowIndex).FindControl("TxtCaracteristica"), TextBox).Text.Trim - Dim EsOpcion As Boolean = GvDatosCaracteristicas.Rows(e.RowIndex).FCCheckBox("ChkEsOpcion").Checked - - If ObjCaracteristicas.UpdateProductosServiciosCaracteristica(Caracteristica, CvePS, EsOpcion, CveCaracteristica) Then - GvDatosCaracteristicas.EditIndex = -1 - ViewState("DTProductosServiciosCaracteristicas") = ObjCaracteristicas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTProductosServiciosCaracteristicas(UsuarioActual.CveEmpresa) = ObjCaracteristicas.DtResultados - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) - - CambioProductosServiciosCaracteristicas() - End If - - ObjCaracteristicas.Dispose() - End Sub - - Protected Sub GvDatosCaracteristicas_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvDatosCaracteristicas.RowEditing - GvDatosCaracteristicas.EditIndex = e.NewEditIndex - If ViewState("OrdenC").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenC").ToString(), 0) - Else - CargaGrid("", 0) - End If - End Sub -#End Region - -#Region "G V O P C I O N E S" - Protected Sub GvDatosOpciones_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatosOpciones.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(150) - e.Row.Cells(1).Width = Unit.Pixel(150) - e.Row.Cells(2).Width = Unit.Pixel(100) - e.Row.Cells(3).Width = Unit.Pixel(100) - e.Row.Cells(4).Width = Unit.Pixel(50) - e.Row.Cells(5).Width = Unit.Pixel(50) - End If - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - - If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then - e.Row.FCDropDownList("DdlCaracteristicaEdit").DataSource = GlobalDTProductosServiciosCaracteristicas(UsuarioActual.CveEmpresa).FiltraParametros("CvePS = " + CvePS.ToString) - e.Row.FCDropDownList("DdlCaracteristicaEdit").DataBind() - e.Row.FCDropDownList("DdlCaracteristicaEdit").SelectedValue = e.Row.DBCampo("CvePS") - End If - End If - End Sub - - Protected Sub GvDatosOpciones_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatosOpciones.RowDeleting - Dim ObjOpciones As New ClsGralProductosServiciosCaracteristicas - If ObjOpciones.RemoveProductosServiciosCaracteristicasOpciones(GvDatosOpciones.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - GvDatosOpciones.EditIndex = -1 - ViewState("DTProductosServiciosCaracteristicasOpciones") = ObjOpciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTProductosServiciosCaracteristicasOpciones(UsuarioActual.CveEmpresa) = ObjOpciones.DtResultados - Alert("La Opción para Caracteristica del Producto o Servicio se eliminó correctamente.", TipoMensaje.MsgInformacion) - - CambioProductosServiciosCaracteristicasOpciones() - End If - - ObjOpciones.Dispose() - End Sub - - Protected Sub GvDatosOpciones_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvDatosOpciones.RowCancelingEdit - GvDatosOpciones.EditIndex = -1 - If ViewState("OrdenO").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenO").ToString(), 1) - Else - CargaGrid("", 1) - End If - End Sub - - Protected Sub GvDatosOpciones_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatosOpciones.RowUpdating - Dim ObjOpciones As New ClsGralProductosServiciosCaracteristicas - Dim CveCaracteristica As Integer = DirectCast(GvDatosOpciones.Rows(e.RowIndex).FindControl("DdlCaracteristicaEdit"), DropDownList).SelectedValue.ToEntero - Dim CveOpcion As Integer = GvDatosOpciones.DataKeys(e.RowIndex).Value.ToString.ToEntero - - Dim Opcion As String = DirectCast(GvDatosOpciones.Rows(e.RowIndex).FindControl("TxtOpcion"), TextBox).Text.Trim - - If ObjOpciones.UpdateProductosServiciosCaracteristicasOpciones(Opcion, CveCaracteristica, CveOpcion) Then - GvDatosOpciones.EditIndex = -1 - ViewState("DTProductosServiciosCaracteristicasOpciones") = ObjOpciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTProductosServiciosCaracteristicasOpciones(UsuarioActual.CveEmpresa) = ObjOpciones.DtResultados - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) - - CambioProductosServiciosCaracteristicasOpciones() - End If - - ObjOpciones.Dispose() - End Sub - - Protected Sub GvDatosOpciones_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvDatosOpciones.RowEditing - GvDatosOpciones.EditIndex = e.NewEditIndex - If ViewState("OrdenO").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenO").ToString(), 1) - Else - CargaGrid("", 1) - End If - End Sub -#End Region - -#Region "O R D E N A M I E N T O" - Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs) - Dim Orden As String = "" - Dim Campo As String = "" - Dim gvi As Integer = 0 - Dim Literal As Literal = Nothing - Const OrdenInicial As String = "" - Dim Arg(2) As String - - Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) - Campo = Arg(0) - gvi = Arg(1).ToEntero - Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal) - Campo = Campo.Substring(0, Campo.Length - 1) - - If ViewState(String.Format("O{0}", Campo, gvi)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo, gvi)).ToString = String.Format("{0} DESC", Campo) Then - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) - Literal.Text = String.Format("") - Else - ViewState(String.Format("O{0}", Campo, gvi)) = String.Format("{0} DESC", Campo) - Literal.Text = String.Format("") - End If - Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo, gvi)).ToString - ViewState("Orden") = Orden - CargaGrid(Orden, gvi) - End Sub - - Private Sub CargaGrid(Orden As String, gvi As Integer) - Dim Filtro As String = "" - If gvi = 0 Then - Filtro = "CvePS = " + CvePS.ToString - If Orden <> String.Empty Then - Dim DV As New DataView(CType(ViewState("DTProductosServiciosCaracteristicas"), DataTable), Filtro, Orden, DataViewRowState.CurrentRows) - GvDatosCaracteristicas.DataSource = DV.ToTable() - DV.Dispose() - Else - GvDatosCaracteristicas.DataSource = New DataView(GlobalDTProductosServiciosCaracteristicas(UsuarioActual.CveEmpresa), Filtro, "", DataViewRowState.CurrentRows) - End If - ViewState("OrdenC") = Orden - GvDatosCaracteristicas.DataBind() - UpDatosC.Update() - ElseIf gvi = 1 Then - If Not DdlCaracteristica.SelectedItem Is Nothing Then - Filtro = "CvePSCaracteristica = " + DdlCaracteristica.SelectedItem.Value.ToString - Else - Filtro = "1 = 2" - End If - - If Orden <> String.Empty Then - Dim DV As New DataView(CType(ViewState("DTProductosServiciosCaracteristicasOpciones"), DataTable), Filtro, Orden, DataViewRowState.CurrentRows) - GvDatosOpciones.DataSource = DV.ToTable() - DV.Dispose() - Else - GvDatosOpciones.DataSource = New DataView(GlobalDTProductosServiciosCaracteristicasOpciones(UsuarioActual.CveEmpresa), Filtro, "", DataViewRowState.CurrentRows) - End If - ViewState("OrdenO") = Orden - GvDatosOpciones.DataBind() - UpDatosO.Update() - End If - End Sub -#End Region - - Private Sub CargaClasificaciones() - DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) - DdlClasificacion.DataBind() - DdlClasificacion.Items.Insert(1, New ListItem("Sin Clasificacion", "0")) - DdlClasificacion.SelectedValueExist("0") - - 'BLOQUEA DDL CLASIFICACION - If UsuarioActual.Empresa.Funcionalidad(121) = "1" Then - If Not UsuarioActual.TienePermisoProceso(147) Then - DdlClasificacion.Enabled = False - End If - End If - - End Sub - - Private Sub CargarMetodosInv() - 'Dim ps As New ClsProductosServicios - 'ps.GetMetodosInv() - - - 'ddlMetodos.DataSource = ps.DtResultados - ' ps.Dispose() - ddlMetodos.DataSource = GlobalDTInvMetodosInventario - ddlMetodos.DataBind() - ddlMetodos.Items.Insert(0, New ListItem("Seleccione", "-1")) - - End Sub - - Private Sub CargaUnidadesMedida() - DdlUnidadMedida.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) - DdlUnidadMedida.DataBind() - End Sub - - Private Sub CargaCuentasContables() - 'Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa.ServerContPAQi, UsuarioActual.Empresa.BDContPAQi, UsuarioActual.Empresa.UsrContPAQi, UsuarioActual.Empresa.PwdContPAQi) - 'If ObjContabilidad.GetCuentas(-1, "-1", -1) Then - ' DdlCtaContableVentas.DataSource = ObjContabilidad.DtResultados - ' DdlCtaContableCompras.DataSource = ObjContabilidad.DtResultados - ' DdlCtaContableInventarios.DataSource = ObjContabilidad.DtResultados - 'Else - ' DdlCtaContableVentas.DataSource = Nothing - ' DdlCtaContableCompras.DataSource = Nothing - ' DdlCtaContableInventarios.DataSource = Nothing - 'End If - 'DdlCtaContableVentas.DataBind() - 'DdlCtaContableCompras.DataBind() - 'DdlCtaContableInventarios.DataBind() - 'ObjContabilidad.Dispose() - End Sub - -#Region "Familias" - Protected Sub DdlFamilia_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlFamilia.SelectedIndexChanged - CargaDdlSubFamilia() - DdlSubFamilia.SelectedValue = "-1" - End Sub - Public Sub CargaFamilia(Optional CveSubFamilia As Integer = 0) - dtFamily = GlobalDTSubFamilias(UsuarioActual.CveEmpresa) - CargaDdlFamilia() - If dtFamily.FiltraParametros(String.Format("CveClasificacion={0}", CveSubFamilia)).Rows.Count > 0 Then - DdlFamilia.SelectedValue = dtFamily.FiltraParametros(String.Format("CveClasificacion={0}", CveSubFamilia)).Rows(0)("CveCategoria").ToString - End If - CargaDdlSubFamilia() - - If CveSubFamilia > 0 Then - DdlSubFamilia.SelectedValue = CveSubFamilia.ToString - End If - End Sub - - - Public Sub CargaDdlFamilia() - ' Alert( GlobalDTFamilias(UsuarioActual.CveEmpresa).Rows.Count.ToString()) - DdlFamilia.DataSource = GlobalDTFamilias(UsuarioActual.CveEmpresa) - DdlFamilia.DataBind() - End Sub - Public Sub CargaDdlSubFamilia() - DdlSubFamilia.DataSource = dtFamily.FiltraParametros(String.Format("CveCategoria={0}", DdlFamilia.SelectedValue), "CveClasificacion") - DdlSubFamilia.DataBind() - DdlSubFamilia.Items.Insert(0, New ListItem("----", "-1")) - End Sub -#End Region - - Private Sub CargaDatos() - Dim ObjProductosServicios As New ClsProductosServicios() - If ObjProductosServicios.GetPS(CvePS, -1, UsuarioActual.CveEmpresa) Then - If ObjProductosServicios.DtResultados.Rows.Count > 0 Then - - 'SI NO TIENE VALOR Y NO TIENE EL PROCESO MUESTRA SIN CLASIFICACION - If ObjProductosServicios.CveClasificacion.ToString.Equals("-1") And Not UsuarioActual.TienePermisoProceso(147) And UsuarioActual.Empresa.Funcionalidad(121) = "1" Then - DdlClasificacion.SelectedValueExist("0") - Else - DdlClasificacion.SelectedValueExist(ObjProductosServicios.CveClasificacion.ToString) - End If - - DdlUnidadMedida.SelectedValue = ObjProductosServicios.CveUnidadMedida.ToString - DdlTipoPS.SelectedValue = ObjProductosServicios.CveTipoPS.ToString - DdlCtaContableVentas.SelectedValue = ObjProductosServicios.IdCtaContVentas.ToString - DdlCtaContableCompras.SelectedValue = ObjProductosServicios.IdCtaContCompras.ToString - DdlCtaContableInventarios.SelectedValue = ObjProductosServicios.IdCtaContInventarios.ToString - DdlAsientoContVentas.SelectedValue = ObjProductosServicios.AsientoContableVentas.ToString - DdlAsientoContCompras.SelectedValue = ObjProductosServicios.AsientoContableCompras.ToString - TxtCodigo.Text = ObjProductosServicios.Codigo - TxtCodigo2.Text = ObjProductosServicios.Codigo2 - TxtCodigoBarras.Text = ObjProductosServicios.CodigoBarras - TxtPS.Text = ObjProductosServicios.PS - TxtPrecio.Text = ObjProductosServicios.Precio.ToString("F4") 'no usa N4, porque pone comma - DdlIVA.SelectedValue = ObjProductosServicios.IVA.ToString - TxtRetIVA.Text = (ObjProductosServicios.RetIVA * 100).ToString - TxtMG.Text = ObjProductosServicios.MargenGanancia.ToString - ChkEstado.Checked = ObjProductosServicios.Estado - LblFechaCaptura.Text = ObjProductosServicios.Fecha.ToShortDateString - LblUsuarioCapturo.Text = ObjProductosServicios.Usuario - ChkAplicaParaConcepto.Checked = ObjProductosServicios.AplicaParaConcepto - ChkAplicaParaVenta.Checked = ObjProductosServicios.AplicaParaVenta - lbTitulo.Text = lbTitulo.Text & ObjProductosServicios.PS - ddlMetodos.SelectedValue = ObjProductosServicios.CveMetodoInventario.ToString - - If ObjProductosServicios.CveMetodoInventario = 0 Then ddlMetodos.SelectedValue = UsuarioActual.Empresa.CveMetodoInventario.ToString - - ViewState("CveSubFamilia") = ObjProductosServicios.DtResultados.Rows(0)("CveSubFamilia") - Else - Alert("El Producto o Servicio Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) - BtnGuardar.Enabled = False - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(105) = "" Then - ddlProducto.DataSource = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltraParametros("CvePS <>" & CvePS, "PS") - ddlProducto.DataBind() - DdlProductows.Visible = False - Else - ddlProducto.Visible = False - End If - If ObjProductosServicios.GetPaqueteDetalle(CvePS) Then - gvPaqueteDetalle.DataSource = ObjProductosServicios.DtResultados - dtPaqueteDetalles = ObjProductosServicios.DtResultados - gvPaqueteDetalle.DataBind() - End If - ddlUnidad.DataSource = GlobalDTUnidadesMedida() - ddlUnidad.DataBind() - ObjProductosServicios.Dispose() - End Sub - - Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click - 'Dim CerrarVentana As String = "opener.location.reload();window.close();" - 'If Request("Popup") IsNot Nothing Then CerrarVentana = "self.parent.tb_remove();self.parent.location.reload();window.close();" - - - If (TxtCodigo.Text = TxtCodigo2.Text AndAlso TxtCodigo.Text <> "") Or - (TxtCodigo2.Text = TxtCodigoBarras.Text AndAlso TxtCodigo2.Text <> "") Or (TxtCodigo.Text = TxtCodigoBarras.Text AndAlso TxtCodigo.Text <> "") Then - Alert("Los codigos no pueden ser iguales. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Return - End If - - If DdlSubFamilia.SelectedValue = "-1" AndAlso UsuarioActual.TienePermisoProceso(138) Then - Alert("Se debe especificar Familia y Subfamilia de Costos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - - Dim ObjProductosServicios As New ClsProductosServicios() - Dim EsPaquete As Integer = If(gvPaqueteDetalle.Rows.Count = 0, 0, 1) - Dim CveMetodoInv As Integer = If(UsuarioActual.Empresa.UsaInventarios, ddlMetodos.SelectedValue.ToEntero, -1) - - - If CvePS = -1 Then - If ObjProductosServicios.AddPS(DdlClasificacion.SelectedValue.ToEntero, DdlSubFamilia.SelectedValue.ToEntero, DdlUnidadMedida.SelectedValue.ToEntero, TxtCodigo.Text.Trim, TxtCodigo2.Text.Trim, TxtCodigoBarras.Text.Trim, TxtPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, DdlIVA.SelectedValue.ToDouble, (TxtRetIVA.Text.Trim.ToDouble / 100), TxtMG.Text.Trim.ToDouble, DdlCtaContableVentas.SelectedValue.ToEntero, DdlCtaContableCompras.SelectedValue.ToEntero, DdlCtaContableInventarios.SelectedValue.ToEntero, DdlAsientoContVentas.SelectedValue.ToEntero, DdlAsientoContCompras.SelectedValue.ToEntero, ChkAplicaParaConcepto.Checked, ChkAplicaParaVenta.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveMetodoInv, EsPaquete, CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero, FuePorXML:=False) > 0 Then - - - 'Alert("El Producto o Servicio se guardó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/ProductosServicios.aspx?CvePS=" & ObjProductosServcios.CvePS.ToString & """;") - Alert("El Producto o Servicio se guardó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/CatPS.aspx"";") - Else - Alert("Ocurrió un error al agregar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If - Else - If ObjProductosServicios.UpdatePS(DdlClasificacion.SelectedValue.ToEntero, DdlSubFamilia.SelectedValue.ToEntero, DdlUnidadMedida.SelectedValue.ToEntero, TxtCodigo.Text.Trim, TxtCodigo2.Text.Trim, TxtCodigoBarras.Text.Trim, TxtPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, DdlIVA.SelectedValue.ToDouble, (TxtRetIVA.Text.Trim.ToDouble / 100), TxtMG.Text.Trim.ToDouble, DdlCtaContableVentas.SelectedValue.ToEntero, DdlCtaContableCompras.SelectedValue.ToEntero, DdlCtaContableInventarios.SelectedValue.ToEntero, DdlAsientoContVentas.SelectedValue.ToEntero, DdlAsientoContCompras.SelectedValue.ToEntero, ChkAplicaParaConcepto.Checked, ChkAplicaParaVenta.Checked, ChkEstado.Checked, UsuarioActual.CveUsuario, CvePS, CveMetodoInv, EsPaquete, CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero) Then - 'CargaDatos() - UpDatos.Update() - - Dim AccionJS = If(Ret = "Comp", "ircompras();", "document.location.href=""/Ventas/CatPS.aspx"";") - - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, AccionJS) - Else - Alert("Ocurrió un error al actualizar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If - ObjProductosServicios.CvePS = CvePS - End If - - If ObjProductosServicios.CvePS > 0 Then - For i As Integer = 0 To gvSucursal.Rows.Count - 1 - If gvSucursal.Rows(i).FCCheckBox("chkSucursal").Checked = False Then - ObjProductosServicios.RemovePSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).DataKey("CveSucursal").ToEntero) - Else - If gvSucursal.Rows(i).FCHiddenField("hdnEnBD").Value.ToEntero = 1 Then - 'Actualizarlo - ObjProductosServicios.UpdatePSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).DataKey("CveSucursal").ToEntero, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, UsuarioActual.CveUsuario) - 'ObjProductosServicios.UpdatePSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).FCHiddenField("hdnCveSucursal").Value.ToEntero, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, UsuarioActual.CveUsuario) - Else - 'Insertarlo - 'ObjProductosServicios.AddPSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).FCHiddenField("hdnCveSucursal").Value.ToEntero, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, UsuarioActual.CveUsuario) - ObjProductosServicios.AddPSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).DataKey("CveSucursal").ToEntero, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, UsuarioActual.CveUsuario) - End If - End If - Next - End If - ObjProductosServicios.Dispose() - - RecargaGlobal() - - End Sub - - Private Sub RecargaGlobal() - Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) - Hilo.Start() - End Sub - Private Sub GeneraGlobalDT() - Dim ObjPS As New ClsProductosServicios - - If (ObjPS.GetPS(-1, -1, -1)) Then - GlobalDTProductosServicios(-1) = ObjPS.DtResultados - End If - - If ObjPS.GetPSAlias(-1, -1) Then - GlobalDTProductosServiciosAlias(-1) = ObjPS.DtResultados - End If - - If ObjPS.GetPSEquivalencias(-1, -1) Then - GlobalDTProductosServiciosEquivalencias(-1, -1) = ObjPS.DtResultados - End If - - ObjPS.Dispose() - End Sub - - - Protected Sub BtnEliminar_Click(sender As Object, e As System.EventArgs) Handles BtnEliminar.Click - 'Dim CerrarVentana As String = "opener.location.reload();window.close();" - 'If Request("Popup") IsNot Nothing Then CerrarVentana = "self.parent.tb_remove();self.parent.location.reload();window.close();" - - Dim ObjProductosServcios As New ClsProductosServicios() - If ObjProductosServcios.RemovePS(CvePS) Then - RecargaGlobal() - Alert("El Producto o Servicio se eliminó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/CatPS.aspx"";") - Else - Alert("Ocurrió un error al elimiar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If - ObjProductosServcios.Dispose() - End Sub - - Protected Sub btguardar_Click(sender As Object, e As EventArgs) Handles btguardar.Click - Dim ObjProductosServicios As New ClsProductosServicios - If ObjProductosServicios.AddPaqueteDetalle(CvePS, HFProducto.Value.ToString.ToEntero, - txtCantidad.Text.ToDouble, - ddlTipo.SelectedValue.ToEntero, - ddlUnidad.SelectedValue.ToEntero) Then - - If ObjProductosServicios.GetPaqueteDetalle(CvePS) Then - gvPaqueteDetalle.EditIndex = -1 - gvPaqueteDetalle.DataSource = ObjProductosServicios.DtResultados - gvPaqueteDetalle.DataBind() - End If - End If - ObjProductosServicios.Dispose() - End Sub - Protected Sub HFProducto_ValueChanged(sender As Object, e As EventArgs) Handles HFProducto.ValueChanged - ddlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(HFProducto.Value.ToEntero, -1) - ddlUnidad.DataBind() - End Sub - - Protected Sub gvPaqueteDetalle_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles gvPaqueteDetalle.RowDeleting - Dim ObjProductosServicios As New ClsProductosServicios - Dim tipo As Integer = 0 - If dtPaqueteDetalles.Rows.Item(e.RowIndex)("Tipo").ToString = "Paquete" Then - tipo = 1 - Else - tipo = 2 - End If - If ObjProductosServicios.DeletePaqueteDetalle(dtPaqueteDetalles.Rows.Item(e.RowIndex)("CvePSPaquete").ToString.ToEntero, - dtPaqueteDetalles.Rows.Item(e.RowIndex)("CvePS").ToString.ToEntero, - dtPaqueteDetalles.Rows.Item(e.RowIndex)("Cantidad").ToString.ToDouble, - tipo, - dtPaqueteDetalles.Rows.Item(e.RowIndex)("CveUnidadMedida").ToString.ToEntero) Then - - If ObjProductosServicios.GetPaqueteDetalle(CvePS) Then - gvPaqueteDetalle.EditIndex = -1 - gvPaqueteDetalle.DataSource = ObjProductosServicios.DtResultados - dtPaqueteDetalles = ObjProductosServicios.DtResultados - gvPaqueteDetalle.DataBind() - End If - End If - ObjProductosServicios.Dispose() - End Sub - - Protected Sub gvPaqueteDetalle_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles gvPaqueteDetalle.RowEditing - gvPaqueteDetalle.EditIndex = e.NewEditIndex - gvPaqueteDetalle.DataSource = dtPaqueteDetalles - gvPaqueteDetalle.DataBind() - End Sub - - Protected Sub gvPaqueteDetalle_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles gvPaqueteDetalle.RowCancelingEdit - gvPaqueteDetalle.EditIndex = -1 - gvPaqueteDetalle.DataSource = dtPaqueteDetalles - gvPaqueteDetalle.DataBind() - End Sub - - Protected Sub gvPaqueteDetalle_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles gvPaqueteDetalle.RowUpdating - Dim ObjProductosServicios As New ClsProductosServicios - If ObjProductosServicios.UpdatePaqueteDetalle(CvePS, - dtPaqueteDetalles.Rows.Item(e.RowIndex)("CvePS").ToString.ToEntero, - DirectCast(gvPaqueteDetalle.Rows(e.RowIndex).FindControl("txtECantidad"), TextBox).Text.ToDouble, - DirectCast(gvPaqueteDetalle.Rows(e.RowIndex).FindControl("ddlETipo"), DropDownList).SelectedValue.ToEntero, - DirectCast(gvPaqueteDetalle.Rows(e.RowIndex).FindControl("ddlEUnidad"), DropDownList).SelectedValue.ToEntero) Then - If ObjProductosServicios.GetPaqueteDetalle(CvePS) Then - gvPaqueteDetalle.EditIndex = -1 - gvPaqueteDetalle.DataSource = ObjProductosServicios.DtResultados - dtPaqueteDetalles = ObjProductosServicios.DtResultados - gvPaqueteDetalle.DataBind() - End If - End If - ObjProductosServicios.Dispose() - End Sub - Protected Sub gvEquivalencias_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles gvPaqueteDetalle.RowDataBound - If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then - e.Row.FCDropDownList("ddlEUnidad").DataSource = GlobalDTUnidadesMedida() - e.Row.FCDropDownList("ddlEUnidad").SelectedValue = e.Row.DBCampo("CveUnidadMedida") - e.Row.FCDropDownList("ddlEUnidad").DataBind() - End If - End Sub - - Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click - Dim ObjAliasAdd As New ClsProductosServicios - If ObjAliasAdd.AddPSAlias(TxtAlias.Text.ToString, CvePS) Then - GlobalDTProductosServiciosAlias(-1) = ObjAliasAdd.DtResultados - CargarAlias() - UPGVAlias.Update() - - Alert("Alias " + TxtAlias.Text + " agregado.", TipoMensaje.MsgInformacion) - TxtAlias.Text = "" - End If - ObjAliasAdd.Dispose() - End Sub - - Protected Sub CargarAlias() - Dim ObjAlias As New ClsProductosServicios - ObjAlias.GetPSAlias(CvePS, UsuarioActual.CveEmpresa) - GVAlias.DataSource = ObjAlias.DtResultados - ObjAlias.Dispose() - GVAlias.DataBind() - End Sub - - Protected Sub GVAlias_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GVAlias.RowDeleting - Dim ObjAliasDelete As New ClsProductosServicios - If ObjAliasDelete.RemovePSAlias(GVAlias.Rows(e.RowIndex).DataKey("CvePS").ToString.ToEntero, GVAlias.Rows(e.RowIndex).DataKey("PSAlias").ToString) Then - GlobalDTProductosServiciosAlias(-1) = ObjAliasDelete.DtResultados - GVAlias.EditIndex = -1 - CargarAlias() - UPGVAlias.Update() - - Alert("El Alias ha sido Eliminado", TipoMensaje.MsgInformacion) - Else - Alert("Error al Eliminar", TipoMensaje.MsgError) - End If - ObjAliasDelete.Dispose() - End Sub - -End Class diff --git a/CGame/OrdenProduccion.aspx.vb b/CGame/OrdenProduccion.aspx.vb index 15c4bd98d..f3f5fe229 100644 --- a/CGame/OrdenProduccion.aspx.vb +++ b/CGame/OrdenProduccion.aspx.vb @@ -314,8 +314,11 @@ Partial Class CGame_OrdenProduccion If ObjCGame.GetOrdenProduccionDetalle(CveOrdenProduccion, UsuarioActual.CveEmpresa) Then DtDetalle = ObjCGame.DtResultados GvOP.DataSource = DtDetalle - Tipo = DtDetalle.Rows(0)("Tipo").ToString.ToEntero - If Tipo = 2 Then GvLiquidacion.Columns(6).Visible = True : GvLiquidacion.Columns(7).Visible = True : DivPesoPagado.Visible = True : GvLiquidacionModal.Columns(2).Visible = True : RFVPesoPagado.Enabled = True + If DtDetalle IsNot Nothing AndAlso DtDetalle.Rows.Count > 0 Then + Tipo = DtDetalle.Rows(0)("Tipo").ToString.ToEntero + If Tipo = 2 Then GvLiquidacion.Columns(6).Visible = True : GvLiquidacion.Columns(7).Visible = True : DivPesoPagado.Visible = True : GvLiquidacionModal.Columns(2).Visible = True : RFVPesoPagado.Enabled = True + End If + End If End Sub diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 800a6922b..9ef3bda65 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -1201,8 +1201,8 @@ - - + + diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 646faeb46..741df6d20 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -1624,7 +1624,7 @@ Partial Class Compras_Compras - LtlTareaNueva.Text = String.Format(" Tarea", CveCompra) + LtlTareaNueva.Text = String.Format(" Tarea", CveCompra) End If @@ -1704,7 +1704,7 @@ Partial Class Compras_Compras Dim dr As DataRow = ObjeFacturas.DtResultados.Rows(0) ' no toma la cero, porque es el totalizador Dim XMLDoc As New XmlDocument - Dim Archivo As String = String.Format("{0}\Compras\{1}\{2}", UsuarioActual.Empresa.Ruta, dr("RFCDe"), dr("XML")) + Dim Archivo As String = String.Format("{0}Empresas\{1}\Compras\{2}\{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, dr("RFCDe"), dr("XML")) If IO.File.Exists(Archivo) Then Dim Validada As Boolean = True @@ -5811,7 +5811,11 @@ Partial Class Compras_Compras CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 6))("ConceptoContable").ToString) idCuentaContabilizacion = 0 End If - + 'Conta SIG + If CveCuenta = 0 Then + CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 6))("ConceptoContable").ToString) + CveCuentaContabilizacion = 0 + End If End If Next @@ -6389,7 +6393,7 @@ Partial Class Compras_Compras Dim AgregaMercanciaInventario As Boolean = UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 119, 140, 141) AndAlso UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" - Dim RegistraConcepto225 As Boolean = UsuarioActual.Empresa.UsaInventarios AndAlso DdlTipoComprobante.SelectedValue.Contiene("DEV") AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" + Dim RegistraConcepto225 As Boolean = UsuarioActual.Empresa.UsaInventarios AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" If RBLPago.SelectedValue.ToEntero = 4 Then Exit Select 'Es credito el concepto 6 se agrega en CASE 17 @@ -6415,7 +6419,11 @@ Partial Class Compras_Compras CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 49))("ConceptoContable").ToString) idCuentaContabilizacion = 0 End If - + 'Conta SIG + If CveCuenta = 0 Then + CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 49))("ConceptoContable").ToString) + CveCuentaContabilizacion = 0 + End If If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Row2("CodAF").ToString, 49, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveActivoFijo:=Row2("CveActivoFijo").ToString.ToEntero, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True End If @@ -6741,13 +6749,9 @@ Partial Class Compras_Compras ' CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToString.ToEntero End If End If - 'Conta ContPAQ - End If - 'If IdCtaContable = 0 AndAlso DdlTipoComprobante.SelectedValue = "Fac" Then - ' CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 6))("ConceptoContable").ToString) - ' idCuentaContabilizacion = 0 - 'End If + + 'SEGMENTO DE NEGOCIO @@ -6759,6 +6763,12 @@ Partial Class Compras_Compras 'AGREGA MOVIMIENTO If importeMovimiento.RoundSQL <> 0 Then + 'Conta ContPAQ + ' If IdCtaContable = 0 Then + ' CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 6))("ConceptoContable").ToString) + ' idCuentaContabilizacion = 0 + 'End If + Dim tcvecon As Integer = 6 Dim tidctacon As Integer = 6 @@ -6796,6 +6806,9 @@ Partial Class Compras_Compras End If + + + End If Next @@ -6873,6 +6886,11 @@ Partial Class Compras_Compras CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) idCuentaContabilizacion = 0 End If + 'Conta SIG + If CveCuenta = 0 Then + CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CveCuentaContabilizacion = 0 + End If If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=rw.DataKey("CveIE").ToString.ToEntero, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True @@ -7128,6 +7146,11 @@ Partial Class Compras_Compras CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) idCuentaContabilizacion = 0 End If + 'Conta SIG + If CveCuenta = 0 Then + CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + idCuentaContabilizacion = 0 + End If 'AMORTIZACIÓN NC ESPECIAL COMPLEMENTARIA If ConceptoContableAnticipo.Contiene(60) And DdlMoneda.SelectedValue.ToEntero <> 1 And UsuarioActual.CveEmpresa.Contiene(119) Then @@ -7458,6 +7481,11 @@ Partial Class Compras_Compras CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) idCuentaContabilizacion = 0 End If + 'COnta SIG + If CveCuenta = 0 Then + CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CveCuentaContabilizacion = 0 + End If If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=Math.Round(importeMN, 2, MidpointRounding.AwayFromZero), ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True @@ -9098,6 +9126,11 @@ Partial Class Compras_Compras CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) idCuentaContabilizacion = 0 End If + 'Conta SIG + If CveCuenta = 0 Then + CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) + CveCuentaContabilizacion = 0 + End If If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, Concepto, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=If(tipoCambio = 1, 0, ImporteMovimiento), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto) Then ErrorMovtosCxP = 1 @@ -10738,7 +10771,7 @@ Partial Class Compras_Compras e.Row.FCDropDownList("DdlAC5").Items.Clear() e.Row.FCDropDownList("DdlAC5").Visible = True - e.Row.FCDropDownList("DdlAC5").DataSource = DtPresupuestos.FiltraParametros("NOT CodigoCOG like '1%'", DistinctColumns:={"CveClasificacion", "CodigoClasificacion"}, Orderby:="CodigoClasificacion") 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros("Afectable = 1 ") 'DtPresupuestos.FiltraParametros("", DistinctColumns:={"CveClasificacion", "CodigoClasificacion"}, Orderby:="CodigoClasificacion") + e.Row.FCDropDownList("DdlAC5").DataSource = DtPresupuestos.FiltraParametros("", DistinctColumns:={"CveClasificacion", "CodigoClasificacion"}, Orderby:="CodigoClasificacion") 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros("Afectable = 1 ") 'DtPresupuestos.FiltraParametros("", DistinctColumns:={"CveClasificacion", "CodigoClasificacion"}, Orderby:="CodigoClasificacion") e.Row.FCDropDownList("DdlAC5").DataBind() e.Row.FCDropDownList("DdlAC5").SelectedValueExist(e.Row.DBCampo("CveClasificacionOG")) @@ -12845,12 +12878,13 @@ Partial Class Compras_Compras DdlACGeneral4.DataBind() DdlACGeneral5.Items.Clear() - DdlACGeneral5.DataSource = DtPresupuestos.FiltraParametros("NOT CodigoCOG like '1%'", DistinctColumns:={"CveClasificacion", "CodigoClasificacion"}, Orderby:="CodigoClasificacion") - If UsuarioActual.CveEmpresa.Contiene(120) Then - DdlACGeneral5.DataSource = DtPresupuestos.FiltraParametros("", DistinctColumns:={"CveClasificacion", "CodigoClasificacion"}, Orderby:="CodigoClasificacion") - Else - DdlACGeneral5.DataSource = DtPresupuestos.FiltraParametros("NOT CodigoCOG like '1%'", DistinctColumns:={"CveClasificacion", "CodigoClasificacion"}, Orderby:="CodigoClasificacion") - End If + DdlACGeneral5.DataSource = DtPresupuestos.FiltraParametros("", DistinctColumns:={"CveClasificacion", "CodigoClasificacion"}, Orderby:="CodigoClasificacion") + 'RM 2020.05.19. se mostraran todas las partidas del presupuesto, no se limintan las 1% + 'If UsuarioActual.CveEmpresa.Contiene(120) Then + ' DdlACGeneral5.DataSource = DtPresupuestos.FiltraParametros("", DistinctColumns:={"CveClasificacion", "CodigoClasificacion"}, Orderby:="CodigoClasificacion") + 'Else + ' DdlACGeneral5.DataSource = DtPresupuestos.FiltraParametros("NOT CodigoCOG like '1%'", DistinctColumns:={"CveClasificacion", "CodigoClasificacion"}, Orderby:="CodigoClasificacion") + 'End If DdlACGeneral5.DataBind() If CveCompra > 0 Then diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index ddb90e086..4ac3f5c5b 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1820,7 +1820,7 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("NombreRecibio", Capturo.ToUpper)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) params.Add(New ReportParameter("LogoPath", logouri)) - If DtMovimientos.COUNT("SerieLote") > 0 Then + If DtMovimientos.COUNT("Serie") > 0 Then params.Add(New ReportParameter("MostrarSerieLote", "1")) Else params.Add(New ReportParameter("MostrarSerieLote", "0")) @@ -1904,7 +1904,7 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("NombreRecibio", Personal)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) params.Add(New ReportParameter("LogoPath", logouri)) - If DtMovimientos.COUNT("SerieLote") > 0 Then + If DtMovimientos.COUNT("Serie") > 0 Then params.Add(New ReportParameter("MostrarSerieLote", "1")) Else params.Add(New ReportParameter("MostrarSerieLote", "0")) diff --git a/Compras/Proveedores.aspx b/Compras/Proveedores.aspx index 00a9727eb..0c179b104 100644 --- a/Compras/Proveedores.aspx +++ b/Compras/Proveedores.aspx @@ -4021,9 +4021,9 @@
- - diff --git a/Contabilidad/RepIVA.aspx.cs b/Contabilidad/RepIVA.aspx.cs index 176f60830..d76955b06 100644 --- a/Contabilidad/RepIVA.aspx.cs +++ b/Contabilidad/RepIVA.aspx.cs @@ -194,8 +194,9 @@ public partial class Contabilidad_RepIVA : ClsPaginas DataTable Dt = TT.ActiveTabIndex == 0 ? DtIVATrasladado.Copy() : DtIVAAcreditable.Copy(); string Formato = TT.ActiveTabIndex == 0 ? "RepIVA.rpt" : "RepIVAAcreditable.rpt"; para.Add(new CrystalParametro("Excel", Formato)); - - ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath($"~/Empresas/Grales/Formatos/{Formato}"),Dt,para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion); + string Ruta = (ModExtensiones.DirectorioBaseEmpresas + $@"Empresas\Grales\Formatos\{Formato}"); + Ruta.GuardaLogAD(); + ImprimirbytesPDF(ImprimirPDFCrystal(Ruta, Dt,para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion); } else { diff --git a/Contabilidad2/RepMovimientosAuxiliaresCatalogo.aspx.vb b/Contabilidad2/RepMovimientosAuxiliaresCatalogo.aspx.vb index 5785656ae..6d168533d 100644 --- a/Contabilidad2/RepMovimientosAuxiliaresCatalogo.aspx.vb +++ b/Contabilidad2/RepMovimientosAuxiliaresCatalogo.aspx.vb @@ -473,7 +473,7 @@ Partial Class Conta_RepMovimientosAuxiliaresCatalogo params.Add(New ReportParameter("pFechaInicio", FechaInicio.ToString("dd/MM/yyyy"))) params.Add(New ReportParameter("CveMoneda", DdlMoneda.SelectedValue)) params.Add(New ReportParameter("Cuenta", Cuenta)) - ImprimirPDF("Contabilidad2/Reportes/RepMovimientosAuxiliaresCatalogo.rdlc", DtDatos, params, "MovimientosAuxiliares", Formato) + ImprimirPDF("Empresas/Grales/Formatos/RepMovimientosAuxiliaresCatalogo.rdlc", DtDatos, params, "MovimientosAuxiliares", Formato) End Sub Protected Sub DdlTipoCuentas_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoCuentas.SelectedIndexChanged If DdlTipoCuentas.SelectedValue.ToEntero = -2 Then diff --git a/Contratos/Contrato.aspx b/Contratos/Contrato.aspx index c75733b7f..e28415dcf 100644 --- a/Contratos/Contrato.aspx +++ b/Contratos/Contrato.aspx @@ -1788,7 +1788,7 @@ - + @@ -1843,7 +1843,7 @@ - +
@@ -1882,7 +1882,7 @@ - + diff --git a/Contratos/Contrato.vb b/Contratos/Contrato.vb index 4adb7f0ae..546200e3f 100644 --- a/Contratos/Contrato.vb +++ b/Contratos/Contrato.vb @@ -2149,502 +2149,18 @@ Partial Class Contratos_Default Else Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError) End If - End Sub - - + End Sub + + #End Region - - - - - 'VIEJO ALMACEN - '#Region " MOVIMIENTOS ALMACEN " - ' Private Sub CargaInventarios() - ' If CveMovimiento > 0 Then - ' Dim ObjInventarios As New ClsInventarios - - - ' If ObjInventarios.GetMovimientos(CveMovimiento, 8, -1, UsuarioActual.CveEmpresa) Then - ' TxtFechaAlmacen.Text = ObjInventarios.Fecha.ToShortDateString - ' DdlAlmacen.SelectedValue = ObjInventarios.CveAlmacen.ToString - ' TxtObservaciones.Text = ObjInventarios.Observaciones - - ' 'cargar también los movimentos detalle - ' If ObjInventarios.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - ' DtMovimientos = ObjInventarios.DtResultados.FiltraParametros("", "CveMovimientoDetalle") - - ' DtMovimientos.Columns.Add("EstatusExistencia") - ' DtMovimientos.Columns("No").AutoIncrement = True - ' DtMovimientos.Columns("No").AutoIncrementSeed = DtMovimientos.Rows.Count + 1 - ' DtMovimientos.Columns("No").AutoIncrementStep = 1 - - ' Dim keys(1) As DataColumn - ' keys(0) = DtMovimientos.Columns("No") - ' DtMovimientos.PrimaryKey = keys - - ' CargaGvDatos() - - ' 'BLOQUEA - ' TxtFechaAlmacen.Enabled = False - ' ImgFechaAlmacen.Enabled = False - ' DdlAlmacen.Enabled = False - ' TxtObservaciones.Enabled = False - ' LbAgregarAlmacen.Visible = False - ' 'TxtCantidadAlmacen.Enabled = False - ' 'DdlUnidad.Enabled = False - ' DdlProducto2.Enabled = False - ' DdlClasificacion.Enabled = False - ' TxtnSerieLote.Enabled = False - ' DivCodigoSeriePS.Visible = False - - ' Else - ' Alert("Ocurrió un error al cargar la información de los Activos Fijos. Por favor vuelva a intentar.", TipoMensaje.MsgError) - ' End If - - ' Else - ' Alert("Ocurrió un error al cargar la información de los Activos Fijos. Por favor vuelva a intentar.", TipoMensaje.MsgError) - ' End If - - - ' ObjInventarios.Dispose() - ' End If - ' End Sub - - ' Private Sub InicializaAlmacen() - ' CreaDTAlmacen() - ' CargaPS() - ' TxtFechaAlmacen.Text = Now.ToShortDateString - - ' 'DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - ' 'DdlAlmacen.DataBind() - ' 'DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) - - ' End Sub - - '#Region "CARGA DATOS" - ' Protected Sub CreaDTAlmacen() - ' Dim dt As New DataTable - - ' Dim column As DataColumn = New DataColumn("No") - ' column.DataType = Type.GetType("System.Int32") - ' With column - ' .AutoIncrement = True - ' .AutoIncrementSeed = 1 - ' .AutoIncrementStep = 1 - ' End With - - ' dt.Columns.Add(column) - - - ' dt.Columns.Add("Cantidad", Type.GetType("System.Double")) - ' dt.Columns.Add("CveUM", Type.GetType("System.Int32")) - ' dt.Columns.Add("UnidadMedida") - ' dt.Columns.Add("CvePS", Type.GetType("System.Int32")) - ' dt.Columns.Add("PS") - ' dt.Columns.Add("SerieLote") - - - ' dt.Columns.Add("CveClasificacion", Type.GetType("System.Int32")) - ' dt.Columns.Add("EstatusExistencia") - - ' DtMovimientos = dt - - ' CargaGvDatos() - - ' End Sub - - ' Private Sub CargaPS() - ' DdlProducto2.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") - - ' If UsuarioActual.CveEmpresa = 66 Then - ' DdlProducto2.ddlWS.Attributes.Add("data-pagina", "Inventarios") - ' End If - ' If Not DdlProducto2.UsaWebService AndAlso CType(DdlProducto2.DataSource, DataTable) Is Nothing Then - ' DdlProducto2.DataSource = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltraParametros($"Inv_CveMetodoInventario = 5") - ' DdlProducto2.DataBind() - ' DdlProducto2.ddl.Items.Insert(0, New ListItem("----", "-1")) - ' End If - - ' End Sub - '#End Region - - '#Region "AGREGAR Y GUARDAR" - ' Protected Sub btnAgregar_Click(sender As Object, e As EventArgs) Handles LBAgregar.Click - ' BtnAgregarPS(1) - ' End Sub - ' Protected Sub BtnSerieAddNew_Click(sender As Object, e As EventArgs) - ' BtnAgregarPS(1) - ' End Sub - ' Private Sub BtnAgregarPS(Cantidad As Double) - ' Dim CveProducto As Integer = DdlProducto2.SelectedValue.ToEntero - - ' If CveProducto > 0 Then - ' If TxtnSerieLote.Visible AndAlso TxtnSerieLote.Text = "" Then - ' Alert("Serie-Lote es necesario", TipoMensaje.MsgAdvertencia) - ' Exit Sub - ' End If - - ' Dim Valido = ValidaExistencia(Cantidad, CveProducto, -1, TxtnSerieLote.Text) 'If(TxtnSerieLote.Visible, TxtnSerieLote.Text, "-1") - - ' If Valido Then - ' AgregarPS(Cantidad, CveProducto, -1, TxtnSerieLote.Text) 'If(TxtnSerieLote.Visible, TxtnSerieLote.Text, "-1") - ' End If - - ' End If - ' End Sub - ' Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional SerieLote As String = "-1") As Boolean - ' Dim Retorno = True - - ' Dim Inv As New ClsInventarios - ' Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, -1, TxtFechaAlmacen.Text.ToDate.ToString("yyyy/MM/dd 23:59"), SerieLote) - ' Inv.Dispose() - - ' If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(SerieLote <> "-1", $" AND SerieLote = '{SerieLote}'", "")}") < 0 Then - ' If Existencia = 0 Then - ' Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia) - ' Else - ' Alert(String.Format("Solo hay en existencia: {0}", Existencia), TipoMensaje.MsgAdvertencia) - ' End If - ' Retorno = False - ' End If - - ' Return Retorno - ' End Function - ' Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional SerieLote As String = "-1") - ' If Cantidad <= 0 Then - ' Alert("La cantidad debe ser mayor a cero (0). Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) - ' End If - - ' Dim CveClasificacion As Integer - - ' Dim DrPS As DataRow = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CvePS = {0}", CvePS)) - ' If DrPS IsNot Nothing Then CveClasificacion = DrPS("CveClasificacion").ToString.ToEntero - - ' Dim registro As DataRow = DtMovimientos.NewRow - ' registro.Item("Cantidad") = Cantidad - ' registro.Item("CveUM") = DrPS("CveUnidadMedida") - ' registro.Item("UnidadMedida") = DrPS("UnidadMedida") - ' registro.Item("CvePS") = CvePS - ' registro.Item("PS") = DrPS("PS") - ' registro.Item("SerieLote") = SerieLote - ' registro.Item("CveClasificacion") = CveClasificacion - ' registro.Item("EstatusExistencia") = "1" - - ' DtMovimientos.Rows.Add(registro) - - ' CargaGvDatos() - - ' LimpiaAgregar() - ' End Sub - - ' Private Sub LimpiaAgregar() - ' DdlClasificacion.SelectedValue = "-1" - ' DdlClasificacion_SelectedIndexChanged(DdlClasificacion, EventArgs.Empty) - ' 'TxtCantidad.Text = "" - ' TxtnSerieLote.Text = "" - ' 'TxtnSerieLote.Visible = False - ' End Sub - - ' Protected Function GuardarAlmacen(ObjInventarios As ClsInventarios) As Boolean - ' Dim ErrorMovInv As Boolean = False - - ' 'NO HACE NADA YA QUE TIENE MOVIMIENTO REGISTRADO O NO TENGA DETALLES EN EL GV - ' If CveMovimiento > 0 Or GvDatos.Rows.Count = 0 Then - ' Return ErrorMovInv - ' End If - - - ' 'VALIDA ESTATUS EXISTENCIA - ' For Each dr As DataRow In DtMovimientos.Rows - ' If dr("EstatusExistencia").ToString = "-1" Then - ' Alert("Tiene que rectificar los movimientos con error.", TipoMensaje.MsgError) - ' Return True - ' End If - ' Next - - ' Dim CveMovimientoSalida = 0 - ' Dim CveMovimientoEntrada = 0 - ' Dim IDPoliza As Integer = 0 - ' Dim FolioSalida = 0 - ' Dim FolioEntrada = 0 - ' Dim AlmacenEntrada = -1 - - ' Dim ErrorAC As Boolean = False - ' Dim ErrorExistencia = False - - ' Dim TextoError = "" - ' Dim TextoExistencia As StringBuilder = New StringBuilder - - - ' 'VALIDA EXISTENCIA - ' Dim Existencia As Double - ' TextoExistencia.Append("Los siguiente productos se ajustaron por falta de exitencia:
") - ' For Each dr As DataRow In DtMovimientos.Rows - ' Existencia = ObjInventarios.GetExistenciasPS(dr("CvePS").ToString.ToEntero, dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, -1, TxtFechaAlmacen.Text.ToDate.ToString("yyyy/MM/dd 23:59"), If(dr("SerieLote").ToString = "", "-1", dr("SerieLote").ToString)) - - ' Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("SerieLote").ToString <> "-1", $" AND SerieLote = '{dr("SerieLote").ToString}'", "")}") - - ' If Existencia < 0 Then - ' ErrorExistencia = True - ' dr("EstatusExistencia") = "-1" - ' dr("Cantidad") = Existencia - ' TextoExistencia.AppendFormat("- #{0} {1}
", dr("No").ToString, dr("PS").ToString) - ' End If - ' Next - - ' 'REGISTRA LA SALIDA Y ENTRADA (TRASPASO) - ' If Not ErrorExistencia Then - ' Dim Fecha As Date = TxtFechaAlmacen.Text.ToDate - - ' 'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN - ' CveMovimientoSalida = ObjInventarios.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 8, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveContrato:=CveContrato) - ' FolioSalida = ObjInventarios.Folio - - ' If CveMovimientoSalida <= 0 Then - ' TextoError = "No se pudo generar el movimiento de salida correctamente" - ' ErrorMovInv = True - ' Else - - ' For Each Dr As DataRow In DtMovimientos.Rows - ' If Not ObjInventarios.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, -1, Dr("SerieLote").ToString) Then - ' ErrorMovInv = True - ' TextoError = "Ocurrió un error al guardar los movimientos de salida" - ' Exit For - ' End If - ' Next - ' End If - - ' 'AGREGAMOS LA ENTRADA - ' If Not ErrorMovInv Then - ' AlmacenEntrada = 89 - - ' CveMovimientoEntrada = ObjInventarios.AddMovimiento(AlmacenEntrada, 9, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveMovimientoRelacionado:=CveMovimientoSalida, CveContrato:=CveContrato) - ' FolioEntrada = ObjInventarios.Folio - - ' If CveMovimientoEntrada <= 0 Then - ' TextoError = "No se pudo generar el movimiento de entrada correctamente" - ' ErrorMovInv = True - ' Else - - ' If ObjInventarios.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - - ' For Each Dr As DataRow In ObjInventarios.DtResultados.Rows - ' If Not ObjInventarios.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString) Then - ' ErrorMovInv = True - ' TextoError = "Ocurrió un error al guardar los movimientos de entrada" - ' Exit For - ' End If - ' Next - - ' End If - - ' End If - ' End If - - - ' If Not ErrorMovInv Then - ' Dim Mensaje As StringBuilder = New StringBuilder - - ' Mensaje.Append("Se realizó con éxito el traspaso.") - - ' Mensaje.AppendFormat("
Folio de Salida: {0}", FolioSalida, CveMovimientoSalida) - ' Mensaje.AppendFormat("
Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida))) - - ' Mensaje.AppendFormat("
Folio de Entrada: {0}", FolioEntrada, CveMovimientoEntrada) - ' Mensaje.AppendFormat("
Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada))) - - ' Alert(Mensaje.ToString, TipoMensaje.MsgInformacion) - - ' TxtResponsable.Text = "" - ' TxtFechaAlmacen.Text = Now.ToShortDateString - ' TxtObservaciones.Text = "" - ' 'TxtCantidad.Text = "" - - ' DtMovimientos.Rows.Clear() - ' CargaGvDatos() - ' Else - ' Alert(TextoError, TipoMensaje.MsgError) - ' End If - - ' Else - ' Alert(TextoExistencia.ToString, TipoMensaje.MsgError) - ' ErrorMovInv = True - ' End If - - - ' 'SI OCURRIO UN ERROR EN LA EXISTENCIA RECARGAMOS EL GRID PARA COLOREAR LOS DETALLES CON ERROR - ' If ErrorExistencia Then - ' CargaGvDatos() - ' End If - - ' Return ErrorMovInv - - ' End Function - - - '#End Region - - '#Region " AGREGA CON TXT | CODIGO - SERIE " - ' Protected Sub BtnCodigoPS_Click(sender As Object, e As EventArgs) - - ' If TxtCodigoPS.Text = "" Then - ' Exit Sub - ' End If - - ' TdSeriePS.Visible = False - - ' Dim DrPS = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltroPrimero($"CodigoBarras = '{TxtCodigoPS.Text}'") - ' If DrPS Is Nothing Then - ' Alert($"No se ha encontrado un producto del Codigo ""{TxtCodigoPS.Text}"". ", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);") - ' TxtCodigoPS.Text = "" - ' Exit Sub - ' End If - - ' If DrPS("Inv_CveMetodoInventario").ToString.ToEntero = 5 Then - ' TdSeriePS.Visible = True - ' TxtSeriePS.Focus() - ' CvePSSerieLote = DrPS("CvePS").ToString.ToEntero - ' CveUMSerieLote = DrPS("CveUnidadMedida").ToString.ToEntero - ' Exit Sub - ' End If - - ' AgregarPS(1, DrPS("CvePS").ToString.ToEntero, DrPS("CveUnidadMedida").ToString.ToEntero) - - ' TxtCodigoPS.Text = "" - - ' End Sub - ' Protected Sub BtnSeriePS_Click(sender As Object, e As EventArgs) - ' If TxtSeriePS.Text.Trim = "" Then - ' Exit Sub - ' End If - - ' 'TxtCantidad.Text = "1" - - ' Dim Valido = ValidaExistencia(1, CvePSSerieLote, CveUMSerieLote, TxtSeriePS.Text.Trim) - - ' If Valido Then - ' AgregarPS(1, CvePSSerieLote, CveUMSerieLote, TxtSeriePS.Text.Trim) - ' Else - ' TxtSeriePS.Text = "" - ' TxtSeriePS.Focus() - ' Exit Sub - ' End If - - ' TdSeriePS.Visible = False - ' TxtSeriePS.Text = "" - ' TxtCodigoPS.Text = "" - ' TxtCodigoPS.Focus() - - ' End Sub - '#End Region - - '#Region "DDL CLASIFICACION" - ' Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacion.SelectedIndexChanged - ' ChangeDdlProducto() - ' End Sub - ' Private Sub ChangeDdlProducto() - ' If UsuarioActual.Empresa.Funcionalidad(105) = "" Then - ' Dim filtro As String = "" - ' If Not (DdlClasificacion.SelectedValue = "-1") Then - - ' If isWhitFamily() Then - ' filtro = String.Format("AND CveSubFamilia={0}", DdlClasificacion.SelectedValue) - ' Else - ' filtro = String.Format("AND CveClasificacion={0}", DdlClasificacion.SelectedValue) - ' End If - ' End If - ' DdlProducto2.DataSource = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltraParametros($"Inv_CveMetodoInventario = 5 {filtro}", "PS") - ' DdlProducto2.DataBind() - ' DdlProducto2.ddl.Items.Insert(0, New ListItem("----", "-1")) - ' Else - ' If isWhitFamily() Then - ' DdlProducto2.ddlWS.Attributes.Add("data-idSubFamilia", DdlClasificacion.SelectedValue) - ' Else - ' DdlProducto2.ddlWS.Attributes.Add("data-idClasificacion", DdlClasificacion.SelectedValue) - ' End If - ' End If - ' End Sub - - ' Protected Sub DdlProducto_ValueChanged(sender As Object, e As EventArgs) Handles DdlProducto2.selectedindexchange - ' ElProductoChange() - ' End Sub - ' Private Sub ElProductoChange() - ' 'TxtnSerieLote.Visible = False - - ' 'If DdlProducto2.SelectedValue.ToEntero > 0 Then - ' ' If GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CvePS = {0} AND Inv_CveMetodoInventario = 5 ", DdlProducto2.SelectedValue), "PS").Rows.Count > 0 Then - ' ' ThSerieLote.Visible = True - ' ' TdSerieLote.Visible = True - ' ' TxtnSerieLote.Visible = True - ' ' GvDatos.Columns(2).Visible = True - ' ' End If - ' 'End If - - ' 'Dim objinv As New ClsInventarios - ' 'If objinv.GetExistenciasProducto(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, -1, Now) Then - ' ' If objinv.DtResultados.Rows.Count = 0 Then - ' ' Alert("No hay existencias de este producto", TipoMensaje.MsgAdvertencia) - ' ' End If - ' 'End If - - ' 'UpGral.Update() - - ' End Sub - ' Private Function isWhitFamily() As Boolean - ' Return (UsuarioActual.CveEmpresa = 66) - ' End Function - '#End Region - - '#Region "GV DATOS" - ' Private Sub CargaGvDatos() - ' 'TxtnSerieLote.Visible = False - ' 'ThSerieLote.Visible = False - ' 'TdSerieLote.Visible = False - ' 'GvDatos.Columns(4).Visible = False - - ' GvDatos.DataSource = DtMovimientos - ' GvDatos.DataBind() - ' UpGral.Update() - ' End Sub - ' Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound - ' If e.Row.RowType = DataControlRowType.DataRow Then - - ' If CveMovimiento > 0 Then - ' e.Row.FCLinkButton("lnkRemove").Visible = False - ' End If - - ' If e.Row.DBCampo("EstatusExistencia").ToEntero < 0 Then - ' e.Row.Cells(0).BackColor = Drawing.Color.Red - ' End If - - ' If e.Row.DBCampo("SerieLote").ToString <> "-1" Then - ' 'TxtnSerieLote.Visible = True - ' 'ThSerieLote.Visible = True - ' 'TdSerieLote.Visible = True - ' 'GvDatos.Columns(2).Visible = True - ' 'e.Row.Cells(2).Text = e.Row.DBCampo("SerieLote").ToString - ' Else - ' e.Row.Cells(2).Text = "" - ' End If - - ' End If - ' End Sub - ' Protected Sub GvPS_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting - ' Dim DbRow As DataRow = Nothing - ' DbRow = DtMovimientos.Rows(e.RowIndex) - - ' DtMovimientos.Rows.Remove(DbRow) - ' CargaGvDatos() - ' End Sub - '#End Region - - '#End Region - - - - - - + + + + + + + + End Class diff --git a/GPS/FacturacionMasiva.aspx.vb b/GPS/FacturacionMasiva.aspx.vb index 7cc898cab..5db90c87c 100644 --- a/GPS/FacturacionMasiva.aspx.vb +++ b/GPS/FacturacionMasiva.aspx.vb @@ -432,7 +432,7 @@ Partial Class Contratos_FacturacionMasiva TmpDT.Columns.Add("PS", GetType(String)) TmpDT.Columns.Add("CodigoPS", GetType(String)) TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) - TmpDT.Columns.Add("SerieLote", GetType(String)) + TmpDT.Columns.Add("Serie", GetType(String)) TmpDT.Columns.Add("Obs", GetType(String)) TmpDT.Columns.Add("TiempoEntrega", GetType(String)) TmpDT.Columns.Add("PU", GetType(Double)) diff --git a/Inventarios/AjustesSeccionAlmacen.aspx b/Inventarios/AjustesSeccionAlmacen.aspx index bc20d39e9..795fb5427 100644 --- a/Inventarios/AjustesSeccionAlmacen.aspx +++ b/Inventarios/AjustesSeccionAlmacen.aspx @@ -1,124 +1,124 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="AjustesSeccionAlmacen.aspx.vb" Inherits="Inventarios_AjustesSeccionAlmacen" %> - - - - - - - Ajustes de Productos en Secciones de Almacen - - - - - - -
  • - Importar Listado -
  • -
  • - Descargar Formato -
  • -
    - - - -
    -
    - - - - - -
    -
    -
    - -
    -
    - - -
    - -
    - - -
    - -
    - -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="AjustesSeccionAlmacen.aspx.vb" Inherits="Inventarios_AjustesSeccionAlmacen" %> + + + + + + + Ajustes de Productos en Secciones de Almacen + + + + + + +
  • + Importar Listado +
  • +
  • + Descargar Formato +
  • +
    + + + +
    +
    + + + + + +
    +
    +
    + +
    +
    + + +
    + +
    + + +
    + +
    + +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + diff --git a/Inventarios/Apartados.aspx b/Inventarios/Apartados.aspx index 37846e8bc..57bf1f423 100644 --- a/Inventarios/Apartados.aspx +++ b/Inventarios/Apartados.aspx @@ -170,7 +170,13 @@
    Producto - Serie - Lote + Serie + + Lote + + F.Caducidad + + Sección Comandos @@ -203,17 +209,26 @@ - + - + - - - - + + + + + + + + + + + + @@ -222,7 +237,7 @@
    - + @@ -234,10 +249,13 @@ - + + + - ssss + + @@ -292,9 +310,11 @@
    Cliente
    - - - + + + + <%-- + --%>
    Vendedor:
    @@ -357,7 +377,7 @@
    - +
    @@ -381,7 +401,7 @@
    - + @@ -393,12 +413,16 @@ - + + + - - ssss - - + + + + + +
    diff --git a/Inventarios/Apartados.aspx.vb b/Inventarios/Apartados.aspx.vb index 867255d9a..db73531dd 100644 --- a/Inventarios/Apartados.aspx.vb +++ b/Inventarios/Apartados.aspx.vb @@ -32,20 +32,20 @@ Partial Class Inventarios_Apartados ViewState("CargadoDeMov") = value End Set End Property - Private Property CvePSSerieLote As Integer + Private Property CvePSSerie As Integer Get - Return CType(ViewState("CvePSSerieLote"), Integer) + Return CType(ViewState("CvePSSerie"), Integer) End Get Set(value As Integer) - ViewState("CvePSSerieLote") = value + ViewState("CvePSSerie") = value End Set End Property - Private Property CveUMSerieLote As Integer + Private Property CveUMSerie As Integer Get - Return CType(ViewState("CveUMSerieLote"), Integer) + Return CType(ViewState("CveUMSerie"), Integer) End Get Set(value As Integer) - ViewState("CveUMSerieLote") = value + ViewState("CveUMSerie") = value End Set End Property Private Property CveCliente As Integer @@ -64,14 +64,7 @@ Partial Class Inventarios_Apartados ViewState("CveVendedor") = value End Set End Property - Private Property DtSeccionAlmacen As DataTable - Get - Return CType(ViewState("DtSeccionAlmacen"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtSeccionAlmacen") = value - End Set - End Property + Private Property IndexSeccionAlmacen As Integer Get Return CType(ViewState("IndexSeccionAlmacen"), Integer) @@ -147,7 +140,7 @@ Partial Class Inventarios_Apartados DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) DdlSubProyecto.DataBind() - DdlSubProyecto.Items.Insert(0, New ListItem(" Seleccione ", "-1")) + DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione ", "-1")) DdlSubProyectoDesapartado.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) DdlSubProyectoDesapartado.DataBind() @@ -168,11 +161,16 @@ Partial Class Inventarios_Apartados Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) If EsWS Then DdlClientes.setEsWebService(True) + DdlClienteDesapartado.setEsWebService(True) Else DdlClientes.setEsWebService(False) DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) DdlClientes.DataBind() DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1")) + DdlClienteDesapartado.setEsWebService(False) + DdlClienteDesapartado.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) + DdlClienteDesapartado.DataBind() + DdlClienteDesapartado.ddl.Items.Insert(0, New ListItem("Todos", "-1")) End If @@ -180,9 +178,9 @@ Partial Class Inventarios_Apartados 'DdlCliente.DataBind() 'DdlCliente.Items.Insert(0, New ListItem(" Seleccione ", "-1")) - DdlClienteDesapartado.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) - DdlClienteDesapartado.DataBind() - DdlClienteDesapartado.Items.Insert(0, New ListItem(" Todos ", "-1")) + 'DdlClienteDesapartado.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) + 'DdlClienteDesapartado.DataBind() + 'DdlClienteDesapartado.Items.Insert(0, New ListItem(" Todos ", "-1")) DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) DdlVendedor.DataBind() @@ -230,7 +228,11 @@ Partial Class Inventarios_Apartados dt.Columns.Add("CvePS", Type.GetType("System.Int32")) dt.Columns.Add("CveAF", Type.GetType("System.Int32")) dt.Columns.Add("PS") - dt.Columns.Add("SerieLote") + dt.Columns.Add("CveSeccionAlmacen", Type.GetType("System.Int32")) + dt.Columns.Add("SeccionAlmacen") + dt.Columns.Add("Serie") + dt.Columns.Add("Lote") + dt.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime")) dt.Columns.Add("CveClasificacion", Type.GetType("System.Int32")) dt.Columns.Add("EstatusExistencia") @@ -262,17 +264,40 @@ Partial Class Inventarios_Apartados ElProductoChange() End Sub Private Sub ElProductoChange() - TxtnSerieLote.Visible = False + TxtnSerie.Visible = False If DdlProducto2.SelectedValue.ToEntero > 0 Then - If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltraParametros("Inv_CveMetodoInventario = 5 OR AplicaSerie = 1 ", "PSCodigo").Rows.Count > 0 Then - ThSerieLote.Visible = True - TdSerieLote.Visible = True - TxtnSerieLote.Visible = True - GvDatos.Columns(4).Visible = True + Dim drP As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltroPrimero("") + If drP IsNot Nothing Then + If CBool(drP("AplicaSerie")) Then + ThSerie.Visible = True + TdSerie.Visible = True + TxtnSerie.Visible = True + GvDatos.Columns(4).Visible = True + End If + If CBool(drP("AplicaLote")) Then + ThLote.Visible = True + TdLote.Visible = True + GvDatos.Columns(5).Visible = True + End If + If CBool(drP("AplicaCaducidad")) Then + ThCaducidad.Visible = True + TdCaducidad.Visible = True + GvDatos.Columns(6).Visible = True + End If + If CBool(drP("AplicaSeccion")) Then + ThSeccion.Visible = True + TdSeccionAlmacen.Visible = True + DdlSeccionAlmacen.DataSource = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, DdlProducto2.SelectedValue.ToEntero) + DdlSeccionAlmacen.DataBind() + GvDatos.Columns(7).Visible = True + End If + End If + End If + DdlUnidad.Items.Clear() DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidad.DataBind() @@ -380,8 +405,8 @@ Partial Class Inventarios_Apartados If DrPS("Inv_CveMetodoInventario").ToString.ToEntero = 5 Then TdSeriePS.Visible = True TxtSeriePS.Focus() - CvePSSerieLote = DrPS("CvePS").ToString.ToEntero - CveUMSerieLote = DrPS("CveUnidadMedida").ToString.ToEntero + CvePSSerie = DrPS("CvePS").ToString.ToEntero + CveUMSerie = DrPS("CveUnidadMedida").ToString.ToEntero Exit Sub End If @@ -397,10 +422,10 @@ Partial Class Inventarios_Apartados txtCantidad.Text = "1" - Dim Valido = ValidaExistencia(1, CvePSSerieLote, CveUMSerieLote, TxtSeriePS.Text.Trim) + Dim Valido = ValidaExistencia(1, CvePSSerie, CveUMSerie, TxtSeriePS.Text.Trim) If Valido Then - AgregarPS(1, CvePSSerieLote, CveUMSerieLote, TxtSeriePS.Text.Trim) + AgregarPS(1, CvePSSerie, CveUMSerie, Serie:=TxtSeriePS.Text.Trim) Else TxtSeriePS.Text = "" TxtSeriePS.Focus() @@ -426,10 +451,10 @@ Partial Class Inventarios_Apartados Dim FuncionalidadSinSerie = True If CveProducto > 0 Then - If TxtnSerieLote.Visible Then + If TxtnSerie.Visible Then Cantidad = 1 - If TxtnSerieLote.Text = "" Then - Alert("Serie-Lote es necesario", TipoMensaje.MsgAdvertencia) + If TxtnSerie.Text = "" Then + Alert("Serie es necesario", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')") Exit Sub End If @@ -438,22 +463,23 @@ Partial Class Inventarios_Apartados End If End If - Dim Valido = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, If(TxtnSerieLote.Visible, TxtnSerieLote.Text, "-1")) + Dim Valido = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, Serie:=If(TxtnSerie.Visible, TxtnSerie.Text, "-1")) If Valido Then - AgregarPS(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, If(TxtnSerieLote.Visible, TxtnSerieLote.Text, "-1"), FuncionalidadSinSerie) + AgregarPS(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, SeccionAlmacen:=DdlSeccionAlmacen.SelectedItem.Text, Serie:=If(TxtnSerie.Text <> "", TxtnSerie.Text, ""), Limpia:=FuncionalidadSinSerie) End If End If End Sub - Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional SerieLote As String = "-1") As Boolean + Private Function ValidaExistencia(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional Serie As String = "-1", + Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha, Optional CveSeccionAlmacen As Integer = -1) As Boolean Dim Retorno = True Dim Inv As New ClsInventarios - Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), SerieLote:=SerieLote) + Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Inv.Dispose() - If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(SerieLote <> "-1", $" AND SerieLote = '{SerieLote}'", "")}") < 0 Then + If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(Serie <> "-1", $" AND Serie = '{Serie}'", "")}") < 0 Then If Existencia < 0 Then Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')") @@ -466,7 +492,8 @@ Partial Class Inventarios_Apartados Return Retorno End Function - Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, Optional SerieLote As String = "-1", Optional Limpia As Boolean = True) + Private Sub AgregarPS(Cantidad As Double, CvePS As Integer, CveUnidadMedida As Integer, + Optional CveSeccionAlmacen As Integer = -1, Optional Serie As String = "", Optional Lote As String = "", Optional FechaCaducidad As Date = MinFecha, Optional Limpia As Boolean = True, Optional SeccionAlmacen As String = "") If Cantidad <= 0 Then Alert("La cantidad debe ser mayor a cero (0). Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") @@ -485,10 +512,14 @@ Partial Class Inventarios_Apartados registro.Item("UnidadMedida") = DrUM("UnidadMedida") registro.Item("CvePS") = CvePS registro.Item("PS") = DrPS("PSCodigo") - registro.Item("SerieLote") = SerieLote + registro.Item("Serie") = Serie + registro.Item("Lote") = Lote + registro.Item("FechaCaducidad") = FechaCaducidad registro.Item("CveClasificacion") = CveClasificacion registro.Item("CveAF") = -1 registro.Item("EstatusExistencia") = "1" + registro.Item("CveSeccionAlmacen") = CveSeccionAlmacen + registro.Item("SeccionAlmacen") = If(CveSeccionAlmacen > 0, SeccionAlmacen, "") DtMovimientos.Rows.Add(registro) RegistraScript("playsonidito('beep-07.wav')") @@ -498,16 +529,16 @@ Partial Class Inventarios_Apartados LimpiaAgregar() Else txtCantidad.Text = (txtCantidad.Text.ToDouble - 1.0).ToString - TxtnSerieLote.Text = "" - TxtnSerieLote.Focus() + TxtnSerie.Text = "" + TxtnSerie.Focus() End If End Sub Private Sub LimpiaAgregar() DdlClasificacion.SelectedValue = "-1" DdlClasificacion_SelectedIndexChanged(DdlClasificacion, EventArgs.Empty) txtCantidad.Text = "" - TxtnSerieLote.Text = "" - TxtnSerieLote.Visible = False + TxtnSerie.Text = "" + TxtnSerie.Visible = False txtCantidad.Focus() If TxtCodigoPS.Visible Then TxtCodigoPS.Focus() @@ -517,12 +548,18 @@ Partial Class Inventarios_Apartados #Region " GV DATOS " Private Sub CargaGvDatos(Optional EscondeSerie As Boolean = True) - If EscondeSerie Then - TxtnSerieLote.Visible = False - ThSerieLote.Visible = False - TdSerieLote.Visible = False - GvDatos.Columns(4).Visible = False - End If + 'If EscondeSerie Then + ' TxtnSerie.Visible = False + ' ThSerie.Visible = False + ' TdSerie.Visible = False + ' GvDatos.Columns(4).Visible = False + 'End If + + GvDatos.Columns(4).Visible = DtMovimientos.MAX("Serie").ToString <> "" + GvDatos.Columns(5).Visible = DtMovimientos.MAX("Lote").ToString <> "" + GvDatos.Columns(6).Visible = DtMovimientos.MAX("FechaCaducidad").ToString.ToDate > MinFecha + GvDatos.Columns(7).Visible = DtMovimientos.MAX("CveSeccionAlmacen").ToString.ToEntero > 0 + GvDatos.DataSource = DtMovimientos GvDatos.DataBind() @@ -541,20 +578,20 @@ Partial Class Inventarios_Apartados e.Row.FCTextBox("TxtCantidad2").Attributes.Add("onblur", String.Format("ValidaCantidad(this,{0})", e.Row.DBCampo("Cantidad"))) End If - If If(e.Row.DBCampo("SerieLote").ToString = "", "-1", e.Row.DBCampo("SerieLote").ToString) <> "-1" Then - TxtnSerieLote.Visible = True - ThSerieLote.Visible = True - TdSerieLote.Visible = True - GvDatos.Columns(4).Visible = True - e.Row.Cells(4).Text = e.Row.DBCampo("SerieLote").ToString - Else - e.Row.Cells(4).Text = "" - End If + 'If If(e.Row.DBCampo("Serie").ToString = "", "-1", e.Row.DBCampo("Serie").ToString) <> "-1" Then + ' TxtnSerie.Visible = True + ' ThSerie.Visible = True + ' TdSerie.Visible = True + ' GvDatos.Columns(4).Visible = True + ' e.Row.Cells(4).Text = e.Row.DBCampo("Serie").ToString + 'Else + ' e.Row.Cells(4).Text = "" + 'End If - If DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {e.Row.RowIndex}").SUMD("CantidadSeccionAlmacen") > 0 Then - e.Row.FCLinkButton("lnkRemove").Visible = False - e.Row.FCLinkButton("lnkRemove").ToolTip = "Cuenta con sección almacen" - End If + 'If DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {e.Row.RowIndex}").SUMD("CantidadSeccionAlmacen") > 0 Then + ' e.Row.FCLinkButton("lnkRemove").Visible = False + ' e.Row.FCLinkButton("lnkRemove").ToolTip = "Cuenta con sección almacen" + 'End If End If End Sub @@ -593,12 +630,12 @@ Partial Class Inventarios_Apartados Next Dim TotalCantidad As Double = DtMovimientos.SUMD("Cantidad") - If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then - If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 1").SUMD("CantidadSeccionAlmacen") Then - Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - End If + 'If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then + ' If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 1").SUMD("CantidadSeccionAlmacen") Then + ' Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia) + ' Exit Sub + ' End If + 'End If Dim ObjInventario As New ClsInventarios @@ -610,8 +647,8 @@ Partial Class Inventarios_Apartados If Not CargadoDeMov Then For Each dr As DataRow In DtMovimientos.Rows - Existencia = ObjInventario.GetExistenciasPS(dr("CvePS").ToString.ToEntero, dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), SerieLote:=If(dr("SerieLote").ToString = "", "-1", dr("SerieLote").ToString)) - Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("SerieLote").ToString <> "-1", $" AND SerieLote = '{dr("SerieLote").ToString}'", "")}") + Existencia = ObjInventario.GetExistenciasPS(dr("CvePS").ToString.ToEntero, dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), CveSeccionAlmacen:=dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=If(dr("Serie").ToString = "", "-1", dr("Serie").ToString)) + Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("Serie").ToString <> "-1", $" AND Serie = '{dr("Serie").ToString}'", "")}") 'DtMovimientos.SUM("Cantidad", String.Format("CvePS = {0}", dr("CvePS").ToString.ToEntero)) If Existencia < 0 Then @@ -623,7 +660,7 @@ Partial Class Inventarios_Apartados Next Else For Each gvr As GridViewRow In GvDatos.Rows - Existencia = ObjInventario.GetExistenciasPS(gvr.DataKey("CvePS").ToString.ToEntero, gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), SerieLote:=If(gvr.DataKey("SerieLote").ToString = "", "-1", gvr.DataKey("SerieLote").ToString)) + Existencia = ObjInventario.GetExistenciasPS(gvr.DataKey("CvePS").ToString.ToEntero, gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), CveSeccionAlmacen:=gvr.DataKey("CveSeccionAlmacen").ToString.ToEntero, Serie:=If(gvr.DataKey("Serie").ToString = "", "-1", gvr.DataKey("Serie").ToString)) Existencia -= gvr.FCTextBox("TxtCantidad2").Text.ToEntero If Existencia < 0 Then ErrorExistencia = True @@ -666,7 +703,7 @@ Partial Class Inventarios_Apartados ErrorMovInv = True Else For Each Dr As DataRow In DtMovimientos.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString) Then ErrorMovInv = True TextoError = "Ocurrió un error al guardar los movimientos de salida" Exit For @@ -689,8 +726,12 @@ Partial Class Inventarios_Apartados ErrorMovInv = True Else If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + Dim CveSec As Integer = 0 + For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then + CveSec = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestino.SelectedValue.ToEntero, Dr("CvePS").ToString.ToEntero).FiltroPrimeroValor("CveSeccionAlmacen", "").ToEntero + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=CveSec, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then ErrorMovInv = True TextoError = "Ocurrió un error al guardar los movimientos de entrada" Exit For @@ -771,6 +812,13 @@ Partial Class Inventarios_Apartados Protected Sub GvDatosDesapartado_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosDesapartado.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then e.Row.FCTextBox("TxtCantidad").Attributes.Add("onblur", String.Format("ValidaCantidad(this,{0})", e.Row.DBCampo("Cantidad"))) + If CBool(e.Row.DBCampo("AplicaSeccion")) AndAlso DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero > 0 Then + e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True + e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero) + e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind() + e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + End If End Sub Protected Sub BtnVerificarExistenciasDesarmado_Click(sender As Object, e As EventArgs) @@ -789,11 +837,15 @@ Partial Class Inventarios_Apartados Dim DtTemp = GetExistenciasDT() If DtTemp IsNot Nothing Then + GvDatosDesapartado.Columns(5).Visible = DtTemp.MAX("Serie").ToString <> "" + GvDatosDesapartado.Columns(6).Visible = DtTemp.MAX("Lote").ToString <> "" + GvDatosDesapartado.Columns(7).Visible = DtTemp.MAX("FechaCaducidad").ToString.ToDate > MinFecha + GvDatosDesapartado.Columns(8).Visible = DtTemp.MAX("CveSeccionAlmacen").ToString.ToEntero > 0 + GvDatosDesapartado.DataSource = DtTemp GvDatosDesapartado.DataBind() UpDatosDesapartado.Update() - DtSeccionAlmacen.Rows.Clear() End If End Sub @@ -856,12 +908,12 @@ Partial Class Inventarios_Apartados End If Next - If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then - If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 2").SUMD("CantidadSeccionAlmacen") Then - Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - End If + 'If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then + ' If TotalCantidad <> DtSeccionAlmacen.FiltraParametros("TipoSeccionAlmacen = 2").SUMD("CantidadSeccionAlmacen") Then + ' Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia) + ' Exit Sub + ' End If + 'End If 'VALIDA SI HUBO CAMBIOS EN LA EXISTENCIA Dim CantidadGV = GvDatosDesapartado.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.DataKey("Cantidad").ToDouble) @@ -889,6 +941,7 @@ Partial Class Inventarios_Apartados Observaciones:=TxtObservacionesDesapartado.Text.Trim, Recibio:="", CveAlmacenDestino:=DdlAlmacenDestinoDesapartado.SelectedValue.ToEntero, CveCliente:=CveCliente, CveVendedor:=CveVendedor) FolioSalida = ObjInventario.Folio + Dim Diccionario As New HybridDictionary Dim Cont As Integer = 0 If CveMovimientoSalida <= 0 Then ErrorMovInv = True @@ -896,10 +949,12 @@ Partial Class Inventarios_Apartados Else For Each Gvr As GridViewRow In GvDatosDesapartado.Rows If Gvr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Gvr.FCTextBox("TxtCantidad").Text.ToDouble, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("PU").ToString.ToDecimal, -1, -1, Gvr.DataKey("SerieLote").ToString, CveMovimientoDetalleEntrada:=Gvr.DataKey("CveMovimientoDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Gvr.FCTextBox("TxtCantidad").Text.ToDouble, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("PU").ToString.ToDecimal, -1, CveSeccionAlmacen:=Gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=Gvr.DataKey("Serie").ToString, Lote:=Gvr.DataKey("Lote").ToString, FechaCaducidad:=Gvr.DataKey("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Gvr.DataKey("CveMovimientoDetalle").ToString.ToEntero) Then ErrorMovInv = True TextoError = "Ocurrió un error al guardar los movimientos de salida" Exit For + Else + Diccionario.Add(ObjInventario.CveMovimientoDetalle, Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue) End If End If Cont += 1 @@ -917,8 +972,11 @@ Partial Class Inventarios_Apartados ErrorMovInv = True Else If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + Dim i As Integer = 0 + For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then + Dim CveSeccionAlmacen As Integer = Diccionario(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.ToEntero + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero) Then ErrorMovInv = True TextoError = "Ocurrió un error al guardar los movimientos de entrada" Exit For @@ -955,6 +1013,12 @@ Partial Class Inventarios_Apartados ObjInventario.Dispose() End Sub + + Private Sub DdlAlmacenDestinoDesapartado_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlAlmacenDestinoDesapartado.SelectedIndexChanged + + CargaExistencias() + + End Sub #End Region #End Region diff --git a/Inventarios/CatSeccionesAlmacenes.aspx.vb b/Inventarios/CatSeccionesAlmacenes.aspx.vb index 15091d1ca..bf2e601a7 100644 --- a/Inventarios/CatSeccionesAlmacenes.aspx.vb +++ b/Inventarios/CatSeccionesAlmacenes.aspx.vb @@ -62,6 +62,8 @@ Partial Class Inventarios_CatSeccionesAlmacenes Alert("La Seccion se guardó correctamente.", TipoMensaje.MsgInformacion) ViewState("DTSeccionesAlmacenes") = ObjSeccion.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + ObjSeccion.GetSeccionesAlmacenes(UsuarioActual.CveEmpresa, -1) + GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1) = ObjSeccion.DtResultados If ViewState("Orden").ToString() <> String.Empty Then @@ -107,6 +109,7 @@ Partial Class Inventarios_CatSeccionesAlmacenes SeccionTxt.Text = "" DdlAlmacen.SelectedIndex = 0 Alert("La Seccion se actualizo correctamente.", TipoMensaje.MsgInformacion) + ObjSeccion.GetSeccionesAlmacenes(UsuarioActual.CveEmpresa, -1) ViewState("DTSeccionesAlmacenes") = ObjSeccion.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1) = ObjSeccion.DtResultados End If diff --git a/Inventarios/ConsignacionesMaterial.aspx.vb b/Inventarios/ConsignacionesMaterial.aspx.vb index 92caaee2d..77c1d9fe2 100644 --- a/Inventarios/ConsignacionesMaterial.aspx.vb +++ b/Inventarios/ConsignacionesMaterial.aspx.vb @@ -231,7 +231,7 @@ Partial Class Inventarios_ConsignacionesMaterial End Sub Protected Sub DdlAlmacen_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlAlmacen.SelectedIndexChanged - DdlSeccion.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa) + DdlSeccion.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero) DdlSeccion.DataBind() DdlSeccion.Items.Insert(0, New ListItem("Seleccione Sección.", "-1")) UPEncabezado.Update() diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 4d6fc54de..a0b2632f5 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -2148,27 +2148,27 @@ Partial Class Inventarios_EntradasSalidas EscondeColumnasGVM(DtMovimientos.FiltraParametros("Estatus <> 'E' ")) If DdlProducto2.SelectedValue.ToEntero > 0 Then - Dim MetodoInventario As Integer = GlobalDTPS(UsuarioActual.CveEmpresa, DdlProducto2.SelectedValue.ToEntero).FiltroPrimeroValor("Inv_CveMetodoInventario", "").ToEntero ' ("Inv_CveMetodoInventario = 6", "PS") - If MetodoInventario = 5 Then + Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlProducto2.SelectedValue.ToEntero).FiltroPrimero("") + If dr IsNot Nothing Then + If CBool(dr("AplicaSerie")) Then - 'LblSerieLote.Visible = True - TxtnSerie.Visible = True - divSerie.Visible = True + 'LblSerieLote.Visible = True + TxtnSerie.Visible = True + divSerie.Visible = True - 'TrSerieLote.Visible = True - 'TrSerieLote2.Visible = True - GvM.Columns(9).Visible = True + 'TrSerieLote.Visible = True + 'TrSerieLote2.Visible = True + + End If + If CBool(dr("AplicaLote")) Then + TxtnLote.Visible = True + divLote.Visible = True + 'TrLote.Visible = True + 'TrLote2.Visible = True + + End If End If - If MetodoInventario = 6 Then - TxtnLote.Visible = True - divLote.Visible = True - 'TrLote.Visible = True - 'TrLote2.Visible = True - GvM.Columns(10).Visible = True - 'TrBatch2.Visible = True - GvM.Columns(11).Visible = True - End If End If DdlUnidad.Items.Clear() @@ -2230,43 +2230,10 @@ Partial Class Inventarios_EntradasSalidas End If If DtTemp IsNot Nothing AndAlso DtTemp.Rows.Count > 0 Then - If DtTemp.MAX("Serie").ToString <> "" Then - 'LblSerie.Visible = True - TxtnSerie.Visible = True - 'TrSerieLote.Visible = True - 'TrSerieLote2.Visible = True - GvM.Columns(9).Visible = True - End If - - If DtTemp.MAX("Lote").ToString <> "" Then - TxtnLote.Visible = True - 'TrLote.Visible = True - 'TrLote2.Visible = True - GvM.Columns(10).Visible = True - - 'TxtnBatch.Visible = True - 'TrBatch.Visible = True - 'TrBatch2.Visible = True - 'GvM.Columns(11).Visible = True - End If - If DtTemp.MAX("FechaCaducidad").ToString <> "" Then - - GvM.Columns(11).Visible = True - - 'TxtnBatch.Visible = True - 'TrBatch.Visible = True - 'TrBatch2.Visible = True - 'GvM.Columns(11).Visible = True - End If - - - - If DtTemp.MAX("CveSeccionAlmacen").ToString <> "" Then - 'TxtnBatch.Visible = True - 'TrBatch.Visible = True - 'TrBatch2.Visible = True - GvM.Columns(12).Visible = True - End If + GvM.Columns(9).Visible = DtTemp.MAX("Serie").ToString <> "" + GvM.Columns(10).Visible = DtTemp.MAX("Lote").ToString <> "" + GvM.Columns(11).Visible = DtTemp.MAX("FechaCaducidad").ToString <> "" + GvM.Columns(12).Visible = DtTemp.MAX("CveSeccionAlmacen").ToString <> "" End If diff --git a/Inventarios/EntregaAlmacen.aspx b/Inventarios/EntregaAlmacen.aspx index 549d8088d..e38673a70 100644 --- a/Inventarios/EntregaAlmacen.aspx +++ b/Inventarios/EntregaAlmacen.aspx @@ -453,17 +453,18 @@ - +
    - + - + - + +
    @@ -776,7 +777,7 @@ - +
    diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index ef000a2d1..c092d7182 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -601,8 +601,8 @@ Partial Class Inventarios_EntregaAlmacen If Not DtDatos.Columns.Contains("CveSeccion") Then DtDatos.Columns.Add("CveSeccion", GetType(Integer)) End If - If Not DtDatos.Columns.Contains("Caducidad") Then - DtDatos.Columns.Add("Caducidad", GetType(Date)) + If Not DtDatos.Columns.Contains("FechaCaducidad") Then + DtDatos.Columns.Add("FechaCaducidad", GetType(Date)) End If If Not DtDatos.Columns.Contains("Seleccionado") Then DtDatos.Columns.Add("Seleccionado", GetType(Boolean)) @@ -611,9 +611,6 @@ Partial Class Inventarios_EntregaAlmacen DtDatos.Columns.Add("CantidadSeleccionada", GetType(Double)) End If - For Each Dr As DataRow In DtDatos.Rows - Dr("Caducidad") = Now - Next 'TxtFecha.Text = If(EsDevolucionVenta = 1, Now.ToShortDateString, DtDatos.Rows(0)("Fecha").ToString) End If @@ -834,7 +831,7 @@ Partial Class Inventarios_EntregaAlmacen If CBool(e.Row.DBCampo("AplicaSeccion")) Then e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True If DdlAlmacen.SelectedValue.ToEntero > 0 Then - e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero) + e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero) e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind() e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) End If @@ -1001,7 +998,7 @@ Partial Class Inventarios_EntregaAlmacen If DtSerie.Rows.Count > 0 Then Dim Mensaje As New StringBuilder - Mensaje.AppendFormat("Serie / Lote Recomendado: {0}", DtSerie.Rows(0)("Serie")) + Mensaje.AppendFormat("Serie Recomendado: {0}", DtSerie.Rows(0)("Serie")) If AplicaCaducidad Then Mensaje.AppendFormat(", Caducicdad: {0}", DtSerie.Rows(0)("FechaCaducidad").ToString.ToDate.ToShortDateString) LbSerieRecomendado.Text = Mensaje.ToString 'String.Format("Serie / Lote Recomendado: {0}, Caducicdad: {1}", ObjInventarios.DtResultados.Rows(0)("SerieLote"), ObjInventarios.DtResultados.Rows(0)("FechaCaducidad").ToString.ToDate.ToShortDateString) Else @@ -1318,10 +1315,10 @@ Partial Class Inventarios_EntregaAlmacen Protected Sub GvLote_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvLote.RowDeleting - Dim keySerieLote As String = e.Keys("Lote").ToString + Dim keyLote As String = e.Keys("Lote").ToString Try For Each dr As DataRow In DtDatosDetalleLote.Rows - If dr("Lote").ToString = keySerieLote Then + If dr("Lote").ToString = keyLote Then dr.Delete() End If Next @@ -1592,7 +1589,7 @@ Partial Class Inventarios_EntregaAlmacen If gvr.FCCheckBox("cbInv").Checked AndAlso gvr.FCTextBox("TbCantidadF").Text.ToDecimal > 0 Then DtDatos.Rows(Index)("CantidadGV") = gvr.FCTextBox("TbCantidadF").Text.ToDecimal DtDatos.Rows(Index)("CveSeccion") = gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero - DtDatos.Rows(Index)("Caducidad") = gvr.FCTextBox("TxtCaducidad").Text.ToDate + DtDatos.Rows(Index)("FechaCaducidad") = gvr.FCTextBox("TxtCaducidad").Text.ToDate DtDatos.Rows(Index)("Lote") = gvr.FCTextBox("TxtLote").Text End If Index += 1 @@ -1651,10 +1648,10 @@ Partial Class Inventarios_EntregaAlmacen If CBool(Dr("AplicaSerie")) Then DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) For Each Dr1 As DataRow In DtDetalle.Rows - StrXML.AppendFormat("", Dr1("CvePS"), Dr1("CveUM"), 1, IfNull(Dr("CveSeccion"), -1), Dr1("Serie"), Lote, FechaCaducidad.ToShortDateString) + StrXML.AppendFormat("", Dr1("CvePS"), Dr1("CveUM"), 1, IfNull(Dr("CveSeccion"), -1), Dr1("Serie"), Lote, FechaCaducidad.ToString("yyyy/MM/dd")) Next Else - StrXML.AppendFormat("", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), IfNull(Dr("CveSeccion"), -1), "-1", Lote, FechaCaducidad.ToShortDateString) + StrXML.AppendFormat("", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), IfNull(Dr("CveSeccion"), -1), "-1", Lote, FechaCaducidad.ToString("yyyy/MM/dd")) End If End If Next @@ -1705,7 +1702,7 @@ Partial Class Inventarios_EntregaAlmacen DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) For Each Dr1 As DataRow In DtDetalle.Rows - If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Dr1("Serie").ToString, CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Dr1("Serie").ToString, CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then For Each Dr2 As DataRow In ObjInventario.DtResultados.FiltraParametros("CveAlmacen > 0 AND ExistenciaFinal > 0").Rows 'BUSCA SI EXISTE YA UN TRASPASO DEL ALMACEN DE APARTADO @@ -1734,7 +1731,7 @@ Partial Class Inventarios_EntregaAlmacen CantidadPendiente = 1 - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Serie:=Dr1("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Serie:=Dr1("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un Error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") Exit For @@ -1749,11 +1746,11 @@ Partial Class Inventarios_EntregaAlmacen If ErrorMovInv Then Exit For Next - ElseIf Dr("Inv_CveMetodoInventario").ToString = "6" Then + ElseIf CBool(Dr("AplicaLote")) Then DtDetalle = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) For Each Dr1 As DataRow In DtDetalle.Rows - If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Dr1("Lote").ToString, CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Dr1("Lote").ToString, CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then CantidadSaldo = Dr("CantidadGV").ToString.ToDecimal @@ -1784,7 +1781,7 @@ Partial Class Inventarios_EntregaAlmacen CantidadPendiente = If(Dr1("Cantidad").ToString.ToDecimal > CantidadSaldo, CantidadSaldo, Dr1("Cantidad").ToString.ToDecimal) - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Lote:=Dr1("Lote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Lote:=Dr1("Lote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") Exit For @@ -1802,7 +1799,7 @@ Partial Class Inventarios_EntregaAlmacen Else - If ObjInventario.GetExistenciasProducto(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If ObjInventario.GetExistenciasProducto(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then CantidadSaldo = Dr("CantidadGV").ToString.ToDecimal @@ -1837,7 +1834,7 @@ Partial Class Inventarios_EntregaAlmacen If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Serie:=Dr("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, - FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), + FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then ErrorMovInv = True @@ -1883,7 +1880,7 @@ Partial Class Inventarios_EntregaAlmacen If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") Exit For @@ -1981,7 +1978,7 @@ Partial Class Inventarios_EntregaAlmacen End If For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") Exit For @@ -2011,7 +2008,7 @@ Partial Class Inventarios_EntregaAlmacen PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND Serie = '{Dr1("Serie").ToString}'").ToString.ToDecimal End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, Serie:=Dr1("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, Serie:=Dr1("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar.") Exit For @@ -2020,10 +2017,10 @@ Partial Class Inventarios_EntregaAlmacen ElseIf DtDetalleLote.Rows.Count > 0 Then For Each Dr1 As DataRow In DtDetalleLote.Rows If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then - PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal + PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND Serie = '{Dr1("Serie").ToString}'").ToString.ToDecimal End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar.") Exit For @@ -2034,7 +2031,7 @@ Partial Class Inventarios_EntregaAlmacen PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}").ToString.ToDecimal End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar.") Exit For @@ -2072,7 +2069,7 @@ Partial Class Inventarios_EntregaAlmacen Else If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, EsInterno:=EsInterno, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero()) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, EsInterno:=EsInterno, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero()) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de entrada") Exit For @@ -2527,21 +2524,21 @@ Partial Class Inventarios_EntregaAlmacen 'VERIFICAR EXISTENCIA Dim StrXML As New StringBuilder + Dim Lote As String = "" + Dim FechaCaducidad As Date StrXML.Append("") For Each Dr As DataRow In DtDatos.Rows + FechaCaducidad = If(CBool(Dr("AplicaCaducidad")) AndAlso Dr("FechaCaducidad").ToString <> "", Dr("FechaCaducidad").ToString.ToDate, MinFecha) + Lote = If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1") + If Dr("CantidadGV").ToString.ToDecimal > 0 Then - If Dr("Inv_CveMetodoInventario").ToString = "5" Then + If CBool(Dr("AplicaSerie")) Then DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) For Each Dr1 As DataRow In DtDetalle.Rows - StrXML.AppendFormat("", Dr1("CvePS"), Dr1("CveUM"), 1, Dr1("Serie")) - Next - ElseIf Dr("Inv_CveMetodoInventario").ToString = "6" Then - DtDetalle = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) - For Each Dr1 As DataRow In DtDetalle.Rows - StrXML.AppendFormat("", Dr1("CvePS"), Dr1("CveUM"), DtDatosDetalleLote.SUM("Cantidad", $"Lote = '{Dr1("Lote").ToString}' "), Dr1("Lote")) + StrXML.AppendFormat("", Dr1("CvePS"), Dr1("CveUM"), 1, IfNull(Dr("CveSeccion"), -1), Dr1("Serie"), Lote, FechaCaducidad.ToString("YYYY/MM/DD")) Next Else - StrXML.AppendFormat("", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), "-1") + StrXML.AppendFormat("", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), IfNull(Dr("CveSeccion"), -1), "-1", Lote, FechaCaducidad.ToString("YYYY/MM/DD")) End If End If Next @@ -2581,7 +2578,7 @@ Partial Class Inventarios_EntregaAlmacen For Each Dr As DataRow In DtDatos.Rows DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) DtDetalleLote = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) - If DtDetalle.Rows.Count > 0 Then 'SI FUE POR SERIELOTE + If DtDetalle.Rows.Count > 0 Then 'SI FUE POR SERIE For Each Dr1 As DataRow In DtDetalle.Rows If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, Serie:=Dr1("Serie").ToString, CveVentaDetalle:=-1, CveContratoDetalle:=Dr("CveContratoDetalle").ToString.ToEntero) Then ErrorMovInv = True @@ -2875,7 +2872,7 @@ Partial Class Inventarios_EntregaAlmacen Row("CveSeccion") = GvDatos.Rows(index2).FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero End If If GvDatos.Rows(index2).FCTextBox("TxtCaducidad").Text <> "" Then - Row("Caducidad") = GvDatos.Rows(index2).FCTextBox("TxtCaducidad").Text.ToDate + Row("FechaCaducidad") = GvDatos.Rows(index2).FCTextBox("TxtCaducidad").Text.ToDate End If index2 += 1 Next @@ -2934,8 +2931,8 @@ Partial Class Inventarios_EntregaAlmacen If Row("CveSeccion").ToString <> "" Then GvDatos.Rows(index2).FCDropDownList("DdlSeccionAlmacen").SelectedValue = Row("CveSeccion").ToString End If - If Row("Caducidad").ToString <> "" Then - GvDatos.Rows(index2).FCTextBox("TxtCaducidad").Text = Row("Caducidad").ToString.ToDate.ToShortDateString + If Row("FechaCaducidad").ToString <> "" Then + GvDatos.Rows(index2).FCTextBox("TxtCaducidad").Text = Row("FechaCaducidad").ToString.ToDate.ToShortDateString End If index2 += 1 Next @@ -3022,7 +3019,7 @@ Partial Class Inventarios_EntregaAlmacen Dim Index = 1 For Each Dr As DataRow In DtDatosSugerencias.Rows Dr("Consec") = Index - 'Dr("Caducidad") = Now + Index += 1 Next @@ -3032,7 +3029,7 @@ Partial Class Inventarios_EntregaAlmacen GvSugerencias.Columns(2).Visible = DtDatosSugerencias.MAX("Seccion") <> "" GvSugerencias.Columns(3).Visible = DtDatosSugerencias.MAX("Serie") <> "" GvSugerencias.Columns(4).Visible = DtDatosSugerencias.MAX("Lote") <> "" - GvSugerencias.Columns(5).Visible = DtDatosSugerencias.MAX("Caducidad") <> "" + GvSugerencias.Columns(5).Visible = DtDatosSugerencias.MAX("FechaCaducidad") <> "" End If diff --git a/Inventarios/KardexAlmacen.aspx.vb b/Inventarios/KardexAlmacen.aspx.vb index e894daab8..70c9ebda8 100644 --- a/Inventarios/KardexAlmacen.aspx.vb +++ b/Inventarios/KardexAlmacen.aspx.vb @@ -13,7 +13,7 @@ Partial Class Inventarios_KardexAlmacen ddlAlmacen.Items.Insert(0, New ListItem("Todos", "-1")) 'If Not UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 13, 66) Then - ' GvDatos.Columns(6).Visible = True ' SerieLote + ' GvDatos.Columns(7).Visible = True ' FCaducidad 'End If If IfNull(Request("CvePS"), "-1").ToString.ToEntero > 0 Then CargarKardex(Request("CvePS").ToString.ToEntero) diff --git a/Inventarios/PaquetesArmadoDesarmado.aspx b/Inventarios/PaquetesArmadoDesarmado.aspx index fd7f4be1d..b6b4271e3 100644 --- a/Inventarios/PaquetesArmadoDesarmado.aspx +++ b/Inventarios/PaquetesArmadoDesarmado.aspx @@ -222,9 +222,9 @@ - + - + @@ -484,9 +484,9 @@ - + - + @@ -558,15 +558,15 @@ Serie/Lote: - - - + + + - + diff --git a/Inventarios/PaquetesArmadoDesarmado.aspx.vb b/Inventarios/PaquetesArmadoDesarmado.aspx.vb index 077c657b7..54ec0779b 100644 --- a/Inventarios/PaquetesArmadoDesarmado.aspx.vb +++ b/Inventarios/PaquetesArmadoDesarmado.aspx.vb @@ -470,13 +470,13 @@ Partial Class Inventarios_PaquetesArmadoDesarmado If Gvr.DataKey("Cantidad").ToString.ToDouble > 0 Then If Gvr.DataKey("Inv_CveMetodoInventario").ToString.ToEntero = 5 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"), SerieLote:=Dr("Serie").ToString, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) >= 1 Then + 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")) TieneError = True Exit For End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, 0, -1, SerieLote:=Dr("Serie").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, 0, -1, Serie:=Dr("Serie").ToString) Then MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de salida. Por favor vuelva a intentar." TieneError = True Exit For @@ -520,7 +520,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado 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, SerieLote:=Gvr.FCTextBox("TxtSerie").Text.Trim) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 1, CveUMTemp, CvePSTemp, PUTemp, -1, 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 @@ -577,7 +577,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado If CveTipoPS = 5 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, SerieLote:=Gvr.DataKey("Serie").ToString) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, CveUMTemp, CvePSTemp, 0, -1, Serie:=Gvr.DataKey("Serie").ToString) Then TieneError = True MensajeError = "Ocurrió un error al guardar los detalles con serie del movimiento de salida" Exit For @@ -611,7 +611,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado If Gvr.DataKey("Cantidad").ToString.ToDouble > 0 Then If Gvr.DataKey("Inv_CveMetodoInventario").ToString.ToEntero = 5 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, SerieLote:=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, -1, 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 @@ -805,11 +805,11 @@ Partial Class Inventarios_PaquetesArmadoDesarmado Dim VariableCampoSerie = "" If TipoMovimiento = 1 Then Dim ObjInventarios As New ClsInventarios - If ObjInventarios.SerieLoteRecomendadoGet(CvePSSerieLote, UsuarioActual.CveEmpresa, If(TipoMovimiento = 1, CveAlmacenArmado, CveAlmacenDesarmado)) Then + If ObjInventarios.SerieRecomendadoGet(CvePSSerieLote, UsuarioActual.CveEmpresa, If(TipoMovimiento = 1, CveAlmacenArmado, CveAlmacenDesarmado)) Then DtSerieLote = ObjInventarios.DtResultados End If ObjInventarios.Dispose() - VariableCampoSerie = "SerieLote" + VariableCampoSerie = "Serie" Else DtSerieLote = If(DtExistenciasDesarmado IsNot Nothing, DtExistenciasDesarmado.Copy, Nothing) VariableCampoSerie = "SeriePS" @@ -835,12 +835,12 @@ Partial Class Inventarios_PaquetesArmadoDesarmado If DtSerieLote.Rows.Count > 0 Then Dim Mensaje As New StringBuilder Mensaje.AppendFormat("Serie / Lote Recomendado: {0}", DtSerieLote.Rows(0)(VariableCampoSerie)) - LbSerieLoteRecomendado.Text = Mensaje.ToString 'String.Format("Serie / Lote Recomendado: {0}, Caducicdad: {1}", ObjInventarios.DtResultados.Rows(0)("SerieLote"), ObjInventarios.DtResultados.Rows(0)("FechaCaducidad").ToString.ToDate.ToShortDateString) + LbSerieRecomendado.Text = Mensaje.ToString 'String.Format("Serie / Lote Recomendado: {0}, Caducicdad: {1}", ObjInventarios.DtResultados.Rows(0)("Serie"), ObjInventarios.DtResultados.Rows(0)("FechaCaducidad").ToString.ToDate.ToShortDateString) Else - LbSerieLoteRecomendado.Text = "No se encontro ningun Serie/Lote." + LbSerieRecomendado.Text = "No se encontro ningun Serie/Lote." End If Else - LbSerieLoteRecomendado.Text = "No se encontro ningun Serie/Lote." + LbSerieRecomendado.Text = "No se encontro ningun Serie/Lote." End If If DtSerieLote IsNot Nothing Then DtSerieLote.Dispose() UpSerie.Update() @@ -848,17 +848,17 @@ Partial Class Inventarios_PaquetesArmadoDesarmado End Sub Protected Sub BtnAgregarPS_Click(sender As Object, e As EventArgs) - AgregaSerieLote(TxtSerieLote.Text.Trim, 1) + AgregaSerieLote(TxtSerie.Text.Trim, 1) End Sub - Private Sub AgregaSerieLote(SerieLote As String, Tipo As Integer) + Private Sub AgregaSerieLote(Serie As String, Tipo As Integer) - If SerieLote.Trim = "" Then + If Serie.Trim = "" Then Alert("El campo Serie es obligatorio. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Exit Sub End If - Dim SeriesArreglo = SerieLote.Split(";"c) + Dim SeriesArreglo = Serie.Split(";"c) 'VALIDACION DE SERIES DUPLICADAS Dim MensajeAlert As New StringBuilder @@ -897,7 +897,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado 'VERIFICA EXISTENCIAS Dim Existencia = 0.0D If TipoMovimiento = 1 Then - Existencia = ObjInventarios.GetExistenciasPS(CvePSSerieLote, CveUMSerieLote, UsuarioActual.CveEmpresa, DdlAlmacenArmado.SelectedValue.ToEntero, FechaMovto:=TxtFechaArmado.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=Serie, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) + Existencia = ObjInventarios.GetExistenciasPS(CvePSSerieLote, CveUMSerieLote, UsuarioActual.CveEmpresa, DdlAlmacenArmado.SelectedValue.ToEntero, FechaMovto:=TxtFechaArmado.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Serie, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) Else Existencia = If(DtExistenciasDesarmado Is Nothing, 0, DtExistenciasDesarmado.FiltraParametros($"CvePS={CvePSSerieLote} AND SeriePS='{Serie}'").Rows.Count.ToString.ToDecimal) End If @@ -931,7 +931,7 @@ Partial Class Inventarios_PaquetesArmadoDesarmado ObjInventarios.Dispose() If Tipo = 1 Then - TxtSerieLote.Text = "" + TxtSerie.Text = "" End If CargaSerie(2) @@ -988,20 +988,20 @@ Partial Class Inventarios_PaquetesArmadoDesarmado End If End Sub Protected Sub BtnAgregarSerieDesarmado_Click(sender As Object, e As EventArgs) - Dim SerieLote = TxtSerieDesarmado.Text.Trim + Dim Serie = TxtSerieDesarmado.Text.Trim 'VERIFICA EXISTENCIAS Dim ObjInventarios As New ClsInventarios Dim CveUMTemp = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePaqueteDesarmado).FiltroPrimeroValor("CveUM").ToEntero - Dim Existencia = ObjInventarios.GetExistenciasPS(CvePaqueteDesarmado, CveUMTemp, UsuarioActual.CveEmpresa, CveAlmacenDesarmado, FechaMovto:=LbFechaDesarmado.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=SerieLote, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) + Dim Existencia = ObjInventarios.GetExistenciasPS(CvePaqueteDesarmado, CveUMTemp, UsuarioActual.CveEmpresa, CveAlmacenDesarmado, FechaMovto:=LbFechaDesarmado.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Serie, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) If Existencia < 1 Then - Alert($"No hay existencia suficiente con la Serie definida ""{SerieLote}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) + Alert($"No hay existencia suficiente con la Serie definida ""{Serie}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") Exit Sub End If - If ObjInventarios.GetPaqueteRelacionSeries(CvePaqueteDesarmado, SerieLote) Then + If ObjInventarios.GetPaqueteRelacionSeries(CvePaqueteDesarmado, Serie) Then If DtExistenciasDesarmado Is Nothing Then DtExistenciasDesarmado = ObjInventarios.DtResultados.Copy Else diff --git a/Inventarios/RecepcionAlmacen.aspx b/Inventarios/RecepcionAlmacen.aspx index f4b956e66..9b96fab08 100644 --- a/Inventarios/RecepcionAlmacen.aspx +++ b/Inventarios/RecepcionAlmacen.aspx @@ -479,7 +479,7 @@ - + @@ -721,23 +721,12 @@ - Serie/Lote: + Serie: - - Fecha Caducidad: - - -   - - - - - - - + @@ -748,8 +737,7 @@ - - + diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 14eb25827..893e3be4c 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -436,7 +436,6 @@ Partial Class Inventarios_RecepcionAlmacen DivRemision.Visible = True End If - TxtFechaCaducidad.Text = Now.ToShortDateString TxtFechaPendientes.Text = Now.ToShortDateString TipoCambio = -1 CreaDtDetalle() @@ -1268,6 +1267,7 @@ Partial Class Inventarios_RecepcionAlmacen e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind() e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) End If + e.Row.FCTextBox("TxtDividir").Visible = True Else e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False @@ -1277,6 +1277,7 @@ Partial Class Inventarios_RecepcionAlmacen e.Row.FCTextBox("TxtCaducidad").Visible = True e.Row.FCLinkButton("LnkCaducidad").Visible = True e.Row.FCTextBox("TxtCaducidad").Text = Now.ToShortDateString + e.Row.FCTextBox("TxtDividir").Visible = True Else e.Row.FCTextBox("TxtCaducidad").Visible = False e.Row.FCLinkButton("LnkCaducidad").Visible = False @@ -1446,7 +1447,6 @@ Partial Class Inventarios_RecepcionAlmacen LbProducto.Text = Argumentos(3) LbCantidad.Text = Argumentos(4).FormatoNumero - TxtFechaCaducidad.Text = Now.ToShortDateString() CvePSSerie = Argumentos(0).ToEntero CveUMSerie = Argumentos(1).ToEntero @@ -1612,7 +1612,7 @@ Partial Class Inventarios_RecepcionAlmacen End If If TipoMovimiento = 2 Then - If DtExistencias.SUM("Existencia", $"SerieLote = {Serie}") = 0 Then + If DtExistencias.SUM("Existencia", $"Serie = {Serie}") = 0 Then MensajeSinExistencias.Append($"Serie: {Serie}.
    ") Continue For End If @@ -1638,7 +1638,6 @@ Partial Class Inventarios_RecepcionAlmacen If Tipo = 1 Then TxtSerie.Text = "" - TxtFechaCaducidad.Text = Now.ToShortDateString End If CargaSerie(Tipo, True) @@ -1752,10 +1751,10 @@ Partial Class Inventarios_RecepcionAlmacen End Sub Protected Sub BtnAddPSLote_Click(sender As Object, e As EventArgs) - AgregaLote(TxtLote.Text.Trim, TxtFechaCaducidad.Text.ToDate, 1) + AgregaLote(TxtLote.Text.Trim, 1) End Sub - Private Sub AgregaLote(Lote As String, FechaCaducidad As Date, Tipo As Integer) + Private Sub AgregaLote(Lote As String, Tipo As Integer) If Lote.Trim = "" Then Alert("El campo Lote es obligatorio. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -1783,15 +1782,15 @@ Partial Class Inventarios_RecepcionAlmacen 'VERIFICA EXISTENCIAS If TipoMovimiento > 1 Then - Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Lote, FechaCaducidad:=FechaCaducidad) + Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Lote) If Existencia < CantidadLote Then - Alert($"
    El numero de Lote ""{Lote}"" y FechaCaducidad = '{FechaCaducidad}' proporcionado ya se encuentra ingresado.", TipoMensaje.MsgAdvertencia) + Alert($"
    El numero de Lote ""{Lote}"" proporcionado ya se encuentra ingresado.", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") End If If TipoMovimiento = 2 Then - If Not DtExistencias.SUM("Existencia", $"Lote = '{Lote}' FechaCaducidad = '{FechaCaducidad}'") = 0 Then - Alert($"
    El numero de Lote ""{Lote}"" y FechaCaducidad '{FechaCaducidad}' proporcionado ya se encuentra ingresado.", TipoMensaje.MsgAdvertencia) + If Not DtExistencias.SUM("Existencia", $"Lote = '{Lote}' ") = 0 Then + Alert($"
    El numero de Lote ""{Lote}"" proporcionado ya se encuentra ingresado.", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") End If End If @@ -1804,8 +1803,8 @@ Partial Class Inventarios_RecepcionAlmacen Row("CveUM") = CveUMSerie Row("PU") = PUSerie Row("Lote") = Lote - Row("FechaCaducidad") = FechaCaducidad - Row("FechaCaducidad") = If(IsDate(TxtFechaCaducidadLote.Text), TxtFechaCaducidadLote.Text, MinFecha.ToShortDateString) + 'Row("FechaCaducidad") = FechaCaducidad + 'Row("FechaCaducidad") = If(IsDate(TxtFechaCaducidadLote.Text), TxtFechaCaducidadLote.Text, MinFecha.ToShortDateString) 'Row("FechaCaducidad") = If(AplicaCaducidad, TxtFechaCaducidadLote.Text, MinFecha.ToShortDateString) DtDatosLoteDetalle.Rows.Add(Row) @@ -1813,8 +1812,6 @@ Partial Class Inventarios_RecepcionAlmacen If Tipo = 1 Then TxtLote.Text = "" - TxtBatch.Text = "" - TxtFechaCaducidad.Text = Now.ToShortDateString End If CargaLote(1, True) @@ -2324,7 +2321,7 @@ Partial Class Inventarios_RecepcionAlmacen If Not ErrorMovInv AndAlso Dt IsNot Nothing Then For Each Dr As DataRow In Dt.FiltraParametros($"CveVenta={CveVenta}").Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovtoSalidaDirecta, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, Dr("CveSeccionAlmacen").ToString.ToEntero, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovtoSalidaDirecta, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then ErrorMovInv = True Exit For End If @@ -2385,12 +2382,12 @@ Partial Class Inventarios_RecepcionAlmacen Exit For End If - If Not ObjInventario.AddMovimientoDetalle(CveMovtoSalidaActual, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, Dr("CveSeccionAlmacen").ToString.ToEntero, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovtoSalidaActual, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then ErrorMovInv = True Exit For End If - If Not ObjInventario.AddMovimientoDetalle(CveMovtoEntradaActual, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, Dr("CveSeccionAlmacen").ToString.ToEntero, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovtoEntradaActual, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then ErrorMovInv = True Exit For End If @@ -2817,68 +2814,77 @@ Partial Class Inventarios_RecepcionAlmacen End If End If + Else + ErrorMovInv = True + MensajeError = "Error al obtener movimientos" End If 'PREPOLIZA - NC - If TipoMovimiento = 3 AndAlso ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - - Dim DtCostos As DataTable = Nothing - DtCostos = ObjInventario.DtResultados - Dim TotalCosto As Decimal = DtCostos.SUM("Total").ToDecimal - - Dim TotalNC As Decimal = 0 - Dim CveClasificacionDifCostoNC = -1 - Dim tTipoCambio As Decimal = 1 - If CveMoneda <> 1 Then tTipoCambio = TipoCambio.ToDecimal - - For Each gvr As GridViewRow In GvInv.Rows - TotalNC += gvr.FCTextBox("TbCantidadF").Text.ToDecimal * gvr.DataKey("PU").ToDecimal * tTipoCambio - CveClasificacionDifCostoNC = gvr.DataKey("CveClasificacion").ToEntero - Next - Dim IdCtaContableClasificacion As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {CveClasificacionDifCostoNC}").ToEntero - Dim CveCuentaClasificacion As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostosSIG", $"CveClasificacion = {CveClasificacionDifCostoNC}").ToEntero - - TotalCosto = Math.Round(TotalCosto, 2) - TotalNC = Math.Round(TotalNC, 2) - Dim DifCostoNC = Math.Round(TotalCosto - TotalNC, 2) + If TipoMovimiento = 3 Then + If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - 'VARIABLES - Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {DdlAlmacen.SelectedValue}").ToEntero - Dim CveCuentaAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {DdlAlmacen.SelectedValue}").ToEntero - Dim Fecha As Date = TxtFecha.Text.ToDate - Dim CveProveedor As Integer = -1 - Dim ProveedorNombre As String = "" - Dim SerieFolio As String = "" - Dim IdCtaContableNC = 0 - Dim CveConceptoContableNC = -1 - If DtCostos.Rows.Count > 0 Then - If CveCompraSurtir > 0 Then - If ObjCompras.GetCompras(CveCompraSurtir, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then - CveProveedor = ObjCompras.DtResultados(0)("CveProveedor").ToString.ToEntero - ProveedorNombre = ObjCompras.DtResultados(0)("RazonSocial").ToString - SerieFolio = $"NC: {ObjCompras.DtResultados(0)("SerieFolio").ToString}" + Dim DtCostos As DataTable = Nothing + DtCostos = ObjInventario.DtResultados + Dim TotalCosto As Decimal = DtCostos.SUM("Total").ToDecimal - CveConceptoContableNC = 225 - If ObjConta.GetRetCuenta(CveConceptoContableNC, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - IdCtaContableNC = ObjConta.DtResultados.FiltroPrimeroValor("IdCtaContable").ToEntero + Dim TotalNC As Decimal = 0 + Dim CveClasificacionDifCostoNC = -1 + Dim tTipoCambio As Decimal = 1 + If CveMoneda <> 1 Then tTipoCambio = TipoCambio.ToDecimal + + For Each gvr As GridViewRow In GvInv.Rows + TotalNC += gvr.FCTextBox("TbCantidadF").Text.ToDecimal * gvr.DataKey("PU").ToDecimal * tTipoCambio + CveClasificacionDifCostoNC = gvr.DataKey("CveClasificacion").ToEntero + Next + Dim IdCtaContableClasificacion As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {CveClasificacionDifCostoNC}").ToEntero + Dim CveCuentaClasificacion As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostosSIG", $"CveClasificacion = {CveClasificacionDifCostoNC}").ToEntero + + TotalCosto = Math.Round(TotalCosto, 2) + TotalNC = Math.Round(TotalNC, 2) + Dim DifCostoNC = Math.Round(TotalCosto - TotalNC, 2) + + + 'VARIABLES + Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {DdlAlmacen.SelectedValue}").ToEntero + Dim CveCuentaAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {DdlAlmacen.SelectedValue}").ToEntero + Dim Fecha As Date = TxtFecha.Text.ToDate + Dim CveProveedor As Integer = -1 + Dim ProveedorNombre As String = "" + Dim SerieFolio As String = "" + Dim IdCtaContableNC = 0 + Dim CveConceptoContableNC = -1 + + If DtCostos.Rows.Count > 0 Then + If CveCompraSurtir > 0 Then + If ObjCompras.GetCompras(CveCompraSurtir, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then + CveProveedor = ObjCompras.DtResultados(0)("CveProveedor").ToString.ToEntero + ProveedorNombre = ObjCompras.DtResultados(0)("RazonSocial").ToString + SerieFolio = $"NC: {ObjCompras.DtResultados(0)("SerieFolio").ToString}" + + CveConceptoContableNC = 225 + If ObjConta.GetRetCuenta(CveConceptoContableNC, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then + IdCtaContableNC = ObjConta.DtResultados.FiltroPrimeroValor("IdCtaContable").ToEntero + End If + + Else + ErrorMovInv = True End If - - Else - ErrorMovInv = True End If - End If - If Not ErrorMovInv Then - CvePrePoliza = ObjConta.AddPrePolizas("Inventario/RecepcionAlmacen-NC", 74, TotalCosto, TotalCosto, 1, Fecha, ProveedorNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If CvePrePoliza > 0 Then - If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, TotalNC, SerieFolio, CveConceptoContableNC, SerieFolio, Fecha, IdCtaContableNC, -1, CveCompra:=CveCompraSurtir, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=TotalNC) Then - If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, TotalCosto * -1, SerieFolio, 68, SerieFolio, Fecha, IdCtaContableAlmacen, -1, CveCompra:=CveCompraSurtir, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=TotalCosto * -1, CveCuenta:=CveCuentaAlmacen) Then - If DifCostoNC <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, DifCostoNC * -1, SerieFolio, 69, SerieFolio, Fecha, IdCtaContableClasificacion, -1, CveClasificacion:=CveClasificacionDifCostoNC, CveCompra:=CveCompraSurtir, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=DifCostoNC * -1, CveCuenta:=CveCuentaClasificacion) Then - ErrorMovInv = True + If Not ErrorMovInv Then + CvePrePoliza = ObjConta.AddPrePolizas("Inventario/RecepcionAlmacen-NC", 74, TotalCosto, TotalCosto, 1, Fecha, ProveedorNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CvePrePoliza > 0 Then + If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, TotalNC, SerieFolio, CveConceptoContableNC, SerieFolio, Fecha, IdCtaContableNC, -1, CveCompra:=CveCompraSurtir, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=TotalNC) Then + If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, TotalCosto * -1, SerieFolio, 68, SerieFolio, Fecha, IdCtaContableAlmacen, -1, CveCompra:=CveCompraSurtir, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=TotalCosto * -1, CveCuenta:=CveCuentaAlmacen) Then + If DifCostoNC <> 0 Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, DifCostoNC * -1, SerieFolio, 69, SerieFolio, Fecha, IdCtaContableClasificacion, -1, CveClasificacion:=CveClasificacionDifCostoNC, CveCompra:=CveCompraSurtir, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=DifCostoNC * -1, CveCuenta:=CveCuentaClasificacion) Then + ErrorMovInv = True + End If End If + Else + ErrorMovInv = True End If Else ErrorMovInv = True @@ -2886,51 +2892,53 @@ Partial Class Inventarios_RecepcionAlmacen Else ErrorMovInv = True End If - Else - ErrorMovInv = True End If - End If - If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then - If ObjConta.ValorPolizaDescuadre > 0 Then - GuardaLogAD($"Inventarios/RecepcionAlmacen-PPNC | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") - ErrorMovInv = True + If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + GuardaLogAD($"Inventarios/RecepcionAlmacen-PPNC | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + ErrorMovInv = True + End If End If - End If - 'CONTABILIZAR - UNIFICAR Y SIMPLIFICAR CON PP DE LA COMPRA - If Not ErrorMovInv Then + 'CONTABILIZAR - UNIFICAR Y SIMPLIFICAR CON PP DE LA COMPRA + If Not ErrorMovInv Then - If CvePrePolizaCompra > 0 Then - If UsuarioActual.Empresa.Funcionalidad(219) = "1" Then - If Not ObjConta.PrePolizaUnificacion(CvePrePoliza, CvePrePolizaCompra) Then - ErrorMovInv = True - MensajeError = "Error al unificar los conceptos contables" + If CvePrePolizaCompra > 0 Then + If UsuarioActual.Empresa.Funcionalidad(219) = "1" Then + If Not ObjConta.PrePolizaUnificacion(CvePrePoliza, CvePrePolizaCompra) Then + ErrorMovInv = True + MensajeError = "Error al unificar los conceptos contables" + End If End If End If - End If - If UsuarioActual.Empresa.Funcionalidad(220) <> "" Then - If Not ObjConta.PrePolizaSimplificacion(CvePrePoliza, UsuarioActual.CveEmpresa) Then - ErrorMovInv = True - MensajeError = "Error al simplificar los conceptos contables" + If UsuarioActual.Empresa.Funcionalidad(220) <> "" Then + If Not ObjConta.PrePolizaSimplificacion(CvePrePoliza, UsuarioActual.CveEmpresa) Then + ErrorMovInv = True + MensajeError = "Error al simplificar los conceptos contables" + End If End If - End If - If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then - ObjContaContPAQ = New ClsContPAQi(UsuarioActual.Empresa) - ObjContaContPAQ.IniciaTransacSQL() - If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContaContPAQ) Then - MensajeContabilidad = $"
    Movimiento contabilizado en el folio: {ObjConta.ContaFolio}
    " - Else - ErrorMovInv = True - MensajeError = "Error al contabilizar los conceptos contables" + If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then + ObjContaContPAQ = New ClsContPAQi(UsuarioActual.Empresa) + ObjContaContPAQ.IniciaTransacSQL() + If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContaContPAQ) Then + MensajeContabilidad = $"
    Movimiento contabilizado en el folio: {ObjConta.ContaFolio}
    " + Else + ErrorMovInv = True + MensajeError = "Error al contabilizar los conceptos contables" + End If End If + End If End If + Else + ErrorMovInv = True + MensajeError = "Error al obtener movimientos" End If End If diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index fc562aaa7..e5b6eb401 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -458,7 +458,7 @@ Partial Class Inventarios_RecepcionUsados dt.Columns.Add("CostoIndirecto", Type.GetType("System.Double")) dt.Columns.Add("CodigoAF") dt.Columns.Add("CveAF") - dt.Columns.Add("SerieLote", Type.GetType("System.String")) + dt.Columns.Add("Serie", Type.GetType("System.String")) dt.Columns.Add("Lote", Type.GetType("System.String")) dt.Columns.Add("Observaciones") @@ -860,9 +860,9 @@ Partial Class Inventarios_RecepcionUsados #End Region #Region " AGREGAR - GUARDAR " - Private Function GetExistencias(CvePS As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional SerieLote As String = "-1", Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha) As Double + Private Function GetExistencias(CvePS As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional Serie As String = "-1", Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha) As Double Dim Inv As New ClsInventarios - Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, CveEmpresa, CveAlmacen, -1, FechaMovto:=String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHoraInicio.PostedTime), SerieLote:=SerieLote, Lote:=Lote, FechaCaducidad:=FechaCaducidad) + Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, CveEmpresa, CveAlmacen, -1, FechaMovto:=String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHoraInicio.PostedTime), Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Inv.Dispose() Return Existencia End Function @@ -884,7 +884,7 @@ Partial Class Inventarios_RecepcionUsados End If AddNew(DdlProducto2.SelectedValue.ToEntero, DdlProducto2.SelectedItem.Text, DdlUnidad.SelectedValue.ToEntero, DdlUnidad.SelectedItem.Text, txtCantidad.Text.ToDouble, PU, - "", "-1", "-1", "-1", TxtObservacionesdetalle.Text, "", "", DdlAlmacen.SelectedValue.ToEntero, DdlAlmacen.SelectedItem.Text, "", HdnCveTamaño.Value.ToEntero) + "", "-1", "-1", "-1", TxtObservacionesdetalle.Text, "", -1, "", "", HdnCveTamaño.Value.ToEntero) LimpiarAgregar() txtCantidad.Text = "" @@ -901,8 +901,8 @@ Partial Class Inventarios_RecepcionUsados End Sub - Protected Sub AddNew(CvePS As Integer, PS As String, CveUM As Integer, UM As String, Cantidad As Double, PU As Double, SerieLote As String, CodigoAF As String, Codigo As String, - CveAF As String, Observaciones As String, Lote As String, Batch As String, CveSeccionAlmacen As Integer, SeccionAlmacen As String, Tamaño As String, CveTamaño As Integer) + Protected Sub AddNew(CvePS As Integer, PS As String, CveUM As Integer, UM As String, Cantidad As Double, PU As Double, Serie As String, CodigoAF As String, Codigo As String, + CveAF As String, Observaciones As String, Lote As String, CveSeccionAlmacen As Integer, SeccionAlmacen As String, Tamaño As String, CveTamaño As Integer) 'If DdlAlmacen.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlProducto2.SelectedText = "" : Exit Sub @@ -940,8 +940,8 @@ Partial Class Inventarios_RecepcionUsados End If 'VALIDA QUE LA SERIE NO SEA IGUAL AL CODIGO O CODIGOBARRAS - If SerieLote <> "" And (SerieLote.ToUpper = dr("Codigo").ToString.ToUpper Or SerieLote.ToUpper = dr("CodigoBarras").ToString.ToUpper) Then - Alert($"La serie indicada {SerieLote} coincide con el codigo o codigo de barras del producto. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + If Serie <> "" And (Serie.ToUpper = dr("Codigo").ToString.ToUpper Or Serie.ToUpper = dr("CodigoBarras").ToString.ToUpper) Then + Alert($"La serie indicada {Serie} coincide con el codigo o codigo de barras del producto. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -964,7 +964,7 @@ Partial Class Inventarios_RecepcionUsados registro.Item("CodigoAF") = CodigoAF registro.Item("Codigo") = Codigo registro.Item("CveAF") = CveAF - registro.Item("SerieLote") = If(SerieLote <> "", SerieLote, "") + registro.Item("Serie") = If(Serie <> "", Serie, "") registro.Item("Lote") = If(Lote <> "", Lote, "") registro.Item("Observaciones") = Observaciones @@ -1000,7 +1000,7 @@ Partial Class Inventarios_RecepcionUsados DtMovimientos.Rows(IndexDTUsado)("CodigoAF") = CodigoAF DtMovimientos.Rows(IndexDTUsado)("Codigo") = Codigo DtMovimientos.Rows(IndexDTUsado)("CveAF") = CveAF - DtMovimientos.Rows(IndexDTUsado)("SerieLote") = If(SerieLote <> "", SerieLote, "") + DtMovimientos.Rows(IndexDTUsado)("Serie") = If(Serie <> "", Serie, "") DtMovimientos.Rows(IndexDTUsado)("Lote") = If(Lote <> "", Lote, "") DtMovimientos.Rows(IndexDTUsado)("Observaciones") = Observaciones @@ -1121,7 +1121,7 @@ Partial Class Inventarios_RecepcionUsados ImporteConcepto = Dr("PU").ToString.ToDecimal End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then Mensaje = "Error al guardar los movimientos" ErrorMovInv = True Exit For @@ -1253,7 +1253,7 @@ Partial Class Inventarios_RecepcionUsados End Sub - Private Sub GuardaCodigoSerie(Cantidad As Double, CvePS As Integer, CveUM As Integer, CostoPromedio As Decimal, Optional SerieLote As String = "-1") + Private Sub GuardaCodigoSerie(Cantidad As Double, CvePS As Integer, CveUM As Integer, CostoPromedio As Decimal, Optional Serie As String = "-1") Dim ObjInv As New ClsInventarios If CveMovimiento <= 0 Then @@ -1261,7 +1261,7 @@ Partial Class Inventarios_RecepcionUsados -1, -1, -1, -1, Modulo:="RU/G") End If - ObjInv.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, CostoPromedio, -1, Serie:=SerieLote) + ObjInv.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, CostoPromedio, -1, Serie:=Serie) ObjInv.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) DtMovimientos = ObjInv.DtResultados.FiltraParametros("", "CveMovimientoDetalle DESC").AsEnumerable.Take(25).CopyToDataTable ObjInv.Dispose() @@ -1359,7 +1359,7 @@ Partial Class Inventarios_RecepcionUsados 'Dim TienePermisoImportes = UsuarioActual.TienePermisoProceso(201) If DtTemp IsNot Nothing AndAlso DtTemp.Rows.Count > 0 Then - If DtTemp.MAX("SerieLote").ToString <> "" Then + If DtTemp.MAX("Serie").ToString <> "" Then End If If DtTemp.MAX("Lote").ToString <> "" Then @@ -1398,7 +1398,7 @@ Partial Class Inventarios_RecepcionUsados Dim Precio As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDouble Dim No As Integer = GvM.Rows(e.RowIndex).DataKey("No").ToEntero - Dim serielote As String = GvM.Rows(e.RowIndex).FCTextBox("TxtSerieLote").Text.Replace(" ", String.Empty) + Dim serie As String = GvM.Rows(e.RowIndex).FCTextBox("TxtSerie").Text.Replace(" ", String.Empty) Dim Observaciones As String = GvM.Rows(e.RowIndex).FCTextBox("TxtObservaciones").Text Dim CveSeccionAlmacen As Integer = GvM.Rows(e.RowIndex).FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero Dim SeccionAlmacen As String = GvM.Rows(e.RowIndex).FCDropDownList("DdlSeccionAlmacen").SelectedItem.Text @@ -1408,7 +1408,7 @@ Partial Class Inventarios_RecepcionUsados Drs(0)("PU") = Precio Drs(0)("Total") = Drs(0)("Cantidad").ToString.ToDouble * Precio Drs(0)("Estatus") = "U" - Drs(0)("SerieLote") = serielote + Drs(0)("Serie") = serie Drs(0)("Observaciones") = Observaciones Drs(0)("CveSeccionAlmacen") = CveSeccionAlmacen Drs(0)("SeccionAlmacen") = SeccionAlmacen @@ -1999,7 +1999,7 @@ Partial Class Inventarios_RecepcionUsados Dim Cantidad As Double = RowUsado("Cantidad").ToString().ToEntero() Dim PU As Double = RowUsado("PU").ToString().ToDouble() - AddNew(CvePS, PS, CveUM, UM, Cantidad, PU, "", "-1", "-1", "-1", "", "", "", DdlAlmacen.SelectedValue.ToEntero, DdlAlmacen.SelectedItem.Text, "", CveTamaño) + AddNew(CvePS, PS, CveUM, UM, Cantidad, PU, "", "-1", "-1", "-1", "", "", DdlAlmacen.SelectedValue.ToEntero, DdlAlmacen.SelectedItem.Text, "", CveTamaño) Next End If @@ -2150,7 +2150,7 @@ Partial Class Inventarios_RecepcionUsados Private Function AddPSRNC(ByRef TmpDT As DataTable, Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String, PU As Decimal, Descuento As Decimal, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, - Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, + Optional Serie As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False, Optional PorcentajeIVA As Decimal = 0D, Optional CveTamaño As Integer = 0) As Boolean @@ -2176,7 +2176,7 @@ Partial Class Inventarios_RecepcionUsados Row("Proyecto") = Proyecto Row("CveSubProyecto") = CveSubProyecto Row("SubProyecto") = SubProyecto - Row("SerieLote") = SerieLote + Row("Serie") = Serie Row("TiempoEntrega") = TiempoEntrega Row("Orden") = TmpDT.Rows.Count + 1 Row("Cantidad") = Cantidad @@ -2293,7 +2293,7 @@ Partial Class Inventarios_RecepcionUsados TmpDT.Columns.Add("NoIdentificacion", GetType(String)) TmpDT.Columns.Add("CveTipoPS", GetType(Integer)) TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) - TmpDT.Columns.Add("SerieLote", GetType(String)) + TmpDT.Columns.Add("Serie", GetType(String)) TmpDT.Columns.Add("CuentaPredial", GetType(String)) TmpDT.Columns.Add("Obs", GetType(String)) TmpDT.Columns.Add("TiempoEntrega", GetType(String)) @@ -2763,7 +2763,7 @@ Partial Class Inventarios_RecepcionUsados drTamañoPS = ObjPS.DtResultados.FiltroPrimero("") 'CveTamaño = -1 'limpio esta variable para que no se registre dos veces en la clase Modelos AddNew(drTamañoPS.Item("CvePS").ToString.ToEntero, drTamañoPS.Item("PSCodigo").ToString, drTamañoPS.Item("CveUM").ToString.ToEntero, drTamañoPS.Item("UnidadMedida").ToString, 1.0, Importe, - "", "-1", "-1", "-1", "", "", "", -1, "", "", CveTamaño) + "", "-1", "-1", "-1", "", "", -1, "", "", CveTamaño) End If Else diff --git a/Inventarios/RepApartados.aspx b/Inventarios/RepApartados.aspx index 57ed9337b..6cb599ee9 100644 --- a/Inventarios/RepApartados.aspx +++ b/Inventarios/RepApartados.aspx @@ -102,7 +102,7 @@ - +
    diff --git a/Inventarios/RepApartados2.aspx b/Inventarios/RepApartados2.aspx index 4075ec211..aecae7b73 100644 --- a/Inventarios/RepApartados2.aspx +++ b/Inventarios/RepApartados2.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepApartados2.aspx.vb" Inherits="Inventarios_RepApartados" %> +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepApartados2.aspx.vb" Inherits="Inventarios_RepApartados2" %> @@ -110,7 +110,7 @@
    <%----%> <%-- - --%> + %> diff --git a/Inventarios/RepApartados2.aspx.vb b/Inventarios/RepApartados2.aspx.vb index fc3e8cf14..7c991c56b 100644 --- a/Inventarios/RepApartados2.aspx.vb +++ b/Inventarios/RepApartados2.aspx.vb @@ -5,7 +5,7 @@ Imports System.Data Imports Extensiones Imports Microsoft.Reporting.WebForms -Partial Class Inventarios_RepApartados +Partial Class Inventarios_RepApartados2 Inherits ClsPaginas diff --git a/Inventarios/RepTraspasoAlmacen.aspx b/Inventarios/RepTraspasoAlmacen.aspx index 2a68e5765..fb7c223f9 100644 --- a/Inventarios/RepTraspasoAlmacen.aspx +++ b/Inventarios/RepTraspasoAlmacen.aspx @@ -210,7 +210,7 @@ - + diff --git a/Inventarios/ReporteMaterial.aspx b/Inventarios/ReporteMaterial.aspx index dec42c127..17906ae3a 100644 --- a/Inventarios/ReporteMaterial.aspx +++ b/Inventarios/ReporteMaterial.aspx @@ -91,7 +91,7 @@
    - + @@ -117,7 +117,7 @@ Text='<%# Eval("Folio").ToString %>' /> - + diff --git a/Inventarios/ResguardoMaterial.aspx b/Inventarios/ResguardoMaterial.aspx index b1085efd1..05c36bef0 100644 --- a/Inventarios/ResguardoMaterial.aspx +++ b/Inventarios/ResguardoMaterial.aspx @@ -208,7 +208,7 @@ Clasificación
    Producto U.M. - Serie - Lote + Serie - Lote Observaciones @@ -238,8 +238,8 @@ - - + + @@ -263,13 +263,13 @@