Compras Cancelacion DRNC
This commit is contained in:
@@ -1418,7 +1418,7 @@
|
||||
|
||||
<div class="Widthall" style="overflow-x: auto;">
|
||||
|
||||
<asp:GridView ID="GvInvMov" runat="server" AutoGenerateColumns="false" DataKeyNames="Origen,CveAlmacen" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%"
|
||||
<asp:GridView ID="GvInvMov" runat="server" AutoGenerateColumns="false" DataKeyNames="Cantidad,Origen,CveAlmacen,CveUM,CvePS,CodigoPS,PU" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%"
|
||||
HeaderStyle-CssClass="Titulos" CssClass="table table-striped table-hover" GridLines="None" Visible="false">
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="60px" ItemStyle-HorizontalAlign="Center">
|
||||
|
||||
@@ -539,6 +539,8 @@ Partial Class Compras_Compras
|
||||
ViewState("EsNoDeducible") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "PROPIEDADES - AC NEW"
|
||||
@@ -1036,8 +1038,6 @@ Partial Class Compras_Compras
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
Public Property FechaCompraOriginal As Date
|
||||
Get
|
||||
Return ViewState("FechaCompraOriginal").ToString.ToDate
|
||||
@@ -1202,22 +1202,8 @@ Partial Class Compras_Compras
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'ImporteRNCSaldar = 0
|
||||
'SerieFolioProntoPago = ""
|
||||
'TipoCambioProntoPago = 1
|
||||
'FechaProntoPago = MinFecha
|
||||
'CveMonedaProntoPago = 1
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
'Public Property ListaFacturasRealcionadasRNC As List(Of String)
|
||||
' Get
|
||||
' If ViewState("ListaFacturasRealcionadasRNC") Is Nothing Then
|
||||
@@ -1230,7 +1216,6 @@ Partial Class Compras_Compras
|
||||
' End Set
|
||||
'End Property
|
||||
|
||||
|
||||
Private Property EsGrupoDiaz As Boolean
|
||||
Get
|
||||
If ViewState("EsGrupoDiaz") Is Nothing Then
|
||||
@@ -1243,6 +1228,18 @@ Partial Class Compras_Compras
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property CveCompraDRMC As Integer
|
||||
Get
|
||||
If ViewState("CveCompraDRMC") Is Nothing Then
|
||||
ViewState("CveCompraDRMC") = -1
|
||||
End If
|
||||
Return ViewState("CveCompraDRMC").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveCompraDRMC") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
@@ -14698,6 +14695,17 @@ Partial Class Compras_Compras
|
||||
ErrorCancelar = True
|
||||
End Try
|
||||
|
||||
|
||||
If Not ErrorCancelar AndAlso DdlTipoComprobante.SelectedValue = "RNC" AndAlso TxtSerie.Text.Contains("DRNC") Then
|
||||
If Not ErrorCancelar Then
|
||||
If Not RegistroInventarioDevTemporal(ObjCompras.IniciaTransacSQL, TmpDT.MAX("CveSubProyecto").ToEntero, CveCompra, EsCancelacion:=True) Then
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If Not ErrorCancelar Then
|
||||
If ObjAC IsNot Nothing Then
|
||||
ObjAC.Commit()
|
||||
@@ -19231,7 +19239,7 @@ Partial Class Compras_Compras
|
||||
CompraActual.EsImportacion = chkImportacion.Checked
|
||||
|
||||
If Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, objConta, CvePrePoliza, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", DdlMoneda.SelectedValue.ToEntero,
|
||||
TxtSerie.Text, TxtFolio.Text) Then
|
||||
TxtSerie.Text, TxtFolio.Text, EsDRMN:=True) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
@@ -19239,8 +19247,12 @@ Partial Class Compras_Compras
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If Not CveCompraDRMC > 0 Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
If Not RegistroInventarioDevTemporal(ObjCompras.IniciaTransacSQL, 0, tCveSubProyeto) Then
|
||||
If Not RegistroInventarioDevTemporal(ObjCompras.IniciaTransacSQL, tCveSubProyeto, CveCompraDRMC, EsCancelacion:=False) Then
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
@@ -19248,6 +19260,7 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If Not TieneError Then
|
||||
ObjCompras.Commit()
|
||||
Else
|
||||
@@ -19259,18 +19272,20 @@ Partial Class Compras_Compras
|
||||
InicializaDevolucionAlmacen()
|
||||
End Sub
|
||||
|
||||
Function RegistroInventarioDevTemporal(ByRef transaccion As SqlTransaction, OpcionOrigen As Integer, tCveSubProyecto As Integer) As Boolean
|
||||
Function RegistroInventarioDevTemporal(ByRef transaccion As SqlTransaction, tCveSubProyecto As Integer, CveCompraDRMCRelacionada As Integer, EsCancelacion As Boolean) As Boolean
|
||||
|
||||
'Dim CveConceptoInv As Integer = If(OpcionOrigen = 1, 2, 3)
|
||||
Dim CveConceptoSalida As Integer = 3
|
||||
Dim CveConceptoEntrada As Integer = 2
|
||||
|
||||
Dim CveConceptoSalida As Integer = If(EsCancelacion, 2, 13)
|
||||
'Dim CveConceptoEntrada As Integer = 2 'OIC FIXME Ver Con Rene
|
||||
|
||||
Dim Respuesta As Boolean = True
|
||||
|
||||
'Dim ObjOC As New ClsOC(transaccion)
|
||||
|
||||
Dim CveAlmacenOrigen As Integer = -1
|
||||
Dim CveAlmacenDestino As Integer = -1
|
||||
'Dim CveAlmacenDestino As Integer = -1
|
||||
|
||||
|
||||
For Each gvRow As GridViewRow In GvInvMov.Rows
|
||||
CveAlmacenOrigen = gvRow.DataKey("CveAlmacen").ToEntero
|
||||
@@ -19284,14 +19299,14 @@ Partial Class Compras_Compras
|
||||
Return False
|
||||
End If
|
||||
|
||||
CveAlmacenDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveSubProyecto = {tCveSubProyecto} AND CveTipoAlmacen = 21 ").ToEntero
|
||||
If CveAlmacenDestino <= 0 Then
|
||||
CveAlmacenDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveTipoAlmacen = 21 ").ToEntero
|
||||
End If
|
||||
If CveAlmacenDestino <= 0 Then
|
||||
Alert("Almacén destino de devolución proveedor no esta asignado.")
|
||||
Return False
|
||||
End If
|
||||
'CveAlmacenDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveSubProyecto = {tCveSubProyecto} AND CveTipoAlmacen = 21 ").ToEntero
|
||||
'If CveAlmacenDestino <= 0 Then
|
||||
' CveAlmacenDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveTipoAlmacen = 21 ").ToEntero
|
||||
'End If
|
||||
'If CveAlmacenDestino <= 0 Then
|
||||
' Alert("Almacén destino de devolución proveedor no esta asignado.")
|
||||
' Return False
|
||||
'End If
|
||||
|
||||
Dim ObjConta As New ClsContabilidad(transaccion)
|
||||
Dim ObjInventario As New ClsInventarios(transaccion)
|
||||
@@ -19299,10 +19314,10 @@ Partial Class Compras_Compras
|
||||
'Dim CveConceptoInv As Integer = If(TipoTermino = 1, 3, 2)
|
||||
|
||||
Dim CvePrePolizaSalida As Integer = ObjConta.AddPrePolizas("Comp/InvDevSal", 53, 0, 0, 1, TxtFecha.Text.Replace(",", "").ToDate, $"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
|
||||
Dim CvePrePolizaEntrada As Integer = ObjConta.AddPrePolizas("Comp/InvDevEnt", 53, 0, 0, 1, TxtFecha.Text.Replace(",", "").ToDate, $"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
|
||||
'Dim CvePrePolizaEntrada As Integer = ObjConta.AddPrePolizas("Comp/InvDevEnt", 53, 0, 0, 1, TxtFecha.Text.Replace(",", "").ToDate, $"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
|
||||
|
||||
Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenOrigen, CveConceptoSalida, 1, NowADS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, tCveSubProyecto, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}",
|
||||
CveAlmacenDestino:=CveAlmacenDestino, Modulo:="ComprasDev/1")
|
||||
Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenOrigen, CveConceptoSalida, 1, NowADS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraDRMCRelacionada, -1, tCveSubProyecto, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}",
|
||||
CveAlmacenDestino:=-1, Modulo:="ComprasDev/1")
|
||||
|
||||
Dim FolioMtoSalida As Integer = ObjInventario.Folio
|
||||
Dim FolioMtoEntrada As Integer = 0 'Se asigna mas abajo
|
||||
@@ -19319,31 +19334,26 @@ Partial Class Compras_Compras
|
||||
Dim Mensaje As String = ""
|
||||
Dim Cont As Integer = 0
|
||||
|
||||
For Each gvRow As GridViewRow In GvSolDev.Rows
|
||||
'Dim FechaCaducidadVal As Date = If(Dr("AplicaCaducidad").ToString = "True", Dr("FechaCaducidad").ToString.ToDate, MinFecha)
|
||||
Dim FechaMovtoExistenciaStr As String = $"{NowADS.ToString("yyyy/MM/dd")} {NowADS.ToString("HH:mm")}"
|
||||
Dim Cantidad As Decimal = gvRow.FCTextBox("TxtCant").Text.ToDecimal
|
||||
If EsCancelacion Then
|
||||
|
||||
If Cantidad > 0 Then
|
||||
For Each gvRow As GridViewRow In GvInvMov.Rows
|
||||
'Dim FechaCaducidadVal As Date = If(Dr("AplicaCaducidad").ToString = "True", Dr("FechaCaducidad").ToString.ToDate, MinFecha)
|
||||
Dim FechaMovtoExistenciaStr As String = $"{NowADS.ToString("yyyy/MM/dd")} {NowADS.ToString("HH:mm")}"
|
||||
Dim Cantidad As Decimal = gvRow.DataKey("Cantidad").ToDecimal
|
||||
|
||||
Dim CveUM As Integer = gvRow.DataKey("CveUM").ToString.ToEntero
|
||||
Dim CvePS As Integer = gvRow.DataKey("CvePS").ToString.ToEntero
|
||||
Dim CveCompraDetalle As Integer = gvRow.DataKey("CveCompraDetalle").ToEntero
|
||||
Dim PU As Decimal = gvRow.DataKey("PU").ToDecimal
|
||||
Dim CodigoPS As String = gvRow.DataKey("CodigoPS")
|
||||
If Cantidad > 0 Then
|
||||
|
||||
If ObjInventario.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlmacenOrigen, FechaMovto:=FechaMovtoExistenciaStr) >= Cantidad Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, PU, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", CveUsuarioModifico:=UsuarioActual.CveUsuario,
|
||||
CveCompraDetalle:=CveCompraDetalle) Then
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
Respuesta = False
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
Dim CveUM As Integer = gvRow.DataKey("CveUM").ToString.ToEntero
|
||||
Dim CvePS As Integer = gvRow.DataKey("CvePS").ToString.ToEntero
|
||||
'Dim CveCompraDetalle As Integer = gvRow.DataKey("CveCompraDetalle").ToEntero' OIC 2024-12-26 se quita relacion
|
||||
Dim PU As Decimal = gvRow.DataKey("PU").ToDecimal
|
||||
Dim CodigoPS As String = gvRow.DataKey("CodigoPS")
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(114) Then
|
||||
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(114) Or EsCancelacion Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, PU, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", CveUsuarioModifico:=UsuarioActual.CveUsuario,
|
||||
CveOrdenCompraDetalle:=CveCompraDetalle) Then
|
||||
CveOrdenCompraDetalle:=-1) Then
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
Respuesta = False
|
||||
Exit For
|
||||
@@ -19355,59 +19365,94 @@ Partial Class Compras_Compras
|
||||
Exit For
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Cont += 1
|
||||
|
||||
End If
|
||||
Cont += 1
|
||||
Next
|
||||
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
For Each gvRow As GridViewRow In GvSolDev.Rows
|
||||
'Dim FechaCaducidadVal As Date = If(Dr("AplicaCaducidad").ToString = "True", Dr("FechaCaducidad").ToString.ToDate, MinFecha)
|
||||
Dim FechaMovtoExistenciaStr As String = $"{NowADS.ToString("yyyy/MM/dd")} {NowADS.ToString("HH:mm")}"
|
||||
Dim Cantidad As Decimal = gvRow.FCTextBox("TxtCant").Text.ToDecimal
|
||||
|
||||
If Cantidad > 0 Then
|
||||
|
||||
Dim CveMovimientoEntrada As Integer = ObjInventario.AddMovimiento(CveAlmacenDestino, CveConceptoEntrada, 1, NowADS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, tCveSubProyecto, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}",
|
||||
Modulo:="ComprasDev/2", CveMovimientoRelacionado:=CveMovimientoSalida)
|
||||
FolioMtoEntrada = ObjInventario.Folio
|
||||
Dim CveUM As Integer = gvRow.DataKey("CveUM").ToString.ToEntero
|
||||
Dim CvePS As Integer = gvRow.DataKey("CvePS").ToString.ToEntero
|
||||
'Dim CveCompraDetalle As Integer = gvRow.DataKey("CveCompraDetalle").ToEntero' OIC 2024-12-26 se quita relacion
|
||||
Dim PU As Decimal = gvRow.DataKey("PU").ToDecimal
|
||||
Dim CodigoPS As String = gvRow.DataKey("CodigoPS")
|
||||
|
||||
If Respuesta AndAlso CveMovimientoEntrada > 0 Then
|
||||
'OIC GetMovmientoDetalle y relacionar al anteruior
|
||||
'
|
||||
'Dim DTMovmientoDetalle As New DataTable
|
||||
|
||||
|
||||
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
For Each dRow As DataRow In ObjInventario.DtResultados.Rows
|
||||
|
||||
Dim Cantidad As Decimal = dRow("Cantidad").ToString.ToDecimal
|
||||
|
||||
If Cantidad > 0 Then
|
||||
Dim CveUM As Integer = dRow("CveUM").ToString.ToEntero
|
||||
Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
|
||||
Dim CveMovimientoDetalle As Integer = dRow("CveMovimientoDetalle").ToString.ToEntero
|
||||
Dim PU As Decimal = dRow("PU").ToString.ToDecimal
|
||||
Dim CodigoPS As String = dRow("CodigoPS").ToString
|
||||
|
||||
Dim ImporteConcepto As Decimal = PU
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, CveUM, CvePS, ImporteConcepto, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", CveUsuarioModifico:=UsuarioActual.CveUsuario,
|
||||
CveMovimientoDetalleEntrada:=CveMovimientoDetalle) Then
|
||||
If ObjInventario.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlmacenOrigen, FechaMovto:=FechaMovtoExistenciaStr) >= Cantidad And Not EsCancelacion Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, PU, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", CveUsuarioModifico:=UsuarioActual.CveUsuario,
|
||||
CveCompraDetalle:=-1) Then
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
Respuesta = False
|
||||
Exit For
|
||||
|
||||
End If
|
||||
Cont += 1
|
||||
End If
|
||||
Else
|
||||
|
||||
Next
|
||||
End If
|
||||
If UsuarioActual.TienePermisoProceso(114) Or EsCancelacion Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, PU, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", CveUsuarioModifico:=UsuarioActual.CveUsuario,
|
||||
CveOrdenCompraDetalle:=-1) Then
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
Respuesta = False
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
Mensaje = String.Format("No hay existencias suficientes del producto: {0}", CodigoPS)
|
||||
Alert(Mensaje, TipoMensaje.MsgAdvertencia)
|
||||
Respuesta = False
|
||||
Exit For
|
||||
End If
|
||||
|
||||
End If
|
||||
Cont += 1
|
||||
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
''Se quita entrada
|
||||
'Dim CveMovimientoEntrada As Integer = ObjInventario.AddMovimiento(CveAlmacenDestino, CveConceptoEntrada, 1, NowADS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, tCveSubProyecto, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}",
|
||||
' Modulo:="ComprasDev/2", CveMovimientoRelacionado:=CveMovimientoSalida)
|
||||
'FolioMtoEntrada = ObjInventario.Folio
|
||||
'If Respuesta AndAlso CveMovimientoEntrada > 0 Then
|
||||
' If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
' For Each dRow As DataRow In ObjInventario.DtResultados.Rows
|
||||
' Dim Cantidad As Decimal = dRow("Cantidad").ToString.ToDecimal
|
||||
' If Cantidad > 0 Then
|
||||
' Dim CveUM As Integer = dRow("CveUM").ToString.ToEntero
|
||||
' Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
|
||||
' Dim CveMovimientoDetalle As Integer = dRow("CveMovimientoDetalle").ToString.ToEntero
|
||||
' Dim PU As Decimal = dRow("PU").ToString.ToDecimal
|
||||
' Dim CodigoPS As String = dRow("CodigoPS").ToString
|
||||
' Dim ImporteConcepto As Decimal = PU
|
||||
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, CveUM, CvePS, ImporteConcepto, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", CveUsuarioModifico:=UsuarioActual.CveUsuario,
|
||||
' CveMovimientoDetalleEntrada:=CveMovimientoDetalle) Then
|
||||
' Mensaje = "Error al guardar los movimientos"
|
||||
' Respuesta = False
|
||||
' Exit For
|
||||
' End If
|
||||
' Cont += 1
|
||||
' End If
|
||||
' Next
|
||||
' End If
|
||||
'End If
|
||||
|
||||
|
||||
'PrePoliza Movmiento de salida
|
||||
Dim EsContabilizable As Boolean = False
|
||||
'Registro la prepóliza
|
||||
If Respuesta AndAlso ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUMD("Total", "").RoundSQL()
|
||||
Dim tValorOtro As Decimal = tValorInventario
|
||||
Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUMD("Total", "").RoundSQL() '* (If(EsCancelacion, -1, 1))
|
||||
'Dim tValorOtro As Decimal = tValorInventario
|
||||
|
||||
Dim TipoMovtoAlmacen As Boolean = False
|
||||
Dim TipoMovtoOtro As Boolean = True
|
||||
@@ -19446,7 +19491,7 @@ Partial Class Compras_Compras
|
||||
Case 13, 29
|
||||
CveConceptoContable = 69
|
||||
TipoMovtoOtro = True
|
||||
tValorOtro = -tValorOtro
|
||||
'tValorOtro = -tValorOtro
|
||||
Dim drr As DataRow = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimero("")
|
||||
If drr IsNot Nothing Then
|
||||
CveClasificacion = drr("CveClasificacion").ToString.ToEntero
|
||||
@@ -19462,114 +19507,124 @@ Partial Class Compras_Compras
|
||||
'2-78
|
||||
Dim Obs As String = $"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}"
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSalida, TipoMovtoAlmacen, tValorInventario, tValorInventario, 68, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoSalida, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
|
||||
Respuesta = False
|
||||
Else
|
||||
If ObjConta.AddPrePolizasDetalle(CvePrePolizaSalida, TipoMovtoAlmacen, tValorInventario, tValorInventario, 68, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoSalida, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
|
||||
|
||||
'Dim Total As Decimal = 0
|
||||
If CveConceptoContable.Contiene(181, 78, 51, 69) Then
|
||||
Dim Dt As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}).Copy
|
||||
Dim Dt As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}).Copy
|
||||
For Each Dr As DataRow In Dt.Rows
|
||||
Dim Total As Decimal = ObjInventario.DtResultados.FiltraParametros($"CveClasificacion = {Dr("CveClasificacion")}").SUM("Total").RoundSQL() ' * (If(EsCancelacion, -1, 1))
|
||||
|
||||
For Each Dr As DataRow In Dt.Rows
|
||||
Dim Total As Decimal = ObjInventario.DtResultados.FiltraParametros($"CveClasificacion = {Dr("CveClasificacion")}").SUM("Total").RoundSQL()
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSalida, Not TipoMovtoAlmacen, Total, Total, CveConceptoContable, LblFolio.Text, Obs, 0, CveMovimientoAlmacen:=CveMovimientoSalida, CveClasificacion:=Dr("CveClasificacion").ToString.ToEntero, CveSubProyecto:=tCveSubProyecto) Then
|
||||
Respuesta = False
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSalida, Not TipoMovtoAlmacen, tValorInventario, tValorInventario, CveConceptoContable, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoSalida, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSalida, Not TipoMovtoAlmacen, Total, Total, 95, LblFolio.Text, Obs, 0, CveMovimientoAlmacen:=CveMovimientoSalida, CveClasificacion:=Dr("CveClasificacion").ToString.ToEntero, CveSubProyecto:=tCveSubProyecto, Contabilizable:=EsContabilizable) Then
|
||||
Respuesta = False
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
'If CveConceptoContable.Contiene(181, 78, 51, 69) Then
|
||||
' Dim Dt As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}).Copy
|
||||
|
||||
' For Each Dr As DataRow In Dt.Rows
|
||||
' Dim Total As Decimal = ObjInventario.DtResultados.FiltraParametros($"CveClasificacion = {Dr("CveClasificacion")}").SUM("Total").RoundSQL()
|
||||
|
||||
' If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSalida, Not TipoMovtoAlmacen, Total, Total, CveConceptoContable, LblFolio.Text, Obs, 0, CveMovimientoAlmacen:=CveMovimientoSalida, CveClasificacion:=Dr("CveClasificacion").ToString.ToEntero, CveSubProyecto:=tCveSubProyecto) Then
|
||||
' Respuesta = False
|
||||
' End If
|
||||
' Next
|
||||
'Else
|
||||
' If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSalida, Not TipoMovtoAlmacen, tValorInventario, tValorInventario, CveConceptoContable, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoSalida, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
|
||||
' Respuesta = False
|
||||
' End If
|
||||
'End If
|
||||
|
||||
|
||||
Else
|
||||
Respuesta = False
|
||||
|
||||
End If
|
||||
Else
|
||||
Respuesta = False
|
||||
End If
|
||||
|
||||
|
||||
'PrePoliza Movmiento de entrada
|
||||
If Respuesta AndAlso ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then
|
||||
Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUMD("Total", "").RoundSQL()
|
||||
Dim tValorOtro As Decimal = tValorInventario
|
||||
''PrePoliza Movmiento de entrada
|
||||
'If Respuesta AndAlso ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then
|
||||
' Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUMD("Total", "").RoundSQL()
|
||||
' Dim tValorOtro As Decimal = tValorInventario
|
||||
|
||||
Dim TipoMovtoAlmacen As Boolean = False
|
||||
Dim TipoMovtoOtro As Boolean = True
|
||||
' Dim TipoMovtoAlmacen As Boolean = False
|
||||
' Dim TipoMovtoOtro As Boolean = True
|
||||
|
||||
|
||||
Dim drA2 As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacenOrigen))
|
||||
If drA2 IsNot Nothing Then
|
||||
tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero
|
||||
End If
|
||||
' Dim drA2 As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacenOrigen))
|
||||
' If drA2 IsNot Nothing Then
|
||||
' tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero
|
||||
' End If
|
||||
|
||||
Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & CveConceptoEntrada).ToEntero
|
||||
If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True
|
||||
TipoMovtoOtro = Not TipoMovtoAlmacen
|
||||
' Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & CveConceptoEntrada).ToEntero
|
||||
' If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True
|
||||
' TipoMovtoOtro = Not TipoMovtoAlmacen
|
||||
|
||||
Dim CveConceptoContable As Integer = 260
|
||||
Dim CveClasificacion As Integer = -1
|
||||
Select Case CveConceptoEntrada
|
||||
Case 2, 32
|
||||
CveConceptoContable = 78
|
||||
EsContabilizable = True
|
||||
Case 28, 31
|
||||
CveConceptoContable = 51
|
||||
If CveConceptoEntrada = 28 Then
|
||||
''cuando es 28, es otros ingresos.78
|
||||
CveConceptoContable = 78
|
||||
End If
|
||||
EsContabilizable = True
|
||||
Case 30
|
||||
CveConceptoContable = 181
|
||||
TipoMovtoOtro = False
|
||||
If DdlSubProyecto.Visible = True AndAlso DdlSubProyecto.SelectedValue.ToEntero > 0 Then tCveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero
|
||||
' Dim CveConceptoContable As Integer = 260
|
||||
' Dim CveClasificacion As Integer = -1
|
||||
' Select Case CveConceptoEntrada
|
||||
' Case 2, 32
|
||||
' CveConceptoContable = 78
|
||||
' EsContabilizable = True
|
||||
' Case 28, 31
|
||||
' CveConceptoContable = 51
|
||||
' If CveConceptoEntrada = 28 Then
|
||||
' ''cuando es 28, es otros ingresos.78
|
||||
' CveConceptoContable = 78
|
||||
' End If
|
||||
' EsContabilizable = True
|
||||
' Case 30
|
||||
' CveConceptoContable = 181
|
||||
' TipoMovtoOtro = False
|
||||
' If DdlSubProyecto.Visible = True AndAlso DdlSubProyecto.SelectedValue.ToEntero > 0 Then tCveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero
|
||||
|
||||
Case 34
|
||||
CveConceptoContable = 51
|
||||
EsContabilizable = True
|
||||
Case 13, 29
|
||||
CveConceptoContable = 69
|
||||
TipoMovtoOtro = True
|
||||
tValorOtro = -tValorOtro
|
||||
Dim drr As DataRow = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimero("")
|
||||
If drr IsNot Nothing Then
|
||||
CveClasificacion = drr("CveClasificacion").ToString.ToEntero
|
||||
End If
|
||||
Case 3
|
||||
CveConceptoContable = 51
|
||||
EsContabilizable = True
|
||||
Case Else
|
||||
CveConceptoContable = 95
|
||||
' Case 34
|
||||
' CveConceptoContable = 51
|
||||
' EsContabilizable = True
|
||||
' Case 13, 29
|
||||
' CveConceptoContable = 69
|
||||
' TipoMovtoOtro = True
|
||||
' tValorOtro = -tValorOtro
|
||||
' Dim drr As DataRow = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimero("")
|
||||
' If drr IsNot Nothing Then
|
||||
' CveClasificacion = drr("CveClasificacion").ToString.ToEntero
|
||||
' End If
|
||||
' Case 3
|
||||
' CveConceptoContable = 51
|
||||
' EsContabilizable = True
|
||||
' Case Else
|
||||
' CveConceptoContable = 95
|
||||
|
||||
End Select
|
||||
' End Select
|
||||
|
||||
'2-78
|
||||
Dim Obs As String = $"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}"
|
||||
' '2-78
|
||||
' Dim Obs As String = $"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}"
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaEntrada, TipoMovtoAlmacen, tValorInventario, tValorInventario, 68, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoEntrada, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
|
||||
Respuesta = False
|
||||
Else
|
||||
' If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaEntrada, TipoMovtoAlmacen, tValorInventario, tValorInventario, 68, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoEntrada, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
|
||||
' Respuesta = False
|
||||
' Else
|
||||
|
||||
'Dim Total As Decimal = 0
|
||||
If CveConceptoContable.Contiene(181, 78, 51, 69) Then
|
||||
Dim Dt As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}).Copy
|
||||
' 'Dim Total As Decimal = 0
|
||||
' If CveConceptoContable.Contiene(181, 78, 51, 69) Then
|
||||
' Dim Dt As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}).Copy
|
||||
|
||||
For Each Dr As DataRow In Dt.Rows
|
||||
Dim Total As Decimal = ObjInventario.DtResultados.FiltraParametros($"CveClasificacion = {Dr("CveClasificacion")}").SUM("Total").RoundSQL()
|
||||
' For Each Dr As DataRow In Dt.Rows
|
||||
' Dim Total As Decimal = ObjInventario.DtResultados.FiltraParametros($"CveClasificacion = {Dr("CveClasificacion")}").SUM("Total").RoundSQL()
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaEntrada, Not TipoMovtoAlmacen, Total, Total, CveConceptoContable, LblFolio.Text, Obs, 0, CveMovimientoAlmacen:=CveMovimientoEntrada, CveClasificacion:=Dr("CveClasificacion").ToString.ToEntero, CveSubProyecto:=tCveSubProyecto) Then
|
||||
Respuesta = False
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaEntrada, Not TipoMovtoAlmacen, tValorInventario, tValorInventario, CveConceptoContable, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoEntrada, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
|
||||
Respuesta = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Respuesta = False
|
||||
End If
|
||||
' If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaEntrada, Not TipoMovtoAlmacen, Total, Total, CveConceptoContable, LblFolio.Text, Obs, 0, CveMovimientoAlmacen:=CveMovimientoEntrada, CveClasificacion:=Dr("CveClasificacion").ToString.ToEntero, CveSubProyecto:=tCveSubProyecto) Then
|
||||
' Respuesta = False
|
||||
' End If
|
||||
' Next
|
||||
' Else
|
||||
' If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaEntrada, Not TipoMovtoAlmacen, tValorInventario, tValorInventario, CveConceptoContable, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoEntrada, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
|
||||
' Respuesta = False
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
'Else
|
||||
' Respuesta = False
|
||||
'End If
|
||||
|
||||
End If
|
||||
|
||||
@@ -22158,7 +22213,8 @@ Partial Class Compras_Compras
|
||||
#Region "PRONTO PAGO"
|
||||
|
||||
Public Function GeneraRNC(ByRef sqltransaccion As SqlTransaction, CveCompraRegistrada As Integer, ByRef CompraActual As Compra, ByRef ObjConta As ClsContabilidad, CvePrePoliza As Integer,
|
||||
CveProveedor As Integer, NombreProveedor As String, Fecha As Date, Descripcion As String, CveMoneda As Integer, Serie As String, Folio As String) As Boolean
|
||||
CveProveedor As Integer, NombreProveedor As String, Fecha As Date, Descripcion As String, CveMoneda As Integer, Serie As String, Folio As String, Optional EsDRMN As Boolean = False) As Boolean
|
||||
CveCompraDRMC = -1
|
||||
Dim respuesta As Boolean = True
|
||||
Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
|
||||
|
||||
@@ -22191,7 +22247,7 @@ Partial Class Compras_Compras
|
||||
.NombreProveedor = NombreProveedor,
|
||||
.Fecha = Fecha,
|
||||
.CveMoneda = CveMoneda,
|
||||
.Serie = Serie,
|
||||
.Serie = If(EsDRMN, $"DRNC{Serie}", Serie),
|
||||
.Folio = Folio,
|
||||
.CveCompraAmortizacion = CveCompraRegistrada
|
||||
}
|
||||
@@ -22220,6 +22276,7 @@ Partial Class Compras_Compras
|
||||
Pago.AplicaAcreditable = False
|
||||
Pago.TipoPago = "RNC"
|
||||
Pago.Fecha = CompraActual.Fecha 'toma la misma fecha de la provisión en el pago de NC
|
||||
CveCompraDRMC = CompraRNC.CveCompra
|
||||
respuesta = Not AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta)
|
||||
Else
|
||||
respuesta = False
|
||||
|
||||
Reference in New Issue
Block a user