diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb
index 6b6d7482e..cc989e5e4 100644
--- a/App_Code/ClsBancos.vb
+++ b/App_Code/ClsBancos.vb
@@ -4308,13 +4308,14 @@ Public Class ClsBancos
Return Retorno
End Function
- Public Function DesconciliarIE(CveIE As Integer, FechaDesconciliado As Date, CveUsuario As Integer) As Boolean
+ Public Function DesconciliarIE(CveIE As Integer, FechaDesconciliado As Date, CveUsuario As Integer, Optional DejarConciliado As Boolean = False) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Banc_IEDesconciliar")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveIE", SqlDbType.Int).Value = CveIE
.Add("@FechaDesconciliado", SqlDbType.Date).Value = FechaDesconciliado
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
+ .Add("@DejarConciliado", SqlDbType.Int).Value = If(DejarConciliado, 1, 0)
End With
Try
SqlAdapter.Fill(Data)
diff --git a/App_Code/ClsContPAQi.vb b/App_Code/ClsContPAQi.vb
index b7d21d2e4..4b81efaff 100644
--- a/App_Code/ClsContPAQi.vb
+++ b/App_Code/ClsContPAQi.vb
@@ -2234,7 +2234,8 @@ Public Class ClsContPAQi
'''
'''
Public Function AddMovimiento(IdPoliza As Integer, IdCuenta As Integer, TipoMovto As Boolean, Importe As Double, Referencia As String,
- Concepto As String, IdSegNeg As Integer, FechaMovto As Date, SIGReferencia As String, Optional ImporteMonedaExtranjera As Double = 0, Optional GUID As String = "-1") As Boolean
+ Concepto As String, IdSegNeg As Integer, FechaMovto As Date, SIGReferencia As String, Optional ImporteMonedaExtranjera As Double = 0, Optional GUID As String = "-1",
+ Optional CvePrePolizaDetalle As Integer = -1) As Boolean
Dim Retorno As Boolean = False
If IdPoliza <= 0 Or IdCuenta <= 0 Then
@@ -2307,8 +2308,8 @@ Public Class ClsContPAQi
'StrSQL.AppendLine("")
'StrSQL.AppendLine("END")
- StrSQL.AppendLine(" INSERT INTO MovimientosPoliza (Id, RowVersion, IdPoliza, Ejercicio, Periodo, TipoPol, Folio, NumMovto, IdCuenta, TipoMovto, Importe, ImporteME, Referencia, Concepto, IdDiario, Fecha, IdSegNeg, SIGReferencia, TimeStamp, Guid)")
- StrSQL.AppendLine(" VALUES (@Id, @RowVersion, @IdPoliza, @Ejercicio, @Periodo, @TipoPol, @Folio, @NumMovto, @IdCuenta, @TipoMovto, @Importe, @ImporteME, @Referencia, @Concepto, @IdDiario, @Fecha, IIF(@SegNegMovtos = 1,@IdSegNeg,0), @SIGReferencia, @TimeStamp, @GUID);")
+ StrSQL.AppendLine(" INSERT INTO MovimientosPoliza (Id, RowVersion, IdPoliza, Ejercicio, Periodo, TipoPol, Folio, NumMovto, IdCuenta, TipoMovto, Importe, ImporteME, Referencia, Concepto, IdDiario, Fecha, IdSegNeg, SIGReferencia, TimeStamp, Guid, CvePrePolizaDetalle)")
+ StrSQL.AppendLine(" VALUES (@Id, @RowVersion, @IdPoliza, @Ejercicio, @Periodo, @TipoPol, @Folio, @NumMovto, @IdCuenta, @TipoMovto, @Importe, @ImporteME, @Referencia, @Concepto, @IdDiario, @Fecha, IIF(@SegNegMovtos = 1,@IdSegNeg,0), @SIGReferencia, @TimeStamp, @GUID, IIF(@CvePrePolizaDetalle=-1,NULL,@CvePrePolizaDetalle));")
StrSQL.AppendLine(" ")
''DESCOMENTAR PARA CIERRE PERIODO
@@ -2344,156 +2345,6 @@ Public Class ClsContPAQi
- SqlDataAdapter(StrSQL.ToString, CommandType.Text)
-
- With SqlAdapter.SelectCommand.Parameters
- .Add("@RowVersion", SqlDbType.Int).Value = GlobalRowVersion
- .Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza
- .Add("@IdCuenta", SqlDbType.Int).Value = IdCuenta
- .Add("@TipoMovto", SqlDbType.Int).Value = TipoMovto
- .Add("@Importe", SqlDbType.Money).Value = Math.Round(Importe, 2)
- .Add("@Referencia", SqlDbType.VarChar, 30).Value = If(Referencia.Length > 30, Referencia.Substring(1, 30), Referencia)
- .Add("@Concepto", SqlDbType.VarChar, 100).Value = If(Concepto.Length > 100, Concepto.Substring(1, 100), Concepto)
- .Add("@IdSegNeg", SqlDbType.Int).Value = IdSegNeg
- .Add("@FechaMov", SqlDbType.DateTime).Value = FechaMovto
- .Add("@SIGReferencia", SqlDbType.VarChar).Value = SIGReferencia
- .Add("@ImporteME", SqlDbType.Money).Value = ImporteMonedaExtranjera
- .Add("@GUID", SqlDbType.VarChar).Value = GUID
- End With
-
- Try
- SqlAdapter.Fill(Data)
- GUIDMovimiento = GUID
- Retorno = True
- Catch ex As Exception
- OnError("Ocurrió un error al agregar el movimiento en la póliza.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
- End Try
-
- Return Retorno
- End Function
-
- '''
- ''' Agrega un movimiento a una póliza
- '''
- ''' Es el ID que generó la póliza
- ''' Es el ID de la cuenta del movimiento a agregar
- ''' Cargo = False; Abono = True
- ''' Es el Importe del movimiento a agregar
- ''' Es la referencia del movimiento, hasta 30 dígitos
- ''' Es el concepto del movimiento, hasta 100 dígitos
- ''' Es el ID del Segmento de Negocio
- ''' Es la fecha del movimiento
- '''
- '''
- Public Function AddMovimiento(IdPoliza As Integer, IdCuenta As Integer, TipoMovto As Boolean, Importe As Double, Referencia As String,
- Concepto As String, IdSegNeg As Integer, FechaMovto As Date, SIGReferencia As String, CvePrePolizaDetalle As Integer, Optional ImporteMonedaExtranjera As Double = 0, Optional GUID As String = "-1") As Boolean
- Dim Retorno As Boolean = False
-
- If IdPoliza <= 0 Or IdCuenta <= 0 Then
- Return False
- End If
-
- If Not FNC_GetCounter() Then
- Return Retorno
- End If
-
- If Not FNC_GetNumMovto() Then
- Return Retorno
- End If
-
- 'SqlDataAdapter("PA_AddMovimiento
- If GUID = "-1" Then GUID = System.Guid.NewGuid().ToString()
-
- StrSQL.Clear()
- StrSQL.AppendLine("BEGIN")
- StrSQL.AppendLine("")
- StrSQL.AppendLine(" DECLARE ")
- StrSQL.AppendLine(" @Error NVARCHAR(300),")
- StrSQL.AppendLine(" @Id INT,")
- StrSQL.AppendLine(" @Ejercicio INT,")
- StrSQL.AppendLine(" @Periodo INT,")
- StrSQL.AppendLine(" @TipoPol INT,")
- StrSQL.AppendLine(" @Folio INT,")
- StrSQL.AppendLine(" @NumMovto INT,")
- StrSQL.AppendLine(" @IdDiario INT,")
- StrSQL.AppendLine(" @Fecha DATETIME,")
- StrSQL.AppendLine(" @IDEjercicio INT,")
- StrSQL.AppendLine(" @TimeStamp NVARCHAR (200);")
- StrSQL.AppendLine(" SET NOCOUNT ON;")
- StrSQL.AppendLine(" ")
- StrSQL.AppendLine(" SET @Id = dbo.FNC_GetCounter ('Id_MovimientoPoliza');")
- StrSQL.AppendLine(" SET @NumMovto = dbo.FNC_GetNumMovto (@IdPoliza);")
- StrSQL.AppendLine(" SET @Fecha = @FechaMov;")
- StrSQL.AppendLine(" SET @IdDiario = 0;")
- StrSQL.AppendLine(" SELECT @Ejercicio = P.Ejercicio, @Periodo = P.Periodo, @TipoPol = TipoPol, @Folio = P.Folio FROM Polizas P WHERE Id = @IdPoliza;")
- StrSQL.AppendLine("")
- StrSQL.AppendLine(" BEGIN TRY")
- StrSQL.AppendLine(" ")
-
- ''DESCOMENTAR PARA CIERRE PERIODO
- 'StrSQL.AppendLine("DECLARE")
- 'StrSQL.AppendLine(" @IdCtaCierre INT,")
- 'StrSQL.AppendLine(" @IdPolCierre INT,")
- 'StrSQL.AppendLine(" @NumMovtoCierre INT;")
- 'StrSQL.AppendLine("")
- 'StrSQL.AppendLine("SET @NumMovtoCierre = 0;")
- 'StrSQL.AppendLine("")
- 'StrSQL.AppendLine("-- SI ES CUENTA DE RESULTADOS")
- 'StrSQL.AppendLine("IF (SELECT Tipo FROM Cuentas WHERE Id = @IdCuenta) IN ('G','H')")
- 'StrSQL.AppendLine("BEGIN ")
- 'StrSQL.AppendLine("")
- 'StrSQL.AppendLine(" SELECT @IdCtaCierre = IdCtaCierre, @IdPolCierre = IdPolCierre FROM Ejercicios WHERE Ejercicio = @Ejercicio")
- 'StrSQL.AppendLine("")
- 'StrSQL.AppendLine(" -- SI ESTA CERRADO EL EJERCICIO")
- 'StrSQL.AppendLine(" IF (@IdCtaCierre > 0 AND @IdPolCierre > 0)")
- 'StrSQL.AppendLine(" BEGIN")
- 'StrSQL.AppendLine("")
- 'StrSQL.AppendLine(" -- PARA QUE EL MOVIMIENTO SE AGREGUE DIRECTO EN LA POLIZA DE CIERRE")
- 'StrSQL.AppendLine(" SET @IdPoliza = @IdPolCierre;")
- 'StrSQL.AppendLine(" SET @NumMovto = dbo.FNC_GetNumMovto (@IdPolCierre);")
- 'StrSQL.AppendLine(" SET @NumMovtoCierre = @NumMovto + 1")
- 'StrSQL.AppendLine("")
- 'StrSQL.AppendLine(" END")
- 'StrSQL.AppendLine("")
- 'StrSQL.AppendLine("END")
-
- StrSQL.AppendLine(" INSERT INTO MovimientosPoliza (Id, RowVersion, IdPoliza, Ejercicio, Periodo, TipoPol, Folio, NumMovto, IdCuenta, TipoMovto, Importe, ImporteME, Referencia, Concepto, IdDiario, Fecha, IdSegNeg, SIGReferencia, TimeStamp, Guid, CvePrePolizaDetalle)")
- StrSQL.AppendLine(" VALUES (@Id, @RowVersion, @IdPoliza, @Ejercicio, @Periodo, @TipoPol, @Folio, @NumMovto, @IdCuenta, @TipoMovto, @Importe, @ImporteME, @Referencia, @Concepto, @IdDiario, @Fecha, @IdSegNeg, @SIGReferencia, @TimeStamp, @GUID, @CvePrePolizaDetalle);")
- StrSQL.AppendLine(" ")
-
- ''DESCOMENTAR PARA CIERRE PERIODO
- 'StrSQL.AppendLine(" IF @NumMovtoCierre > 0 ")
- 'StrSQL.AppendLine(" BEGIN ")
- 'StrSQL.AppendLine(" IF @TipoMovto = 0 BEGIN ")
- 'StrSQL.AppendLine(" SET @TipoMovto = 1 ")
- 'StrSQL.AppendLine(" END ")
- 'StrSQL.AppendLine(" ELSE BEGIN ")
- 'StrSQL.AppendLine(" SET @TipoMovto = 0 ")
- 'StrSQL.AppendLine(" END ")
- 'StrSQL.AppendLine(" INSERT INTO MovimientosPoliza (Id, RowVersion, IdPoliza, Ejercicio, Periodo, TipoPol, Folio, NumMovto, IdCuenta, TipoMovto, Importe, ImporteME, Referencia, Concepto, IdDiario, Fecha, IdSegNeg, SIGReferencia, TimeStamp, Guid) ")
- 'StrSQL.AppendLine(" VALUES (@Id + 1, @RowVersion, @IdPoliza, @Ejercicio, @Periodo, @TipoPol, @Folio, @NumMovtoCierre, @IdCtaCierre, @TipoMovto, @Importe, @ImporteME, @Referencia, @Concepto, @IdDiario, @Fecha, @IdSegNeg, @SIGReferencia, @TimeStamp,''); ")
- 'StrSQL.AppendLine(" EXEC PA_UpdateId 'Id_MovimientoPoliza';")
- 'StrSQL.AppendLine(" END ")
-
- StrSQL.AppendLine(" EXEC PA_UpdateId 'Id_MovimientoPoliza';")
- StrSQL.AppendLine(" ")
- StrSQL.AppendLine(" SELECT @IDEjercicio = ID FROM Ejercicios WHERE Ejercicio = @Ejercicio;")
- StrSQL.AppendLine(" ")
- StrSQL.AppendLine(" EXEC PA_UpdateSaldos @IdCuenta, @TipoMovto, @Importe, @IDEjercicio, @Periodo, @Id, @IdPoliza;")
- StrSQL.AppendLine(" ")
- StrSQL.AppendLine(" SELECT @Id AS IdMovto, @NumMovto AS NumMovto, @GUID AS GUID ;")
- StrSQL.AppendLine(" ")
- StrSQL.AppendLine(" END TRY")
- StrSQL.AppendLine(" ")
- StrSQL.AppendLine(" BEGIN CATCH")
- StrSQL.AppendLine(" SET @Error = CONCAT('Número: ' , ERROR_NUMBER(), '; Procedimiento: ' , ERROR_PROCEDURE(), '; Linea: ' ,ERROR_LINE(), '; Detalle: ' , ERROR_MESSAGE());")
- StrSQL.AppendLine(" RAISERROR(@Error, 16, 1);")
- StrSQL.AppendLine(" END CATCH")
- StrSQL.AppendLine(" ")
- StrSQL.AppendLine("END;")
-
-
-
SqlDataAdapter(StrSQL.ToString, CommandType.Text)
With SqlAdapter.SelectCommand.Parameters
@@ -2523,6 +2374,159 @@ Public Class ClsContPAQi
Return Retorno
End Function
+ ''''
+ '''' Agrega un movimiento a una póliza
+ ''''
+ '''' Es el ID que generó la póliza
+ '''' Es el ID de la cuenta del movimiento a agregar
+ '''' Cargo = False; Abono = True
+ '''' Es el Importe del movimiento a agregar
+ '''' Es la referencia del movimiento, hasta 30 dígitos
+ '''' Es el concepto del movimiento, hasta 100 dígitos
+ '''' Es el ID del Segmento de Negocio
+ '''' Es la fecha del movimiento
+ ''''
+ ''''
+ 'Public Function AddMovimiento(IdPoliza As Integer, IdCuenta As Integer, TipoMovto As Boolean, Importe As Double, Referencia As String,
+ ' Concepto As String, IdSegNeg As Integer, FechaMovto As Date, SIGReferencia As String, CvePrePolizaDetalle As Integer, Optional ImporteMonedaExtranjera As Double = 0, Optional GUID As String = "-1") As Boolean
+ ' Dim Retorno As Boolean = False
+
+ ' If IdPoliza <= 0 Or IdCuenta <= 0 Then
+ ' Return False
+ ' End If
+
+ ' If Not FNC_GetCounter() Then
+ ' Return Retorno
+ ' End If
+
+ ' If Not FNC_GetNumMovto() Then
+ ' Return Retorno
+ ' End If
+
+ ' 'SqlDataAdapter("PA_AddMovimiento
+ ' If GUID = "-1" Then GUID = System.Guid.NewGuid().ToString()
+
+ ' StrSQL.Clear()
+ ' StrSQL.AppendLine("BEGIN")
+ ' StrSQL.AppendLine("")
+ ' StrSQL.AppendLine(" DECLARE ")
+ ' StrSQL.AppendLine(" @Error NVARCHAR(300),")
+ ' StrSQL.AppendLine(" @Id INT,")
+ ' StrSQL.AppendLine(" @Ejercicio INT,")
+ ' StrSQL.AppendLine(" @Periodo INT,")
+ ' StrSQL.AppendLine(" @TipoPol INT,")
+ ' StrSQL.AppendLine(" @Folio INT,")
+ ' StrSQL.AppendLine(" @NumMovto INT,")
+ ' StrSQL.AppendLine(" @IdDiario INT,")
+ ' StrSQL.AppendLine(" @SegNegMovtos INT,")
+ ' StrSQL.AppendLine(" @Fecha DATETIME,")
+ ' StrSQL.AppendLine(" @IDEjercicio INT,")
+ ' StrSQL.AppendLine(" @TimeStamp NVARCHAR (200);")
+ ' StrSQL.AppendLine(" SET NOCOUNT ON;")
+ ' StrSQL.AppendLine(" ")
+ ' StrSQL.AppendLine(" SET @Id = dbo.FNC_GetCounter ('Id_MovimientoPoliza');")
+ ' StrSQL.AppendLine(" SET @NumMovto = dbo.FNC_GetNumMovto (@IdPoliza);")
+ ' StrSQL.AppendLine(" SET @Fecha = @FechaMov;")
+ ' StrSQL.AppendLine(" SET @IdDiario = 0;")
+ ' StrSQL.AppendLine(" SELECT @Ejercicio = P.Ejercicio, @Periodo = P.Periodo, @TipoPol = TipoPol, @Folio = P.Folio FROM Polizas P WHERE Id = @IdPoliza;")
+ ' StrSQL.AppendLine(" SELECT @SegNegMovtos = SegNegMovtos FROM Cuentas C WHERE Id = @IdCuenta;")
+ ' StrSQL.AppendLine("")
+ ' StrSQL.AppendLine(" BEGIN TRY")
+ ' StrSQL.AppendLine(" ")
+
+ ' ''DESCOMENTAR PARA CIERRE PERIODO
+ ' 'StrSQL.AppendLine("DECLARE")
+ ' 'StrSQL.AppendLine(" @IdCtaCierre INT,")
+ ' 'StrSQL.AppendLine(" @IdPolCierre INT,")
+ ' 'StrSQL.AppendLine(" @NumMovtoCierre INT;")
+ ' 'StrSQL.AppendLine("")
+ ' 'StrSQL.AppendLine("SET @NumMovtoCierre = 0;")
+ ' 'StrSQL.AppendLine("")
+ ' 'StrSQL.AppendLine("-- SI ES CUENTA DE RESULTADOS")
+ ' 'StrSQL.AppendLine("IF (SELECT Tipo FROM Cuentas WHERE Id = @IdCuenta) IN ('G','H')")
+ ' 'StrSQL.AppendLine("BEGIN ")
+ ' 'StrSQL.AppendLine("")
+ ' 'StrSQL.AppendLine(" SELECT @IdCtaCierre = IdCtaCierre, @IdPolCierre = IdPolCierre FROM Ejercicios WHERE Ejercicio = @Ejercicio")
+ ' 'StrSQL.AppendLine("")
+ ' 'StrSQL.AppendLine(" -- SI ESTA CERRADO EL EJERCICIO")
+ ' 'StrSQL.AppendLine(" IF (@IdCtaCierre > 0 AND @IdPolCierre > 0)")
+ ' 'StrSQL.AppendLine(" BEGIN")
+ ' 'StrSQL.AppendLine("")
+ ' 'StrSQL.AppendLine(" -- PARA QUE EL MOVIMIENTO SE AGREGUE DIRECTO EN LA POLIZA DE CIERRE")
+ ' 'StrSQL.AppendLine(" SET @IdPoliza = @IdPolCierre;")
+ ' 'StrSQL.AppendLine(" SET @NumMovto = dbo.FNC_GetNumMovto (@IdPolCierre);")
+ ' 'StrSQL.AppendLine(" SET @NumMovtoCierre = @NumMovto + 1")
+ ' 'StrSQL.AppendLine("")
+ ' 'StrSQL.AppendLine(" END")
+ ' 'StrSQL.AppendLine("")
+ ' 'StrSQL.AppendLine("END")
+
+ ' StrSQL.AppendLine(" INSERT INTO MovimientosPoliza (Id, RowVersion, IdPoliza, Ejercicio, Periodo, TipoPol, Folio, NumMovto, IdCuenta, TipoMovto, Importe, ImporteME, Referencia, Concepto, IdDiario, Fecha, IdSegNeg, SIGReferencia, TimeStamp, Guid, CvePrePolizaDetalle)")
+ ' StrSQL.AppendLine(" VALUES (@Id, @RowVersion, @IdPoliza, @Ejercicio, @Periodo, @TipoPol, @Folio, @NumMovto, @IdCuenta, @TipoMovto, @Importe, @ImporteME, @Referencia, @Concepto, @IdDiario, @Fecha, IIF(@SegNegMovtos = 1,@IdSegNeg,0), @SIGReferencia, @TimeStamp, @GUID, @CvePrePolizaDetalle);")
+ ' StrSQL.AppendLine(" ")
+
+ ' ''DESCOMENTAR PARA CIERRE PERIODO
+ ' 'StrSQL.AppendLine(" IF @NumMovtoCierre > 0 ")
+ ' 'StrSQL.AppendLine(" BEGIN ")
+ ' 'StrSQL.AppendLine(" IF @TipoMovto = 0 BEGIN ")
+ ' 'StrSQL.AppendLine(" SET @TipoMovto = 1 ")
+ ' 'StrSQL.AppendLine(" END ")
+ ' 'StrSQL.AppendLine(" ELSE BEGIN ")
+ ' 'StrSQL.AppendLine(" SET @TipoMovto = 0 ")
+ ' 'StrSQL.AppendLine(" END ")
+ ' 'StrSQL.AppendLine(" INSERT INTO MovimientosPoliza (Id, RowVersion, IdPoliza, Ejercicio, Periodo, TipoPol, Folio, NumMovto, IdCuenta, TipoMovto, Importe, ImporteME, Referencia, Concepto, IdDiario, Fecha, IdSegNeg, SIGReferencia, TimeStamp, Guid) ")
+ ' 'StrSQL.AppendLine(" VALUES (@Id + 1, @RowVersion, @IdPoliza, @Ejercicio, @Periodo, @TipoPol, @Folio, @NumMovtoCierre, @IdCtaCierre, @TipoMovto, @Importe, @ImporteME, @Referencia, @Concepto, @IdDiario, @Fecha, @IdSegNeg, @SIGReferencia, @TimeStamp,''); ")
+ ' 'StrSQL.AppendLine(" EXEC PA_UpdateId 'Id_MovimientoPoliza';")
+ ' 'StrSQL.AppendLine(" END ")
+
+ ' StrSQL.AppendLine(" EXEC PA_UpdateId 'Id_MovimientoPoliza';")
+ ' StrSQL.AppendLine(" ")
+ ' StrSQL.AppendLine(" SELECT @IDEjercicio = ID FROM Ejercicios WHERE Ejercicio = @Ejercicio;")
+ ' StrSQL.AppendLine(" ")
+ ' StrSQL.AppendLine(" EXEC PA_UpdateSaldos @IdCuenta, @TipoMovto, @Importe, @IDEjercicio, @Periodo, @Id, @IdPoliza;")
+ ' StrSQL.AppendLine(" ")
+ ' StrSQL.AppendLine(" SELECT @Id AS IdMovto, @NumMovto AS NumMovto, @GUID AS GUID ;")
+ ' StrSQL.AppendLine(" ")
+ ' StrSQL.AppendLine(" END TRY")
+ ' StrSQL.AppendLine(" ")
+ ' StrSQL.AppendLine(" BEGIN CATCH")
+ ' StrSQL.AppendLine(" SET @Error = CONCAT('Número: ' , ERROR_NUMBER(), '; Procedimiento: ' , ERROR_PROCEDURE(), '; Linea: ' ,ERROR_LINE(), '; Detalle: ' , ERROR_MESSAGE());")
+ ' StrSQL.AppendLine(" RAISERROR(@Error, 16, 1);")
+ ' StrSQL.AppendLine(" END CATCH")
+ ' StrSQL.AppendLine(" ")
+ ' StrSQL.AppendLine("END;")
+
+
+
+ ' SqlDataAdapter(StrSQL.ToString, CommandType.Text)
+
+ ' With SqlAdapter.SelectCommand.Parameters
+ ' .Add("@RowVersion", SqlDbType.Int).Value = GlobalRowVersion
+ ' .Add("@IdPoliza", SqlDbType.Int).Value = IdPoliza
+ ' .Add("@IdCuenta", SqlDbType.Int).Value = IdCuenta
+ ' .Add("@TipoMovto", SqlDbType.Int).Value = TipoMovto
+ ' .Add("@Importe", SqlDbType.Money).Value = Math.Round(Importe, 2)
+ ' .Add("@Referencia", SqlDbType.VarChar, 30).Value = If(Referencia.Length > 30, Referencia.Substring(1, 30), Referencia)
+ ' .Add("@Concepto", SqlDbType.VarChar, 100).Value = If(Concepto.Length > 100, Concepto.Substring(1, 100), Concepto)
+ ' .Add("@IdSegNeg", SqlDbType.Int).Value = IdSegNeg
+ ' .Add("@FechaMov", SqlDbType.DateTime).Value = FechaMovto
+ ' .Add("@SIGReferencia", SqlDbType.VarChar).Value = SIGReferencia
+ ' .Add("@ImporteME", SqlDbType.Money).Value = ImporteMonedaExtranjera
+ ' .Add("@GUID", SqlDbType.VarChar).Value = GUID
+ ' .Add("@CvePrePolizaDetalle", SqlDbType.Int).Value = CvePrePolizaDetalle
+ ' End With
+
+ ' Try
+ ' SqlAdapter.Fill(Data)
+ ' GUIDMovimiento = GUID
+ ' Retorno = True
+ ' Catch ex As Exception
+ ' OnError("Ocurrió un error al agregar el movimiento en la póliza.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ ' End Try
+
+ ' Return Retorno
+ 'End Function
+
Public Function UpdatePoliza(Concepto As String, Cargos As Double, Abonos As Double, IdUsuario As Integer, FechaPoliza As Date, Folio As String, TipoPoliza As Integer, IdPoliza As Integer) As Boolean
Dim Retorno As Boolean = False
diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb
index 92b5aa4d1..a10b756f0 100644
--- a/App_Code/ClsContabilidad.vb
+++ b/App_Code/ClsContabilidad.vb
@@ -1406,7 +1406,7 @@ Public Class ClsContabilidad
If dr("ImporteMN").ToString.ToDecimal <> 0 Then
If Not ObjConta.AddMovimiento(tIdPoliza, dr("IdCtaContable").ToString.ToEntero, tipoMovimiento,
- dr("ImporteMN").ToString.ToDecimal, dr("Referencia").ToString, dr("Concepto").ToString, dr("IdSegmentoNegocio").ToString.ToEntero, Fecha, SigReferencia, dr("CvePrePolizaDetalle").ToString.ToEntero, ImporteMonedaExtranjera:=dr("ImporteME").ToString.ToDecimal) Then
+ dr("ImporteMN").ToString.ToDecimal, dr("Referencia").ToString, dr("Concepto").ToString, dr("IdSegmentoNegocio").ToString.ToEntero, Fecha, SigReferencia, CvePrePolizaDetalle:=dr("CvePrePolizaDetalle").ToString.ToEntero, ImporteMonedaExtranjera:=dr("ImporteME").ToString.ToDecimal) Then
OcurrioError = True
StrLog.AppendFormat(" Error 1.1 - ")
Exit For
@@ -1415,7 +1415,7 @@ Public Class ClsContabilidad
Else
If Not ObjConta.AddMovimiento(tIdPoliza, dr("IdCtaContable").ToString.ToEntero, tipoMovimiento,
- dr("Importe").ToString.ToDecimal, dr("Referencia").ToString, dr("Concepto").ToString, dr("IdSegmentoNegocio").ToString.ToEntero, Fecha, SigReferencia, dr("CvePrePolizaDetalle").ToString.ToEntero, ImporteMonedaExtranjera:=dr("ImporteME").ToString.ToDecimal) Then
+ dr("Importe").ToString.ToDecimal, dr("Referencia").ToString, dr("Concepto").ToString, dr("IdSegmentoNegocio").ToString.ToEntero, Fecha, SigReferencia, CvePrePolizaDetalle:=dr("CvePrePolizaDetalle").ToString.ToEntero, ImporteMonedaExtranjera:=dr("ImporteME").ToString.ToDecimal) Then
OcurrioError = True
StrLog.AppendFormat(" Error 1.2 - ")
Exit For
@@ -1456,7 +1456,7 @@ Public Class ClsContabilidad
Dim RFC As String = ""
Dim RazonSocial As String = ""
If Not OcurrioError AndAlso ContabilizarDIOT Then
- If GetDIOTValores(CvePrePoliza) AndAlso Data.Rows.Count > 0 Then
+ If GetDIOTValores(CvePrePoliza, Empresa.CveEmpresa) AndAlso Data.Rows.Count > 0 Then
Dim IdProveedor As Integer
For Each dr As DataRow In Data.Rows
@@ -1685,7 +1685,7 @@ Public Class ClsContabilidad
Return Retorno
End Function
- Public Function GetDIOTValores(CvePrePoliza As Integer) As Boolean 'Editado por charlie
+ Public Function GetDIOTValores(CvePrePoliza As Integer, CveEmpresa As Integer) As Boolean 'Editado por charlie
Dim Retorno As Boolean = False
@@ -1693,6 +1693,7 @@ Public Class ClsContabilidad
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb
index 87bb5d529..8da82fc41 100644
--- a/App_Code/ClsInventarios.vb
+++ b/App_Code/ClsInventarios.vb
@@ -1153,7 +1153,7 @@ Public Class ClsInventarios
Return Retorno
End Function
- Public Function MovimientoRemove(CveMovimiento As Integer, CveEmpresa As Integer) As Boolean
+ Public Function MovimientoRemove(CveMovimiento As Integer, CveEmpresa As Integer, Optional CveUsuario As Integer = -1) As Boolean
Dim Retorno As Boolean = False
@@ -1162,6 +1162,7 @@ Public Class ClsInventarios
With SqlAdapter.SelectCommand.Parameters
.Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
End With
diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index 1dac5ec5c..f62a5b548 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -5599,7 +5599,7 @@ Public Class ClsVentas
End Function
- Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, Optional ConSaldo As Integer = -1, Optional FechaVencimientoConsulta As DateTime = MaxFecha) As Boolean
+ Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, TipoCambioConsulta As Decimal, Optional ConSaldo As Integer = -1, Optional FechaVencimientoConsulta As DateTime = MaxFecha) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_LineasAdicionalesSaldoGet")
@@ -5611,6 +5611,7 @@ Public Class ClsVentas
.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@ConSaldo", SqlDbType.Int).Value = ConSaldo
+ .Add("@TipoCambioConsulta", SqlDbType.Decimal).Value = TipoCambioConsulta
.Add("@FechaVencimientoConsulta", SqlDbType.Date).Value = FechaVencimientoConsulta
End With
Try
diff --git a/App_Code/SqlServerTypes/Loader.cs b/App_Code/SqlServerTypes/Loader.cs
deleted file mode 100644
index ce606cf2e..000000000
--- a/App_Code/SqlServerTypes/Loader.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-
-namespace SqlServerTypes
-{
- ///
- /// Utility methods related to CLR Types for SQL Server
- ///
- public class Utilities
- {
- [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
- private static extern IntPtr LoadLibrary(string libname);
-
- ///
- /// Loads the required native assemblies for the current architecture (x86 or x64)
- ///
- ///
- /// Root path of the current application. Use Server.MapPath(".") for ASP.NET applications
- /// and AppDomain.CurrentDomain.BaseDirectory for desktop applications.
- ///
- public static void LoadNativeAssemblies(string rootApplicationPath)
- {
- var nativeBinaryPath = IntPtr.Size > 4
- ? Path.Combine(rootApplicationPath, @"SqlServerTypes\x64\")
- : Path.Combine(rootApplicationPath, @"SqlServerTypes\x86\");
-
- LoadNativeAssembly(nativeBinaryPath, "msvcr120.dll");
- LoadNativeAssembly(nativeBinaryPath, "SqlServerSpatial140.dll");
- }
-
- private static void LoadNativeAssembly(string nativeBinaryPath, string assemblyName)
- {
- var path = Path.Combine(nativeBinaryPath, assemblyName);
- var ptr = LoadLibrary(path);
- if (ptr == IntPtr.Zero)
- {
- throw new Exception(string.Format(
- "Error loading {0} (ErrorCode: {1})",
- assemblyName,
- Marshal.GetLastWin32Error()));
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx
index dbca48046..0bfb003be 100644
--- a/Ashx/E141.ashx
+++ b/Ashx/E141.ashx
@@ -102,12 +102,17 @@ Public Class E141 : Implements IHttpHandler
'DESCARGA DEL PDF
If Not String.IsNullOrEmpty(Params) Then
- Dim UrlParametros As Hashtable = Parametros(Decripta(Params))
+ Try
+ Dim UrlParametros As Hashtable = Parametros(Decripta(Params))
+
+ Dim File As String = UrlParametros("FILE").ToString()
+ If Not String.IsNullOrEmpty(File) Then
+ ImprimirbytesPDF(context, DescargarFactura(File), File)
+ End If
+ Catch ex As Exception
+ GuardaLogAD("Ocurrió un error al descargar el pdf. " + ex.ToString() + ".parametros: " + Params, "LogE141")
+ End Try
- Dim File As String = UrlParametros("FILE").ToString()
- If Not String.IsNullOrEmpty(File) Then
- ImprimirbytesPDF(context, DescargarFactura(File), File)
- End If
Else
Dim Metodo = If(context.Request("Metodo") = Nothing, "", context.Request("Metodo").ToString())
diff --git a/Bancos/ConciliacionesBancarias.aspx b/Bancos/ConciliacionesBancarias.aspx
index 39a3e738f..f3eb42492 100644
--- a/Bancos/ConciliacionesBancarias.aspx
+++ b/Bancos/ConciliacionesBancarias.aspx
@@ -396,10 +396,10 @@
-
Fecha Desconciliado:
-
-
-
+
Fecha Desconciliado:
+
+
+
@@ -408,7 +408,9 @@
-
+
+
+
@@ -1033,10 +1025,7 @@
-
-
-
-
+
@@ -1053,9 +1042,7 @@
-
-
-
+
@@ -1421,16 +1408,8 @@
-
- <%--
-
-
-
- --%>
-
-
+
+
@@ -1439,9 +1418,9 @@
-
+
-
diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb
index 3c54087eb..c28aae75d 100644
--- a/Bancos/IE.aspx.vb
+++ b/Bancos/IE.aspx.vb
@@ -1218,16 +1218,16 @@ Partial Class Bancos_IE
UpCancelacion.Update()
'OTROS DATOS - DATOS COMPLEMENTO SUSTITUCION
- Dim CveIESustitucion As Integer = ObjIE.DtResultados(0)("CveIESustitucion").ToString.ToEntero
- If CveIESustitucion > 0 Then
- TRComplementoSustitucion.Visible = True
+ 'Dim CveIESustitucion As Integer = ObjIE.DtResultados(0)("CveIESustitucion").ToString.ToEntero
+ 'If CveIESustitucion > 0 Then
+ ' TRComplementoSustitucion.Visible = True
- If ObjIE.GetBancosIE(CveIESustitucion, UsuarioActual.CveEmpresa) And ObjIE.DtResultados.Rows.Count > 0 Then
- ARefIESustitucion.HRef = String.Format("/Bancos/IE.aspx?CveIE={0}", CveIESustitucion)
- ARefIESustitucion.InnerText = ObjIE.Folio
- End If
+ ' If ObjIE.GetBancosIE(CveIESustitucion, UsuarioActual.CveEmpresa) And ObjIE.DtResultados.Rows.Count > 0 Then
+ ' ARefIESustitucion.HRef = String.Format("/Bancos/IE.aspx?CveIE={0}", CveIESustitucion)
+ ' ARefIESustitucion.InnerText = ObjIE.Folio
+ ' End If
- End If
+ 'End If
'DETALLES - MOVIMIENTOS
@@ -5691,44 +5691,32 @@ Partial Class Bancos_IE
If Tipo = "Abono" Then
If ObjBancos.GetVincularPago(CveProveedor, CveCompra, 2, MinFecha, MaxFecha, UsuarioActual.CveEmpresa, CveIE) Then
-
GvComplementoPagos.DataSource = ObjBancos.DtResultados
-
-
Else
GvComplementoPagos.DataSource = Nothing
End If
-
GvComplementoPagos.Columns(7).Visible = False
Else
If CveIE > 0 Then
If ObjBancos.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) Then
-
If ObjBancos.DtResultados.FiltraParametros(" Estatus IN (1,3) ").Rows.Count = 0 And Tipo.ToUpper = "CARGO" And CveCliente > 0 And CveEstatusIE <> 2 Then
DVGenerarComplementoModal.Visible = True
End If
-
If ObjBancos.DtResultados.FiltraParametros(" Estatus IN (1,3) ").Rows.Count = 1 And Tipo.ToUpper = "CARGO" And CveCliente > 0 And CveEstatusIE <> 2 Then
DivCancelarComplemento.Visible = True
+ GvComplementoPagos.Columns(7).Visible = True
+ If UsuarioActual.TienePermisoProceso(85) Then GvComplementoPagos.Columns(8).Visible = True
End If
-
- ' GvComplementoPagos.DataSource = ObjBancos.DtResultados.FiltraParametros("", DistinctColumns:={"CveComplementoPago", "SerieFolio", "Fecha", "CveIE"})
-
GvComplementoPagos.DataSource = ObjBancos.DtResultados.FiltraParametros("", DistinctColumns:={"CveComplementoPago", "FolioFiscal", "Folio", "SerieFolio", "FechaComplemento", "Importe", "RFCReceptor", "StrEstatus", "FechaCancelacion", "Tipo", "Estatus", "CveIE", "CvePAC", "MotivoCancelacion"})
- '"CveComplementoPago","FolioFiscal","Folio","SerieFolio","FechaComplemento","Importe","RFCReceptor","StrEstatus","FechaCancelacion","Tipo,Estatus","CveIE","CvePAC"
-
End If
End If
- GvComplementoPagos.Columns(7).Visible = True
End If
ObjBancos.Dispose()
GvComplementoPagos.DataBind()
UpComplementoPagos.Update()
-
-
UpEliminarCotizacion.Update() 'Esto se ocupa para mostrar DVmotivoCancelacion
'ObjBancos.Dispose()
@@ -5930,7 +5918,7 @@ Partial Class Bancos_IE
End Sub
Protected Sub LnkCancelar_Click(sender As Object, e As EventArgs)
- If ChkConciliado.Checked Then
+ If ChkConciliado.Checked AndAlso UsuarioActual.CveEmpresa = 119 Then
'TxtFechaDesconciliado.Text = Now.ToShortDateString
'UpDesconciliar.Update()
'RegistraScript("$('#DModalDesconciliar').modal()")
diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb
index a6e121345..2cdd0c17f 100644
--- a/Bancos/ProveedoresAbonar.aspx.vb
+++ b/Bancos/ProveedoresAbonar.aspx.vb
@@ -295,7 +295,7 @@ Partial Class Bancos_ProveedoresAbonar
If UsuarioActual.TienePermisoProceso(98) Then
PermiteModificarImporte = False
End If
- Calendario.StartDate = Now.AddMonths(-8)
+ Calendario.StartDate = Now.AddMonths(-18)
'proceso que restringue solo el pago de apartir del dia de hoy y como limite fin de mes
If UsuarioActual.TienePermisoProceso(105) Then
Calendario.StartDate = Now
@@ -898,57 +898,58 @@ Partial Class Bancos_ProveedoresAbonar
Else
Dim ImporteME As Decimal = 0
+ If Pago.CveMonedaPago = 2 Then ImporteME = Pago.ImportePago
If Not UsaComplementariaBancos And Pago.CveMonedaPago = 2 Then
- ImporteME = tImporteMN
- tImporteMN = (tImporteMN * Pago.TCPago).RoundSQL
- End If
+ ImporteME = tImporteMN
+ tImporteMN = (tImporteMN * Pago.TCPago).RoundSQL
+ End If
- If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, tImporteMN, 30, Referencia, ConceptoMovimiento, IdCuenta, CveIE:=CveIE, CveProveedor:=CveProveedor, TipoCambio:=Pago.TCPago, CveSubProyecto:=CveSubProyecto, ImporteME:=tImporteMN) Then
- MsgError = "No se pudo insertar la póliza"
- End If
-
- If Pago.CveMonedaPago = 2 AndAlso UsaComplementariaBancos Then
- If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, (Pago.ImportePago * Pago.TCPago - Pago.ImportePago).RoundSQL, 204, Referencia, ConceptoMovimiento, IdCuentaBancariaComplementaria, CveIE:=CveIE, CveProveedor:=CveProveedor, ImporteME:=Pago.ImportePago, TipoCambio:=Pago.TCPago, CveSubProyecto:=CveSubProyecto) Then
+ If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, tImporteMN, 30, Referencia, ConceptoMovimiento, IdCuenta, CveIE:=CveIE, CveProveedor:=CveProveedor, TipoCambio:=Pago.TCPago, CveSubProyecto:=CveSubProyecto, ImporteME:=ImporteME) Then
MsgError = "No se pudo insertar la póliza"
End If
+
+ If Pago.CveMonedaPago = 2 AndAlso UsaComplementariaBancos Then
+ If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, (Pago.ImportePago * Pago.TCPago - Pago.ImportePago).RoundSQL, 204, Referencia, ConceptoMovimiento, IdCuentaBancariaComplementaria, CveIE:=CveIE, CveProveedor:=CveProveedor, ImporteME:=Pago.ImportePago, TipoCambio:=Pago.TCPago, CveSubProyecto:=CveSubProyecto) Then
+ MsgError = "No se pudo insertar la póliza"
+ End If
+ End If
+
+ 'If UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
+ ' 'fluctuación.
+ ' Dim TCPago = TxtTCDolares.Text.ToDecimal
+
+ ' Dim ImporteFluctuacion As Decimal = 0 '((ImporteSeleccionado / TCPago) - TxtImporte.Text.ToDecimal)
+
+ ' Dim DtPrePoliza As DataTable = Nothing
+ ' If ObjMov.GetPrePolizasDetalle(CvePrePoliza, UsuarioActual.CveEmpresa) Then
+ ' DtPrePoliza = ObjMov.DtResultados.Copy
+ ' End If
+
+ ' Dim PagoProveedoresME = DtPrePoliza.SUMD("ImporteMN", "CveConceptoContable = 312 AND TipoMovto = 0")
+ ' Dim Bancos = DtPrePoliza.SUMD("ImporteMN", "CveConceptoContable = 30 AND TipoMovto = 1")
+ ' Dim BancosComplementaria = DtPrePoliza.SUMD("ImporteMN", "CveConceptoContable = 204 AND TipoMovto = 1")
+
+ ' DtPrePoliza.Dispose()
+
+ ' ImporteFluctuacion = PagoProveedoresME - (Bancos + BancosComplementaria)
+
+ ' If MsgError = "" AndAlso ImporteFluctuacion.RoundSQL() <> 0 Then
+ ' 'SI EL PAGO DE PROVEEDORES ME ES MAYOR QUE BANCOS METER EL CONCEPTO DE GANANCIA
+ ' If ImporteFluctuacion > 0 Then
+ ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), Referencia, 64, ConceptoMovimiento, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveSubProyecto:=CveSubProyecto, CveProveedor:=Me.CveProveedor, CveCompra:=-1, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TipoCambio, TipoCambioPago:=TCPago) Then
+ ' MsgError = "Ocurrio un error al saldar el movimiento"
+ ' End If
+ ' ElseIf ImporteFluctuacion < 0 Then
+ ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), Referencia, 65, ConceptoMovimiento, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveSubProyecto:=CveSubProyecto, CveProveedor:=Me.CveProveedor, CveCompra:=-1, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TipoCambio, TipoCambioPago:=TCPago) Then
+ ' MsgError = "Ocurrio un error al saldar el movimiento"
+ ' End If
+ ' End If
+ ' End If
+ 'End If
+
End If
- 'If UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
- ' 'fluctuación.
- ' Dim TCPago = TxtTCDolares.Text.ToDecimal
-
- ' Dim ImporteFluctuacion As Decimal = 0 '((ImporteSeleccionado / TCPago) - TxtImporte.Text.ToDecimal)
-
- ' Dim DtPrePoliza As DataTable = Nothing
- ' If ObjMov.GetPrePolizasDetalle(CvePrePoliza, UsuarioActual.CveEmpresa) Then
- ' DtPrePoliza = ObjMov.DtResultados.Copy
- ' End If
-
- ' Dim PagoProveedoresME = DtPrePoliza.SUMD("ImporteMN", "CveConceptoContable = 312 AND TipoMovto = 0")
- ' Dim Bancos = DtPrePoliza.SUMD("ImporteMN", "CveConceptoContable = 30 AND TipoMovto = 1")
- ' Dim BancosComplementaria = DtPrePoliza.SUMD("ImporteMN", "CveConceptoContable = 204 AND TipoMovto = 1")
-
- ' DtPrePoliza.Dispose()
-
- ' ImporteFluctuacion = PagoProveedoresME - (Bancos + BancosComplementaria)
-
- ' If MsgError = "" AndAlso ImporteFluctuacion.RoundSQL() <> 0 Then
- ' 'SI EL PAGO DE PROVEEDORES ME ES MAYOR QUE BANCOS METER EL CONCEPTO DE GANANCIA
- ' If ImporteFluctuacion > 0 Then
- ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), Referencia, 64, ConceptoMovimiento, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveSubProyecto:=CveSubProyecto, CveProveedor:=Me.CveProveedor, CveCompra:=-1, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TipoCambio, TipoCambioPago:=TCPago) Then
- ' MsgError = "Ocurrio un error al saldar el movimiento"
- ' End If
- ' ElseIf ImporteFluctuacion < 0 Then
- ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), Referencia, 65, ConceptoMovimiento, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveSubProyecto:=CveSubProyecto, CveProveedor:=Me.CveProveedor, CveCompra:=-1, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TipoCambio, TipoCambioPago:=TCPago) Then
- ' MsgError = "Ocurrio un error al saldar el movimiento"
- ' End If
- ' End If
- ' End If
- 'End If
-
- End If
-
- If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then
+ If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then
If ObjMov.ValorPolizaDescuadre > 0 Then
MsgError = ObjMov.MensajePolizaDescuadre + " " + ObjMov.ValorDiferencia
GuardaLogAD($"Bancos/ProveedoresAbonar | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
@@ -2032,7 +2033,7 @@ Partial Class Bancos_ProveedoresAbonar
Private Sub RVTxtFechaDocumento_Init(sender As Object, e As EventArgs) Handles RVTxtFechaDocumento.Init
RVTxtFechaDocumento.MaximumValue = DateTime.Now.ToShortDateString
- RVTxtFechaDocumentoMenor.MinimumValue = DateTime.Now.AddMonths(-12).ToShortDateString
+ RVTxtFechaDocumentoMenor.MinimumValue = DateTime.Now.AddMonths(-18).ToShortDateString
RVTxtFechaDocumentoMenor.MaximumValue = DateTime.Now.ToShortDateString
Calendario.EndDate = DateTime.Now
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 6bd9eb977..c20eb252e 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -6331,7 +6331,7 @@ Partial Class Compras_Compras
funcionalidad = 317
ConceptoContable = 243
ElseIf DdlRetISRConcepto.SelectedValue.ToEntero = 3 Then
- funcionalidad = 349
+ funcionalidad = 348
ConceptoContable = 327
End If
importeMovimiento = CompraActual.RetISR
@@ -8557,40 +8557,45 @@ Partial Class Compras_Compras
Dim CveMovimientoActual As Integer = diRow("CveMovimiento").ToString.ToEntero
- Dim DTMovimientoActual As DataTable = DTInventarios.FiltraParametros($"CveMovimiento = {CveMovimientoActual} ")
-
- Dim detalleDescripcion As String = ""
- Dim Description As String = ""
-
- Dim FolioMovimiento As String = ""
- Dim ConceptoMovimiento As String = ""
-
- For Each dRowMovActual As DataRow In DTMovimientoActual.Rows
-
- If dRowMovActual("UM").ToString = "" Then
- FolioMovimiento = dRowMovActual("Folio").ToString
- ConceptoMovimiento = dRowMovActual("Concepto").ToString
-
- Description = String.Format("Eliminación Compra {6},Movimiento con Concepto: {0}, Almacen: {1}, Fecha: {2}, Folio: {3}, Usuario: {4}, Observaciones adicionales: {5}, Productos Información: ",
- ConceptoMovimiento,
- dRowMovActual("Almacen").ToString,
- dRowMovActual("FechaMovto").ToString.ToDate.ToString("dd/MM/yyyy"),
- FolioMovimiento,
- dRowMovActual("Usuario").ToString,
- dRowMovActual("Observaciones").ToString,
- $"{TxtSerie.Text}-{TxtFolio.Text}")
- Else
- detalleDescripcion = String.Format("- Cant: {0}, PS: {1}, PU: {2}, UM: {3} ", dRowMovActual("Cantidad").ToString.ToEntero, dRowMovActual("CodigoPS"), dRowMovActual("PU"), dRowMovActual("UM"))
- End If
-
- Next
-
- If Not ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1,
- String.Format("{0}, Informacion = {1}", Description, detalleDescripcion),
- "Inventarios", FolioMovimiento + " / " + ConceptoMovimiento) Then
+ If Not ObjInventarios.MovimientoRemove(CveMovimientoActual, UsuarioActual.CveEmpresa, CveUsuario:=UsuarioActual.CveUsuario) Then
ErrorCompra = True
Exit For
End If
+
+ 'Dim DTMovimientoActual As DataTable = DTInventarios.FiltraParametros($"CveMovimiento = {CveMovimientoActual} ")
+
+ 'Dim detalleDescripcion As String = ""
+ 'Dim Description As String = ""
+
+ 'Dim FolioMovimiento As String = ""
+ 'Dim ConceptoMovimiento As String = ""
+
+ 'For Each dRowMovActual As DataRow In DTMovimientoActual.Rows
+
+ ' If dRowMovActual("UM").ToString = "" Then
+ ' FolioMovimiento = dRowMovActual("Folio").ToString
+ ' ConceptoMovimiento = dRowMovActual("Concepto").ToString
+
+ ' Description = String.Format("Eliminación Compra {6},Movimiento con Concepto: {0}, Almacen: {1}, Fecha: {2}, Folio: {3}, Usuario: {4}, Observaciones adicionales: {5}, Productos Información: ",
+ ' ConceptoMovimiento,
+ ' dRowMovActual("Almacen").ToString,
+ ' dRowMovActual("FechaMovto").ToString.ToDate.ToString("dd/MM/yyyy"),
+ ' FolioMovimiento,
+ ' dRowMovActual("Usuario").ToString,
+ ' dRowMovActual("Observaciones").ToString,
+ ' $"{TxtSerie.Text}-{TxtFolio.Text}")
+ ' Else
+ ' detalleDescripcion = String.Format("- Cant: {0}, PS: {1}, PU: {2}, UM: {3} ", dRowMovActual("Cantidad").ToString.ToEntero, dRowMovActual("CodigoPS"), dRowMovActual("PU"), dRowMovActual("UM"))
+ ' End If
+
+ 'Next
+
+ 'If Not ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1,
+ ' String.Format("{0}, Informacion = {1}", Description, detalleDescripcion),
+ ' "Inventarios", FolioMovimiento + " / " + ConceptoMovimiento) Then
+ ' ErrorCompra = True
+ ' Exit For
+ 'End If
Next
End If
@@ -8655,246 +8660,255 @@ Partial Class Compras_Compras
ObjConta = New ClsContabilidad(ObjCompra.IniciaTransacSQL)
End If
+ Try
- Dim Contador As Integer = 0
- Dim Importe As Double = 0
- Dim ErrorMovtosCxP As Integer = 0
- Dim Fecha As Date
+ Dim Contador As Integer = 0
+ Dim Importe As Double = 0
+ Dim ErrorMovtosCxP As Integer = 0
+ Dim Fecha As Date
- If ListaDocumentos Is Nothing And Not ListaDocumentos.Count > 0 Then
- For Each gvr As GridViewRow In GVAnticipos.Rows
- If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then
- Contador += 1
- 'If gvr.DataKey("Fecha").ToDate > Fecha Then Fecha = gvr.DataKey("Fecha").ToDate 'guardo la fecha mayor
- Importe += gvr.FCTextBox("TxtAnticipo").Text.ToDouble
- If Math.Round(Importe, 2) - Math.Round(CompraSaldo, 2) > 0.01 Then gvr.FCTextBox("TxtAnticipo").Text = "" : gvr.FCCheckBox("Chk").Checked = False
- End If
- Next
- Else
- Contador = 1
- End If
-
- 'If TxtFecha.Text.ToDate > Fecha Then Fecha = TxtFecha.Text.ToDate
- Fecha = TxtFechaEjecucion.Text.ToDate
-
- 'Contador = 0
- If Contador > 0 Then
If ListaDocumentos Is Nothing And Not ListaDocumentos.Count > 0 Then
- If Math.Round(Importe, 2) - Math.Round(CompraSaldo, 2) > 0.01 Then
- Alert("El Importe seleccionado excede al importe de la compra", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
+ For Each gvr As GridViewRow In GVAnticipos.Rows
+ If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then
+ Contador += 1
+ 'If gvr.DataKey("Fecha").ToDate > Fecha Then Fecha = gvr.DataKey("Fecha").ToDate 'guardo la fecha mayor
+ Importe += gvr.FCTextBox("TxtAnticipo").Text.ToDouble
+ If Math.Round(Importe, 2) - Math.Round(CompraSaldo, 2) > 0.01 Then gvr.FCTextBox("TxtAnticipo").Text = "" : gvr.FCCheckBox("Chk").Checked = False
+ End If
+ Next
+ Else
+ Contador = 1
End If
- ArrAnticipos.Clear()
+ 'If TxtFecha.Text.ToDate > Fecha Then Fecha = TxtFecha.Text.ToDate
+ Fecha = TxtFechaEjecucion.Text.ToDate
- If CveCompra > 0 Then
-
- Dim ObjContaAC As ClsContPAQi = Nothing
-
- 'INICIALIZA OBJETOS
- If Not (ObjComprasParametro IsNot Nothing And ObjContaParametro IsNot Nothing) Then
- ObjCompra = New ClsCompras
- ObjConta = New ClsContabilidad(ObjCompra.IniciaTransacSQL)
+ 'Contador = 0
+ If Contador > 0 Then
+ If ListaDocumentos Is Nothing And Not ListaDocumentos.Count > 0 Then
+ If Math.Round(Importe, 2) - Math.Round(CompraSaldo, 2) > 0.01 Then
+ Alert("El Importe seleccionado excede al importe de la compra", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
End If
- Dim CveCompraNC, IdCtaContable, IdCtaContableComp As Integer
- Dim ConceptoPoliza As String = $"Amortización {NombreProveedor} - {TxtSerie.Text}-{TxtFolio.Text}"
+ ArrAnticipos.Clear()
- Try
- Dim CveIE As Integer = -1
+ If CveCompra > 0 Then
- Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
- Dim CompraActual As New Compra
- CompraActual.CveCompra = CveCompra
- CompraActual.CveTipoConceptoProveedor = CveTipoConcepto
- CompraActual.CveProveedor = CveProveedor
- CompraActual.CveMoneda = DdlMoneda.SelectedValue.ToEntero
- CompraActual.Fecha = TxtFecha.Text.ToDate
- CompraActual.SerieFolio = TxtSerie.Text.Trim & "-" & TxtFolio.Text.Trim
- CompraActual.ProveedorNombre = HplProveedor.Text
- CompraActual.TC = TipoCambio
- CompraActual.Total = TxtTotal.Text.ToDecimal
- CompraActual.IVA = TxtIVA.Text.ToDecimal
- CompraActual.IVADeducible = TxtIVA.Text.ToDecimal
- CompraActual.IEPS = TxtIEPS.Text.ToDecimal
- CompraActual.RetIVA = TxtRetIVA.Text.ToDecimal
- CompraActual.RetISR = TxtRetISR.Text.ToDecimal
- CompraActual.CveConceptoRetISR = DdlRetISRConcepto.SelectedValue.ToEntero
- CompraActual.CveConceptoRetIVA = DdlRetIVAConcepto.SelectedValue.ToEntero
- CompraActual.PorcentajeIVA = PorcentajeIVA
- CompraActual.UsuarioActual = UsuarioActual
- CompraActual.CveSubProyecto = TmpDT.FiltroPrimeroValor("CveSubProyecto", " CveSubProyecto > 0").ToEntero
- CompraActual.IdCtaContableProv = CtaProveedor
- CompraActual.IdCtaContableProvComplementaria = CtaProveedorComplementaria
- CompraActual.EsImportacion = chkImportacion.Checked
+ Dim ObjContaAC As ClsContPAQi = Nothing
- Dim CvePrePolizaNueva As Integer = ObjConta.AddPrePolizas("Compras/Anticipos", 52, Importe, Importe, DdlMoneda.SelectedValue.ToEntero, Fecha, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
+ 'INICIALIZA OBJETOS
+ If Not (ObjComprasParametro IsNot Nothing And ObjContaParametro IsNot Nothing) Then
+ ObjCompra = New ClsCompras
+ ObjConta = New ClsContabilidad(ObjCompra.IniciaTransacSQL)
+ End If
+
+ Dim CveCompraNC, IdCtaContable, IdCtaContableComp As Integer
+ Dim ConceptoPoliza As String = $"Amortización {NombreProveedor} - {TxtSerie.Text}-{TxtFolio.Text}"
+
+ Try
+ Dim CveIE As Integer = -1
+
+ Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
+ Dim CompraActual As New Compra
+ CompraActual.CveCompra = CveCompra
+ CompraActual.CveTipoConceptoProveedor = CveTipoConcepto
+ CompraActual.CveProveedor = CveProveedor
+ CompraActual.CveMoneda = DdlMoneda.SelectedValue.ToEntero
+ CompraActual.Fecha = TxtFecha.Text.ToDate
+ CompraActual.SerieFolio = TxtSerie.Text.Trim & "-" & TxtFolio.Text.Trim
+ CompraActual.ProveedorNombre = HplProveedor.Text
+ CompraActual.TC = TipoCambio
+ CompraActual.Total = TxtTotal.Text.ToDecimal
+ CompraActual.IVA = TxtIVA.Text.ToDecimal
+ CompraActual.IVADeducible = TxtIVA.Text.ToDecimal
+ CompraActual.IEPS = TxtIEPS.Text.ToDecimal
+ CompraActual.RetIVA = TxtRetIVA.Text.ToDecimal
+ CompraActual.RetISR = TxtRetISR.Text.ToDecimal
+ CompraActual.CveConceptoRetISR = DdlRetISRConcepto.SelectedValue.ToEntero
+ CompraActual.CveConceptoRetIVA = DdlRetIVAConcepto.SelectedValue.ToEntero
+ CompraActual.PorcentajeIVA = PorcentajeIVA
+ CompraActual.UsuarioActual = UsuarioActual
+ CompraActual.CveSubProyecto = TmpDT.FiltroPrimeroValor("CveSubProyecto", " CveSubProyecto > 0").ToEntero
+ CompraActual.IdCtaContableProv = CtaProveedor
+ CompraActual.IdCtaContableProvComplementaria = CtaProveedorComplementaria
+ CompraActual.EsImportacion = chkImportacion.Checked
+
+ Dim CvePrePolizaNueva As Integer = ObjConta.AddPrePolizas("Compras/Anticipos", 52, Importe, Importe, DdlMoneda.SelectedValue.ToEntero, Fecha, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
+
+ For Each gvr As GridViewRow In GVAnticipos.Rows
+ If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then
+
+ CveCompraNC = gvr.DataKey("CveCompra").ToEntero
+ If CvePrePoliza > 0 Then
+
+ Dim CveConceptoCompra As Integer = 60
+ Dim CveConceptoCompraComplementaria As Integer = 266
+ Dim TipoMovimientoCompra As Boolean = True
+ Dim CveMonedaAnticipo As Integer = gvr.DataKey("CveMoneda").ToEntero
+ Dim TipoCambioAnt As Decimal = gvr.DataKey("TCCompra").ToDecimal
+ Dim ImporteAnt As Decimal = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal
+ Dim ImporComisionAnticipo As Decimal = gvr.FCTextBox("TxtComision").Text.ToDecimal
+
+ Dim Pago As New CompraPago
+ Pago.TipoPago = gvr.DataKey("TipoDocto")
+ Pago.ImportePago = ImporteAnt
+ Pago.OtroGastoIngreso = ImporComisionAnticipo
+ Pago.CveMonedaPago = CveMonedaAnticipo
+ Pago.TCPago = TipoCambioAnt
+ Pago.CveProveedor = gvr.DataKey("CveProveedor").ToEntero
+
+ Select Case gvr.DataKey("TipoDocto")
+ Case "NC", "DEV"
+ CveConceptoCompra = If(CveMonedaAnticipo = 1, 60, 60)
+ CveConceptoCompraComplementaria = 235
+ IdCtaContable = If(CveMonedaAnticipo = 1, CtaProveedor, CtaProveedorExtranjera)
+ IdCtaContableComp = CtaProveedorComplementaria
+ CveIE = -1
+ Pago.AplicaAcreditable = False
+ Case "Egsc"
+ CveConceptoCompra = If(CveMonedaAnticipo = 1, 21, 21)
+ CveConceptoCompraComplementaria = 266
+ IdCtaContable = If(CveMonedaAnticipo = 1, CtaProveedorAnticipos, CtaProveedorAnticiposExtranjera)
+ IdCtaContableComp = CtaProveedorAnticiposComplementaria
+
+ 'vinculo la compra actual, y no la compra como si fuera nota de credito
+ CveCompraNC = -1
+ CveIE = gvr.DataKey("CveIE").ToEntero
+ CompraActual.IdCtaContableAnticipoProv = IdCtaContable
+ Case "DD"
+ CveConceptoCompra = If(CveMonedaAnticipo = 1, 37, 37)
+ IdCtaContable = CtaProveedorDeudores
+ 'vinculo la compra actual, y no la compra como si fuera nota de credito
+ CveCompraNC = -1
+ CveIE = gvr.DataKey("CveIE").ToEntero
+ End Select
+
+ 'PorcentajePago = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal / TxtTotal.Text.ToDecimal
+
+ Pago.CveIE = CveIE
+ Pago.CveCompraAmortizacion = CveCompraNC
+
+ If AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePolizaNueva, ObjConta) Then
+ ErrorMovtosCxP = 1
+ End If
+ End If
+ End If
+
+ Next
+
+ If ErrorMovtosCxP = 0 And CvePrePolizaNueva > 0 Then
+
+ If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then
+ If ObjContaAC Is Nothing Then
+ ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa)
+ ObjContaAC.IniciaTransacSQL()
+ End If
+
+ If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveUsuario, UsuarioActual.Empresa, MinFecha, "", ObjContaAC) Then
+ ErrorMovtosCxP = 3
+ End If
+
+ End If
+
+ End If
+
+ Select Case ErrorMovtosCxP
+ Case 0
+
+ If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then
+ If ObjContaAC IsNot Nothing Then
+ ObjContaAC.Commit()
+ End If
+ End If
+
+ Alert("El movimiento se aplicó correctamente.", TipoMensaje.MsgInformacion)
+ ObjCompra.Commit()
+
+ Dim dtnc As DataTable = Nothing
+ If ObjCompra.GetComprasNotasCredito(CveCompra, -1) Then
+ dtnc = ObjCompra.DtResultados
+ End If
+
+ GvAnticiposSel.DataSource = dtnc
+ GvAnticiposSel.DataBind()
+
+ LblAmortizacion.Text = (LblAmortizacion.Text.ToDouble + Importe).FormatoNumero
+ CompraSaldo = CompraSaldo - Importe
+ HdnCompraSaldo.Value = CompraSaldo.ToString
+
+ If CompraSaldo > 0 Then CargaAnticipos(CveProveedor)
+ If CveCompra > 0 Then VisualizaEstatusCompraSaldo(DdlTipoComprobante.SelectedValue, CompraSaldo.ToDecimal, TxtTotal.Text.ToDecimal)
+
+ UpAnticipos.Update()
+ UpPS.Update()
+ dtnc.Dispose()
+
+ Case 1
+ Alert("Ocurrió un error al amortizar la nota de crédito Revise su factura y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia)
+ ObjCompra.RollBack()
+ Case 2
+ Alert("Ocurrió un error al amortizar la nota de crédito Revise su factura y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia)
+ ObjCompra.RollBack()
+ Case 3
+ Alert("Ocurrió un error al contabilizar la la amortizacion del anticipo.", TipoMensaje.MsgAdvertencia)
+
+ If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then
+ If ObjContaAC IsNot Nothing Then
+ Try
+ ObjContaAC.RollBack()
+ Catch ex As Exception
+
+ End Try
+ End If
+ End If
+
+ ObjCompra.RollBack()
+ End Select
+
+ Catch ex As Exception
+ ObjCompra.RollBack()
+ End Try
+
+
+ If ObjContaAC IsNot Nothing Then
+ ObjContaAC.Dispose()
+ End If
+
+ ObjCompra.Dispose()
+
+ Else
+ 'sino se ha guardado la compra, se registra temporal que anticpos van a cargarle
For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then
-
- CveCompraNC = gvr.DataKey("CveCompra").ToEntero
- If CvePrePoliza > 0 Then
-
- Dim CveConceptoCompra As Integer = 60
- Dim CveConceptoCompraComplementaria As Integer = 266
- Dim TipoMovimientoCompra As Boolean = True
- Dim CveMonedaAnticipo As Integer = gvr.DataKey("CveMoneda").ToEntero
- Dim TipoCambioAnt As Decimal = gvr.DataKey("TCCompra").ToDecimal
- Dim ImporteAnt As Decimal = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal
- Dim ImporComisionAnticipo As Decimal = gvr.FCTextBox("TxtComision").Text.ToDecimal
-
- Dim Pago As New CompraPago
- Pago.TipoPago = gvr.DataKey("TipoDocto")
- Pago.ImportePago = ImporteAnt
- Pago.OtroGastoIngreso = ImporComisionAnticipo
- Pago.CveMonedaPago = CveMonedaAnticipo
- Pago.TCPago = TipoCambioAnt
- Pago.CveProveedor = gvr.DataKey("CveProveedor").ToEntero
-
- Select Case gvr.DataKey("TipoDocto")
- Case "NC", "DEV"
- CveConceptoCompra = If(CveMonedaAnticipo = 1, 60, 60)
- CveConceptoCompraComplementaria = 235
- IdCtaContable = If(CveMonedaAnticipo = 1, CtaProveedor, CtaProveedorExtranjera)
- IdCtaContableComp = CtaProveedorComplementaria
- CveIE = -1
- Pago.AplicaAcreditable = False
- Case "Egsc"
- CveConceptoCompra = If(CveMonedaAnticipo = 1, 21, 21)
- CveConceptoCompraComplementaria = 266
- IdCtaContable = If(CveMonedaAnticipo = 1, CtaProveedorAnticipos, CtaProveedorAnticiposExtranjera)
- IdCtaContableComp = CtaProveedorAnticiposComplementaria
-
- 'vinculo la compra actual, y no la compra como si fuera nota de credito
- CveCompraNC = -1
- CveIE = gvr.DataKey("CveIE").ToEntero
- CompraActual.IdCtaContableAnticipoProv = IdCtaContable
- Case "DD"
- CveConceptoCompra = If(CveMonedaAnticipo = 1, 37, 37)
- IdCtaContable = CtaProveedorDeudores
- 'vinculo la compra actual, y no la compra como si fuera nota de credito
- CveCompraNC = -1
- CveIE = gvr.DataKey("CveIE").ToEntero
- End Select
-
- 'PorcentajePago = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal / TxtTotal.Text.ToDecimal
-
- Pago.CveIE = CveIE
- Pago.CveCompraAmortizacion = CveCompraNC
- AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePolizaNueva, ObjConta)
- End If
+ ArrAnticipos.Add(New Anticipos With {.CvePrePoliza = gvr.DataKey("CvePrePoliza").ToEntero, .CveIE = gvr.DataKey("CveIE").ToString.ToEntero, .CveCompra = gvr.DataKey("CveCompra").ToEntero, .Importe = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal, .ImporteComision = gvr.FCTextBox("TxtComision").Text.ToDecimal, .TCCompra = gvr.DataKey("TCCompra").ToDecimal, .TipoMovto = gvr.DataKey("TipoDocto")})
End If
-
Next
- If ErrorMovtosCxP = 0 And CvePrePolizaNueva > 0 Then
-
- If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then
- If ObjContaAC Is Nothing Then
- ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa)
- ObjContaAC.IniciaTransacSQL()
- End If
-
- If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveUsuario, UsuarioActual.Empresa, MinFecha, "", ObjContaAC) Then
- ErrorMovtosCxP = 3
- End If
-
- End If
-
+ Dim ImporteAnticipo As Decimal = 0
+ If ArrAnticipos.Count > 0 Then
+ For Each Ant As Compras_Compras.Anticipos In ArrAnticipos
+ ImporteAnticipo += Ant.Importe
+ Next
End If
- Select Case ErrorMovtosCxP
- Case 0
-
- If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then
- If ObjContaAC IsNot Nothing Then
- ObjContaAC.Commit()
- End If
- End If
-
- Alert("El movimiento se aplicó correctamente.", TipoMensaje.MsgInformacion)
- ObjCompra.Commit()
-
- Dim dtnc As DataTable = Nothing
- If ObjCompra.GetComprasNotasCredito(CveCompra, -1) Then
- dtnc = ObjCompra.DtResultados
- End If
-
- GvAnticiposSel.DataSource = dtnc
- GvAnticiposSel.DataBind()
-
- LblAmortizacion.Text = (LblAmortizacion.Text.ToDouble + Importe).FormatoNumero
- CompraSaldo = CompraSaldo - Importe
- HdnCompraSaldo.Value = CompraSaldo.ToString
-
- If CompraSaldo > 0 Then CargaAnticipos(CveProveedor)
- If CveCompra > 0 Then VisualizaEstatusCompraSaldo(DdlTipoComprobante.SelectedValue, CompraSaldo.ToDecimal, TxtTotal.Text.ToDecimal)
-
- UpAnticipos.Update()
- UpPS.Update()
- dtnc.Dispose()
-
- Case 1
- Alert("Ocurrió un error al amortizar la nota de crédito Revise su factura y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia)
- ObjCompra.RollBack()
- Case 2
- Alert("Ocurrió un error al amortizar la nota de crédito Revise su factura y cualquier detalle comuníquese a Soporte Técnico", TipoMensaje.MsgAdvertencia)
- ObjCompra.RollBack()
- Case 3
- Alert("Ocurrió un error al contabilizar la la amortizacion del anticipo.", TipoMensaje.MsgAdvertencia)
-
- If (UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1") AndAlso IdPoliza > 0 AndAlso UsuarioActual.Empresa.TipoContabilidad = 2 Then
- If ObjContaAC IsNot Nothing Then
- Try
- ObjContaAC.RollBack()
- Catch ex As Exception
-
- End Try
- End If
- End If
-
- ObjCompra.RollBack()
- End Select
-
- Catch ex As Exception
- ObjCompra.RollBack()
- End Try
-
-
- If ObjContaAC IsNot Nothing Then
- ObjContaAC.Dispose()
+ LblAmortizacion.Text = ImporteAnticipo.FormatoNumero
+ LblAplicadoCompraAnt.Text = ImporteAnticipo.FormatoNumero
+ LblSaldoFactura.Text = (TxtTotal.Text.ToDecimal - ImporteAnticipo).ToString.FormatoNumero
+ UpPS.Update()
End If
-
- ObjCompra.Dispose()
-
+ RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAnticipos"))
Else
- 'sino se ha guardado la compra, se registra temporal que anticpos van a cargarle
-
- For Each gvr As GridViewRow In GVAnticipos.Rows
- If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then
- ArrAnticipos.Add(New Anticipos With {.CvePrePoliza = gvr.DataKey("CvePrePoliza").ToEntero, .CveIE = gvr.DataKey("CveIE").ToString.ToEntero, .CveCompra = gvr.DataKey("CveCompra").ToEntero, .Importe = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal, .ImporteComision = gvr.FCTextBox("TxtComision").Text.ToDecimal, .TCCompra = gvr.DataKey("TCCompra").ToDecimal, .TipoMovto = gvr.DataKey("TipoDocto")})
- End If
- Next
-
- Dim ImporteAnticipo As Decimal = 0
- If ArrAnticipos.Count > 0 Then
- For Each Ant As Compras_Compras.Anticipos In ArrAnticipos
- ImporteAnticipo += Ant.Importe
- Next
- End If
-
- LblAmortizacion.Text = ImporteAnticipo.FormatoNumero
- LblAplicadoCompraAnt.Text = ImporteAnticipo.FormatoNumero
- LblSaldoFactura.Text = (TxtTotal.Text.ToDecimal - ImporteAnticipo).ToString.FormatoNumero
- UpPS.Update()
+ Alert("No hay movimientos seleccionados para aplicar", TipoMensaje.MsgAdvertencia)
End If
- RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAnticipos"))
- Else
- Alert("No hay movimientos seleccionados para aplicar", TipoMensaje.MsgAdvertencia)
- End If
- UPPAnticiposSel.Update()
+ UPPAnticiposSel.Update()
+
+ Catch ex As Exception
+ ObjCompra.RollBack()
+ ObjCompra.Dispose()
+ End Try
End Sub
@@ -9350,7 +9364,7 @@ Partial Class Compras_Compras
Dim CvePersonal As Integer = 0
If Cont < GvPersonal.Rows.Count Then CvePersonal = GvPersonal.Rows(Cont).FCDropDownList("DdlPersonalGv").SelectedValue.ToEntero
- Dim Referencia As String
+ Dim Referencia As String = ""
If Cont < GvPersonal.Rows.Count Then Referencia = GvPersonal.Rows(Cont).FCTextBox("TxtReferencia").Text
Cont = Cont + 1
diff --git a/Compras/ReembolsosComprobaciones.aspx b/Compras/ReembolsosComprobaciones.aspx
index 6b1e0781a..188dfb37c 100644
--- a/Compras/ReembolsosComprobaciones.aspx
+++ b/Compras/ReembolsosComprobaciones.aspx
@@ -162,99 +162,124 @@
-
@@ -778,12 +778,12 @@
-
+
-
+
diff --git a/Sistemas/CatRoles.aspx.vb b/Sistemas/CatRoles.aspx.vb
index 06391880a..679ff144d 100644
--- a/Sistemas/CatRoles.aspx.vb
+++ b/Sistemas/CatRoles.aspx.vb
@@ -148,6 +148,8 @@ Partial Class CatRoles
Next
Roles.Dispose()
RegistraScript("$('#DivPermisos').modal('hide');")
+
+ RecargaGlobal()
End Sub
Protected Sub BtnGuardaProcesos_Click(sender As Object, e As EventArgs) Handles BtnGuardaProcesos.Click
@@ -157,6 +159,8 @@ Partial Class CatRoles
Next
Roles.Dispose()
RegistraScript("$('#DivProcesos').modal('hide');")
+
+ RecargaGlobal()
End Sub
#Region "G V D A T O S"
@@ -176,6 +180,12 @@ Partial Class CatRoles
End If
Rol.Dispose()
CargaDatos()
+
+ RecargaGlobal()
+ End Sub
+
+ Private Sub RecargaGlobal()
+ GlobalDTRoles(UsuarioActual.CveEmpresa) = Nothing
End Sub
diff --git a/Sistemas/RolesDetalle.aspx.vb b/Sistemas/RolesDetalle.aspx.vb
index 805e69fc1..a02db40ef 100644
--- a/Sistemas/RolesDetalle.aspx.vb
+++ b/Sistemas/RolesDetalle.aspx.vb
@@ -229,10 +229,14 @@ Partial Class Sistemas_RolesDetalle
End If
ObjEmpresa.Dispose()
+
+ RecargaGlobal()
End Sub
-
+ Private Sub RecargaGlobal()
+ GlobalDTRoles(UsuarioActual.CveEmpresa) = Nothing
+ End Sub
End Class
diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx
index 5d60ca69c..5c97355a1 100644
--- a/Ventas/PV.aspx
+++ b/Ventas/PV.aspx
@@ -3141,9 +3141,9 @@
-
+
-
+
@@ -3162,7 +3162,7 @@
-
+
@@ -3185,7 +3185,7 @@
-
+
<%-- --%>
<%----%>
<%----%>
diff --git a/Ventas/RepVentaDetalle.aspx.vb b/Ventas/RepVentaDetalle.aspx.vb
index d0b713f61..5eb5470d5 100644
--- a/Ventas/RepVentaDetalle.aspx.vb
+++ b/Ventas/RepVentaDetalle.aspx.vb
@@ -287,17 +287,17 @@ Partial Class RepVentaDetalle
DdlGrupo.DataBind()
End Sub
- Private Sub CargaCombos()
+ Private Sub CargaCombos()
CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto)
- CargaClientes()
-
-
- 'DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
- txtFechaI.Text = Now.FirstDayOfMonth.ToShortDateString
- txtFechaF.Text = Now.LastDayOfMonth.ToShortDateString
-
- 'Vendedor
- DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
+ CargaClientes()
+
+
+ 'DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1"))
+ txtFechaI.Text = Now.FirstDayOfMonth.ToShortDateString
+ txtFechaF.Text = Now.LastDayOfMonth.ToShortDateString
+
+ 'Vendedor
+ DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltraParametros("VendedorTipo in (1,4)") 'vendedores y vendedores de piso
DdlVendedor.DataBind()
DdlVendedor.Items.Insert(0, New ListItem("Sin Vendedor", "-2"))
@@ -312,7 +312,7 @@ Partial Class RepVentaDetalle
'Carga Clasificacion Cliente
DdlClienteClasificacion.DataSource = GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa)
DdlClienteClasificacion.DataBind()
- DdlClienteClasificacion.Items.Insert(0, New ListItem("Todos", "-1"))
+ DdlClienteClasificacion.Items.Insert(0, New ListItem("Todos", "-1"))
DdlClienteClasificacion.Items.Insert(0, New ListItem("Sin Giro", "-2"))
@@ -342,7 +342,7 @@ Partial Class RepVentaDetalle
End Sub
Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged
- CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue)
+ CargarSubProyecto(DdlSubProyecto, DdlProyecto.SelectedValue)
End Sub
Protected Sub DdlClienteClasificacion_SelectedIndexChanged(sender As Object, e As EventArgs)
diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx
index 124bdc6fa..3b43bc738 100644
--- a/Ventas/Ventas.aspx
+++ b/Ventas/Ventas.aspx
@@ -592,6 +592,7 @@
+
@@ -698,7 +699,7 @@
-
+
@@ -728,7 +729,7 @@
Linea Adicional:
-
+
@@ -1719,7 +1720,6 @@
-
@@ -9497,10 +9497,12 @@
step: 30
});
- if(HdnCargarInventario.value == 'True'){
+ if(HdnCargarInventario.value == 'True'){
$("#TabAlmacen_tab .ajax__tab_inner").click(function () {
CargaMovimientosInventario();
});
+ }else {
+ $("#TabAlmacen_tab .ajax__tab_inner").unbind();
}
}
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index e030db63d..2a7068f4b 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -2401,6 +2401,7 @@ Partial Class Ventas
ViewState("ClienteRetISR") = 0
ViewState("CvePrecioLista") = 0
ViewState("CvePrecioListaCliente") = 0
+ HdnCargarInventario.Value = "True"
Me.CveVendedorVenta = -1
Me.CveVendedorCliente = -1
Me.CveVendedorClienteSucursal = -1
@@ -2851,8 +2852,7 @@ Partial Class Ventas
'REMOVER EVENTO PARA RECARGAR ALMACEN
HdnCargarInventario.Value = "False"
'spanAlmacen.Attributes.Remove("onclick")
- Tab.ActiveTabIndex = 1
- Updatetabs.Update()
+ UpParametros.Update()
End If
'Modalidad Devoluciones y Refacturacion
@@ -9461,22 +9461,106 @@ Partial Class Ventas
End If
If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
- 'VERIFICA QUE LA MONEDA DE LA LINEA ADICIONAL SEA LA MISMA QUE LA VENTA
- If Me.CveMonedaLineaAdicional <> ObjFactura.CveMoneda Then
- TmpDT = TmpDTError.Copy()
- CalculaTotalesVenta(RecalcularTotalOriginal:=False)
- Alert("La moneda de la linea adicional de crédito debe ser la misma que la factura.", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE
- If ObjFactura.TipoDocto = "Rem" AndAlso Me.SaldoLineaAdicional < ObjFactura.Total Then
- TmpDT = TmpDTError.Copy()
- CalculaTotalesVenta(RecalcularTotalOriginal:=False)
- Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia)
- Exit Sub
+ If ObjFactura.TipoDocto = "Ing" Then
+ If Me.CveMonedaLineaAdicional <> ObjFactura.CveMoneda Then
+
+ 'SI LA LINEA ESTA EN PESOS Y LA FACTURA ESTA EN DOLARES
+ If Me.CveMonedaLineaAdicional = 1 AndAlso ObjFactura.CveMoneda = 2 Then
+ Dim SaldoUSD As Decimal = SaldoIngresosLineaAdicional / TxtTipoCambio.Text.ToDecimal()
+
+ If SaldoUSD < ObjFactura.Total Then
+ TmpDT = TmpDTError.Copy()
+ CalculaTotalesVenta(RecalcularTotalOriginal:=False)
+ Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
+
+ 'SI LA LINEA ESTA EN DOLARES Y LA FACTURA ESTA EN PESOS
+ If Me.CveMonedaLineaAdicional = 2 AndAlso ObjFactura.CveMoneda = 1 Then
+ Dim SaldoMXN As Decimal = SaldoIngresosLineaAdicional * TxtTipoCambio.Text.ToDecimal()
+
+ If SaldoMXN < ObjFactura.Total Then
+ TmpDT = TmpDTError.Copy()
+ CalculaTotalesVenta(RecalcularTotalOriginal:=False)
+ Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
+ Else
+ 'SI LA LINEA Y LA FACTURA TIENEN LA MISMA MONEDA
+ If Me.SaldoIngresosLineaAdicional < ObjFactura.Total Then
+ TmpDT = TmpDTError.Copy()
+ CalculaTotalesVenta(RecalcularTotalOriginal:=False)
+ Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
End If
+ If ObjFactura.TipoDocto = "Rem" Then
+ If Me.CveMonedaLineaAdicional <> ObjFactura.CveMoneda Then
+
+ 'SI LA LINEA ESTA EN PESOS Y LA FACTURA ESTA EN DOLARES
+ If Me.CveMonedaLineaAdicional = 1 AndAlso ObjFactura.CveMoneda = 2 Then
+ Dim SaldoUSD As Decimal = SaldoLineaAdicional / TxtTipoCambio.Text.ToDecimal()
+
+ If SaldoUSD < ObjFactura.Total Then
+ TmpDT = TmpDTError.Copy()
+ CalculaTotalesVenta(RecalcularTotalOriginal:=False)
+ Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
+
+ 'SI LA LINEA ESTA EN DOLARES Y LA FACTURA ESTA EN PESOS
+ If Me.CveMonedaLineaAdicional = 2 AndAlso ObjFactura.CveMoneda = 1 Then
+ Dim SaldoMXN As Decimal = SaldoLineaAdicional * TxtTipoCambio.Text.ToDecimal()
+
+ If SaldoMXN < ObjFactura.Total Then
+ TmpDT = TmpDTError.Copy()
+ CalculaTotalesVenta(RecalcularTotalOriginal:=False)
+ Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
+ Else
+ 'SI LA LINEA Y LA FACTURA TIENEN LA MISMA MONEDA
+ If Me.SaldoLineaAdicional < ObjFactura.Total Then
+ TmpDT = TmpDTError.Copy()
+ CalculaTotalesVenta(RecalcularTotalOriginal:=False)
+ Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
+ End If
+
+
+ 'VERIFICA QUE LA MONEDA DE LA LINEA ADICIONAL SEA LA MISMA QUE LA VENTA
+ 'If Me.CveMonedaLineaAdicional <> ObjFactura.CveMoneda Then
+ ' TmpDT = TmpDTError.Copy()
+ ' CalculaTotalesVenta(RecalcularTotalOriginal:=False)
+ ' Alert("La moneda de la linea adicional de crédito debe ser la misma que la factura.", TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ 'Else
+ ' If ObjFactura.TipoDocto = "Ing" AndAlso Me.SaldoIngresosLineaAdicional < ObjFactura.Total Then
+ ' TmpDT = TmpDTError.Copy()
+ ' CalculaTotalesVenta(RecalcularTotalOriginal:=False)
+ ' Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ ' End If
+ 'End If
+
+ 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE
+ 'If ObjFactura.TipoDocto = "Rem" AndAlso Me.SaldoLineaAdicional < ObjFactura.Total Then
+ ' TmpDT = TmpDTError.Copy()
+ ' CalculaTotalesVenta(RecalcularTotalOriginal:=False)
+ ' Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ 'End If
+
If ObjFactura.TipoDocto = "Ing" AndAlso (DtRemisionesPS Is Nothing OrElse DtRemisionesPS.Rows.Count = 0) Then
TmpDT = TmpDTError.Copy()
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
@@ -9484,12 +9568,6 @@ Partial Class Ventas
Exit Sub
End If
- If ObjFactura.TipoDocto = "Ing" AndAlso Me.SaldoIngresosLineaAdicional < ObjFactura.Total Then
- TmpDT = TmpDTError.Copy()
- CalculaTotalesVenta(RecalcularTotalOriginal:=False)
- Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
End If
'If Not CveEmpresaCRM > 0 Then
@@ -14198,14 +14276,26 @@ Partial Class Ventas
End If
ElseIf AplicoNCFacturaActual AndAlso ChkAplicaNCAnticipo.Checked Then
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
+
+ Dim CveConceptoPagoNC As Integer = 251
+ If ObjFactura.CveMoneda > 1 Then
+ CveConceptoPagoNC = 301
+ End If
+
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, CveConceptoPagoNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
End If
Else
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
+
+ Dim CveConceptoPagoNC As Integer = 251
+ If ObjFactura.CveMoneda > 1 Then
+ CveConceptoPagoNC = 301
+ End If
+
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, CveConceptoPagoNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
Exit For
End If
@@ -14317,7 +14407,12 @@ Partial Class Ventas
End If
End If
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimientoDev, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVentaDevolucion, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMXDev, ImporteME:=If(tipoCambio = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar) Then
+ Dim CveConceptoPagoNC As Integer = 251
+ If ObjFactura.CveMoneda > 1 Then
+ CveConceptoPagoNC = 301
+ End If
+
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimientoDev, Referencia, CveConceptoPagoNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVentaDevolucion, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMXDev, ImporteME:=If(tipoCambio = 1, 0, importeMovimientoDev), CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Exit For
End If
@@ -14526,7 +14621,12 @@ Partial Class Ventas
If importeMovimiento <> 0 Then
- If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVentaNC").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then
+ Dim CveConceptoPagoNC As Integer = 251
+ If ObjFactura.CveMoneda > 1 Then
+ CveConceptoPagoNC = 301
+ End If
+
+ If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, CveConceptoPagoNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVentaNC").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimiento, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2.DataKey("CveVentaNC").ToString().ToEntero(), ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then
ErrorPrepoliza = True
Exit For
@@ -14647,7 +14747,13 @@ Partial Class Ventas
If sumaAmorticaciones <> 0 Then
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, sumaAmorticaciones, Referencia, 251, Concepto, FechaMovimiento, IdCtaContClientes, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=sumaAmorticaciones * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then
+
+ Dim CveConceptoPagoNC As Integer = 251
+ If ObjFactura.CveMoneda > 1 Then
+ CveConceptoPagoNC = 301
+ End If
+
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, sumaAmorticaciones, Referencia, CveConceptoPagoNC, Concepto, FechaMovimiento, IdCtaContClientes, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=sumaAmorticaciones * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then
ErrorPrepoliza = True
Else
ViewState("SeGuardoPrePoliza") = True
@@ -18806,10 +18912,12 @@ Partial Class Ventas
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "PA") AndAlso UsuarioActual.Empresa.Funcionalidad(705) = "1" Then
DdlLineaAdicional.DataSource = Nothing
+ Dim TCConsulta As Decimal = TxtTipoCambio.Text.ToDecimal()
+
Using ObjVentas As New ClsVentas
'SI ES VENTA EXISTENTE , SI SE VA EDITAR SOLO MOSTRAR LAS CON SALDO, FECHA DE VENCIMIENTO VIGENTE O LA LINEA ACTUAL
If CveVenta > 0 Then
- If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, -1, UsuarioActual.CveEmpresa, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then
+ If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, -1, UsuarioActual.CveEmpresa, TipoCambioConsulta:=TCConsulta, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TrLineaAdicional.Visible = True
DdlLineaAdicional.DataSource = ObjVentas.DtResultados.FiltraParametros($"(Saldo > 0 AND FechaVencimiento <= '{Now.ToString("dd/MM/yyyy")}') OR CveLineaAdicional = {Me.CveLineaAdicionalVenta}")
@@ -18818,14 +18926,14 @@ Partial Class Ventas
Else
'SI SE ESTA FACTURANDO UNA REMISION DEBE SELECCIONAR LA LINEA ADICIONAL DE ESTA
If Me.CveLineaAdicionalVenta > 0 Then
- If ObjVentas.GetLineasAdicionalesSaldo(Me.CveLineaAdicionalVenta, CveCliente, -1, -1, UsuarioActual.CveEmpresa, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then
+ If ObjVentas.GetLineasAdicionalesSaldo(Me.CveLineaAdicionalVenta, CveCliente, -1, -1, UsuarioActual.CveEmpresa, TipoCambioConsulta:=TCConsulta, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TrLineaAdicional.Visible = True
DdlLineaAdicional.DataSource = ObjVentas.DtResultados
End If
End If
Else
- If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, -1, UsuarioActual.CveEmpresa, ConSaldo:=1, FechaVencimientoConsulta:=Now) Then
+ If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, -1, UsuarioActual.CveEmpresa, TipoCambioConsulta:=TCConsulta, ConSaldo:=1, FechaVencimientoConsulta:=Now) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TrLineaAdicional.Visible = True
DdlLineaAdicional.DataSource = ObjVentas.DtResultados
@@ -24775,15 +24883,30 @@ Partial Class Ventas
If SaldoVenta <> 0 Then
- If UsuarioActual.TienePermisoProceso(269) AndAlso Not DevolucionAlmacen = 2 Then
+ If UsuarioActual.TienePermisoProceso(269) Then
+ DivDevAlm.Visible = True
+ TieneAlmacen = True
+ End If
+
+ If UsuarioActual.Empresa.Funcionalidad(567) = "1" Then
DivDevAlm.Visible = True
TieneAlmacen = True
- If UsuarioActual.Empresa.Funcionalidad(567) = "1" Then
- ChkDevAlm.Checked = True
- ChkDevAlm.Enabled = False
- End If
+ ChkDevAlm.Checked = True
+ ChkDevAlm.Enabled = False
End If
+
+ If (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue <> "Cot") AndAlso Not AplicaDevolucion Then
+ Using ObjInv As New ClsInventarios
+ If ObjInv.GetInv_Mov(Me.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjInv.DtResultados.Rows.Count > 0 Then
+ Dim RowInv As DataRow = ObjInv.DtResultados.FiltroPrimero("CveConcepto IN (3,40)")
+ If RowInv IsNot Nothing Then
+ CveAlmacenDevolucion = RowInv("CveAlmacen").ToString().ToEntero()
+ End If
+ End If
+ End Using
+ End If
+
End If
End If
@@ -32910,9 +33033,9 @@ Partial Class Ventas
'REMOVER EVENTO PARA RECARGAR ALMACEN
'spanAlmacen.Attributes.Remove("onclick")
- Tab.ActiveTabIndex = 1
+
HdnCargarInventario.Value = "False"
- Updatetabs.Update()
+ UpParametros.Update()
UpnTools.Update()
@@ -36441,8 +36564,10 @@ Partial Class Ventas
RBLPago.SelectedValue = "1"
RBLPago.Enabled = False
+ Dim TCConsulta As Decimal = TxtTipoCambio.Text.ToDecimal()
+
Using ObjVentas As New ClsVentas
- If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, -1, UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then
+ If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, -1, UsuarioActual.CveEmpresa, TipoCambioConsulta:=TCConsulta, FechaVencimientoConsulta:=MinFecha) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
Dim RowLinea As DataRow = ObjVentas.DtResultados.Rows(0)
If RowLinea IsNot Nothing Then
@@ -36552,16 +36677,36 @@ Partial Class Ventas
Exit Sub
End If
- 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE
- If Me.SaldoLineaAdicional < TxtTotal.Text.ToDecimal() Then
- Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
+ Dim TotalDocumento As Decimal = TxtTotal.Text.ToDecimal()
- 'VERIFICA QUE LA MONEDA DE LA LINEA ADICIONAL SEA LA MISMA QUE LA VENTA
+ 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE
If Me.CveMonedaLineaAdicional <> DdlMoneda.SelectedValue.ToEntero() Then
- Alert("La moneda de la linea adicional de crédito debe ser la misma que la factura.", TipoMensaje.MsgAdvertencia)
- Exit Sub
+
+ 'SI LA LINEA ESTA EN PESOS Y LA FACTURA ESTA EN DOLARES
+ If Me.CveMonedaLineaAdicional = 1 AndAlso DdlMoneda.SelectedValue.ToEntero() = 2 Then
+ Dim SaldoUSD As Decimal = SaldoLineaAdicional / TxtTipoCambio.Text.ToDecimal()
+
+ If SaldoUSD < TotalDocumento Then
+ Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
+
+ 'SI LA LINEA ESTA EN DOLARES Y LA FACTURA ESTA EN PESOS
+ If Me.CveMonedaLineaAdicional = 2 AndAlso DdlMoneda.SelectedValue.ToEntero() = 1 Then
+ Dim SaldoMXN As Decimal = SaldoLineaAdicional * TxtTipoCambio.Text.ToDecimal()
+
+ If SaldoMXN < TotalDocumento Then
+ Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ End If
+ Else
+ 'SI LA LINEA Y LA FACTURA TIENEN LA MISMA MONEDA
+ If Me.SaldoLineaAdicional < TotalDocumento Then
+ Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
End If
End If
@@ -36601,7 +36746,7 @@ Partial Class Ventas
'Tab.ActiveTabIndex = 1
HdnCargarInventario.Value = "False"
'Updatetabs.Update()
- UpINV.Update()
+ UpParametros.Update()
End Sub
Protected Sub LBAplicaDevolucion_Click(sender As Object, e As EventArgs)