-- devoluciones, para que se registre la factura y la dev almacen. y que se muestre la liga de impresión de la salida
This commit is contained in:
@@ -1268,6 +1268,7 @@ Partial Class Compras_Compras
|
||||
EsGrupoDiaz = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False)
|
||||
TienePermisoKardex = If(UsuarioActual.TienePermisoPagina(224), True, False)
|
||||
LbTotalOC1.Attributes.Add(“readonly”, “readonly”)
|
||||
PermisoVinculacionImporteDiferente = True
|
||||
|
||||
CargaDatosAgregarPS()
|
||||
TieneAnticiposXML = False
|
||||
@@ -1438,15 +1439,17 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "NC" Then
|
||||
paneldevolucion.Visible = True
|
||||
'paneldevolucion.Visible = True
|
||||
Pnlalmaceninventarios.Visible = False
|
||||
cargaddldevoluciones(CveProveedor, TxtSubTotal2.Text.ToDouble)
|
||||
'cargaddldevoluciones(CveProveedor, TxtSubTotal2.Text.ToDouble)
|
||||
InicializaAplicaNCFact()
|
||||
DivReembolso.Visible = False
|
||||
RBLPago.Items(2).Enabled = False
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "DEV" Then
|
||||
paneldevolucion.Visible = True
|
||||
cargaddldevoluciones(CveProveedor, TxtSubTotal2.Text.ToDouble)
|
||||
InicializaAplicaNCFact()
|
||||
End If
|
||||
|
||||
@@ -2176,9 +2179,9 @@ Partial Class Compras_Compras
|
||||
|
||||
If TxtFolio.Text.Trim = "" Then TxtFolio.Enabled = True : TxtSerie.Enabled = True
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(242) Then
|
||||
PermisoVinculacionImporteDiferente = True
|
||||
End If
|
||||
'If UsuarioActual.TienePermisoProceso(242) Then
|
||||
' PermisoVinculacionImporteDiferente = True
|
||||
'End If
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(112) Then
|
||||
PermisoEdicionManual = True
|
||||
@@ -4374,7 +4377,6 @@ Partial Class Compras_Compras
|
||||
Protected Sub BtnGuardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnGuardar.Click
|
||||
|
||||
|
||||
|
||||
'------------------ INICIA VALIDACIONES ------------------
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(13, 83) AndAlso UsuarioActual.CveUsuario <> 1803 Then
|
||||
@@ -4571,7 +4573,7 @@ Partial Class Compras_Compras
|
||||
Alert("Favor de seleccionar un producto en la pestaña de almacen", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
ValidaFechaDeAlamacen()
|
||||
ValidaFechaDeAlmacen()
|
||||
Else
|
||||
'GvInv.Rows(x).FCDropDownList("ddlEAlmacen").SelectedValue.ToEntero 'Charlie
|
||||
'pestaña de almacen, si hay especificado una entrada por partida dealmacen, debe de existir el almacen.
|
||||
@@ -5120,7 +5122,7 @@ Partial Class Compras_Compras
|
||||
Devolucion = guardardevolucion(ObjInventario, ObjCompras.CveCompra, TxtSubTotal2.Text.ToDecimal, TxtFecha.Text.Trim.ToDate)
|
||||
|
||||
TotalRealDevolucion = Devolucion.Total
|
||||
|
||||
CveMovimientoInventario = Devolucion.CveMovimiento
|
||||
TieneError = Devolucion.TieneError
|
||||
End If
|
||||
Dim ErrorDetalles As Boolean = False
|
||||
@@ -7950,69 +7952,31 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function ValidaFechaDeAlamacen() As Boolean
|
||||
Private Function ValidaFechaDeAlmacen() As Boolean
|
||||
Dim respuesta As Boolean = False
|
||||
|
||||
|
||||
|
||||
Dim objInventario As New ClsInventarios
|
||||
Dim MovimientosError As Boolean = False
|
||||
|
||||
'Dim SB As New StringBuilder
|
||||
'Dim FechaCompra As DateTime = TxtFecha.Text.ToDate
|
||||
'FechaCompra
|
||||
Dim FechaMinima As DateTime = TxtFecha.Text.ToDate
|
||||
|
||||
|
||||
Dim CveAlmacenMov As Integer = ddlAlmacenAdd.SelectedValue.ToEntero
|
||||
Dim CveAlmacenMov As Integer = DdlAlmacenDevolucion.SelectedValue.ToEntero
|
||||
Dim DTAlamcen As New DataTable
|
||||
|
||||
|
||||
If DDLDevolucion.SelectedValue.ToEntero > 0 Then
|
||||
Dim objcompras As New ClsCompras()
|
||||
If objcompras.GetCompraDetalleAlmacen(UsuarioActual.CveEmpresa, DDLDevolucion.SelectedValue.ToEntero) Then
|
||||
GVDevolucion.DataSource = objcompras.DtResultados
|
||||
End If
|
||||
objcompras.Dispose()
|
||||
GVDevolucion.DataBind()
|
||||
|
||||
For Each GvRow As GridViewRow In GVDevolucion.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
CveAlmacenMov = GvRow.DataKey("CveAlmacen").ToString.ToEntero
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
Dim objInventario As New ClsInventarios
|
||||
If DtInv IsNot Nothing Then
|
||||
For Each Dr As DataRow In TmpDT.Rows
|
||||
|
||||
Dim CveTipoPS As Integer = Dr("CveTipoPS").ToString.ToEntero
|
||||
|
||||
If CveTipoPS = 2 Then
|
||||
If objInventario.GetValidaFechaAlmacen(CveEmpresa:=UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenMov, CvePS:=Dr("CvePS").ToString.ToEntero) Then
|
||||
|
||||
If objInventario.DtResultados IsNot Nothing AndAlso objInventario.DtResultados.Rows.Count > 0 Then
|
||||
Dim FechamoMovimiento As DateTime = objInventario.DtResultados(0)("FechaMovto").ToString.ToDate
|
||||
If FechamoMovimiento > FechaMinima Then
|
||||
FechaMinima = FechamoMovimiento
|
||||
End If
|
||||
For Each Dr As DataRow In TmpDT.FiltraParametros("CveTipoPS = 2").Rows
|
||||
If objInventario.GetValidaFechaAlmacen(CveEmpresa:=UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenMov, CvePS:=Dr("CvePS").ToString.ToEntero) Then
|
||||
|
||||
If objInventario.DtResultados IsNot Nothing AndAlso objInventario.DtResultados.Rows.Count > 0 Then
|
||||
Dim tFechaMovimiento As DateTime = objInventario.DtResultados(0)("FechaMovto").ToString.ToDate
|
||||
If tFechaMovimiento > FechaMinima Then
|
||||
FechaMinima = tFechaMovimiento
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
Next
|
||||
End If
|
||||
|
||||
objInventario.Dispose()
|
||||
|
||||
If FechaMinima > TxtFecha.Text.ToDate Then
|
||||
Alert($"Los productos tienen movientos, la fecha minima que se cambio la fecha de compra as {FechaMinima.ToString("dd/MM/yyyy HH:mm")}", TipoMensaje.MsgAdvertencia)
|
||||
Alert($"Los productos tienen movimientos, la fecha minima que se cambio la fecha de compra es {FechaMinima.ToString("dd/MM/yyyy HH:mm")}", TipoMensaje.MsgAdvertencia)
|
||||
'respuesta = False
|
||||
TxtFecha.Text = FechaMinima.ToString("dd/MM/yyyy")
|
||||
Else
|
||||
@@ -8020,7 +7984,6 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
|
||||
Return respuesta
|
||||
|
||||
End Function
|
||||
|
||||
Private Function GeneraStrinDoctosRelacionados() As String
|
||||
@@ -13869,6 +13832,7 @@ Partial Class Compras_Compras
|
||||
Dim subtotaldevolucion As Decimal = 0
|
||||
Dim realizadevolucion As Boolean = False
|
||||
Dim CveMovimientoEntrada As Integer = -1
|
||||
Dim CantidadRenglones As Integer = 0
|
||||
'Calculo los subtotales para comparar con la NC
|
||||
Dim Cantidad As Decimal
|
||||
|
||||
@@ -13877,6 +13841,7 @@ Partial Class Compras_Compras
|
||||
Cantidad = Dr.FCTextBox("TxtCantidad").Text.ToDecimal
|
||||
If Cantidad > 0 Then
|
||||
realizadevolucion = True
|
||||
CantidadRenglones += 1
|
||||
Dim PU As Decimal = If(DdlMoneda.SelectedValue.ToEntero <> 1, Dr.DataKey("PUExtranjero").ToString.ToDecimal, Dr.DataKey("PU").ToString.ToDecimal)
|
||||
subtotaldevolucion += PU * Cantidad
|
||||
End If
|
||||
@@ -13894,13 +13859,7 @@ Partial Class Compras_Compras
|
||||
Dim Acumulado As Decimal = 0
|
||||
Dim PU As Decimal
|
||||
Dim PUExtranjero As Decimal
|
||||
Dim CantidadRenglones As Integer = 0
|
||||
Dim ii As Integer = 0
|
||||
For Each Dr As GridViewRow In GVDevolucion.Rows
|
||||
If Dr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then
|
||||
CantidadRenglones += 1
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each Dr As GridViewRow In GVDevolucion.Rows
|
||||
If Dr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then
|
||||
@@ -13912,8 +13871,6 @@ Partial Class Compras_Compras
|
||||
Dim dif As Decimal = subtotal - Acumulado
|
||||
PU = (((Dr.FCTextBox("TxtCantidad").Text.ToDecimal * Dr.DataKey("PU").ToString.ToDecimal)) + dif) / Dr.FCTextBox("TxtCantidad").Text.ToDecimal
|
||||
End If
|
||||
|
||||
|
||||
If ObjInventario.GetExistenciasProducto(Dr.DataKey("CvePS").ToString.ToEntero, Dr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, CveAlmacen,
|
||||
FechaMovto:=TxtFecha.Text.ToDateTime.AddHours(NowADS().Hour).AddMinutes(NowADS().Minute).AddSeconds(NowADS().Second).ToString("yyyy/MM/dd HH:mm")) Then
|
||||
|
||||
@@ -13924,21 +13881,16 @@ Partial Class Compras_Compras
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr.FCTextBox("TxtCantidad").Text.ToDecimal, Dr.DataKey("CveUM").ToString.ToEntero, Dr.DataKey("CvePS").ToString.ToEntero, PU, -1, CveMovimientoDetalleEntrada:=Dr.DataKey("CveMovimientoDetalle").ToString.ToEntero, PUTC:=PUExtranjero) Then
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
@@ -13949,12 +13901,8 @@ Partial Class Compras_Compras
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa, -1) Then
|
||||
|
||||
For Each drow As DataRow In ObjInventario.DtResultados.Rows
|
||||
|
||||
|
||||
TotalSumaPU = TotalSumaPU + drow("Total").ToString.ToDecimal
|
||||
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
Return New MMensajeDevolucion() With
|
||||
@@ -13964,7 +13912,6 @@ Partial Class Compras_Compras
|
||||
.TieneError = ErrorMovInv,
|
||||
.Total = TotalSumaPU
|
||||
}
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub cargaddldevoluciones(CveProveedor As Integer, SubTotal As Double)
|
||||
@@ -14076,13 +14023,14 @@ Partial Class Compras_Compras
|
||||
Contador += 1
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim CveSubProyectoContrato As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenDevolucion.SelectedValue.ToEntero).FiltroPrimeroValor("CveSubProyecto")
|
||||
Dim SubProyecto As String = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyectoContrato.ToEntero).FiltroPrimeroValor("SubProyecto")
|
||||
'Iteramos el GridView de la OC
|
||||
For Each gvr As GridViewRow In GVDevolucion.Rows
|
||||
If gvr.FCTextBox("TxtCantidad").Text.ToDecimal > 0 Then
|
||||
|
||||
Dim CvePS As Integer = gvr.DataKey("CvePS").ToString.ToEntero
|
||||
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).Rows(0)
|
||||
'Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
|
||||
Dim Cantidad As Decimal = gvr.FCTextBox("TxtCantidad").Text.ToDecimal
|
||||
Dim CveUM As Integer = gvr.DataKey("CveUM").ToString.ToEntero
|
||||
@@ -14091,9 +14039,9 @@ Partial Class Compras_Compras
|
||||
Dim Clasificacion As String = gvr.DataKey("Clasificacion").ToString
|
||||
Dim PS As String = gvr.DataKey("PS").ToString
|
||||
Dim CveTipoPS As Integer = gvr.DataKey("CveTipoPS").ToString.ToEntero
|
||||
Dim CveSubProyectoContrato As String = "-1"
|
||||
|
||||
Dim CveProyecto As String = "-1"
|
||||
Dim SubProyecto As String = "Seleccione"
|
||||
|
||||
Dim Proyecto As String = "Seleccione"
|
||||
Dim Obs As String = ""
|
||||
Dim PU As Decimal = gvr.DataKey("PU").ToString.ToDecimal
|
||||
@@ -14111,11 +14059,8 @@ Partial Class Compras_Compras
|
||||
PU = ((PU * Cantidad) + dif) / Cantidad
|
||||
Total = Cantidad * PU
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
AddPS(Cantidad, CveUM, UM, CveClasificacion, Clasificacion, CvePS, PS, CveTipoPS, CveSubProyectoContrato, SubProyecto, Proyecto, CveProyecto, Obs, PU, Total, IVA, 0, 0, 0, 0, Descuento, -1, False)
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
@@ -14136,11 +14081,11 @@ Partial Class Compras_Compras
|
||||
LbAgregar.Visible = False
|
||||
UpPSS.Update()
|
||||
|
||||
CargaGvInv()
|
||||
'CargaGvInv()
|
||||
|
||||
GvPS.DataSource = TmpDT
|
||||
GvPS.DataBind()
|
||||
UpPS.Update()
|
||||
'GvPS.DataSource = TmpDT
|
||||
'GvPS.DataBind()
|
||||
'UpPS.Update()
|
||||
|
||||
CargaGVsAF()
|
||||
|
||||
@@ -16714,12 +16659,14 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
ImgAnticiposPendientes.Visible = False
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") Then
|
||||
paneldevolucion.Visible = True
|
||||
|
||||
Pnlalmaceninventarios.Visible = False
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("DEV") Then
|
||||
DivAlmacenDev.Visible = True
|
||||
paneldevolucion.Visible = True
|
||||
cargaddldevoluciones(CveProveedor, TxtSubTotal2.Text.ToDouble)
|
||||
End If
|
||||
cargaddldevoluciones(CveProveedor, TxtSubTotal2.Text.ToDouble)
|
||||
|
||||
InicializaAplicaNCFact()
|
||||
DivReembolso.Visible = False
|
||||
RBLPago.Items(2).Enabled = False
|
||||
|
||||
Reference in New Issue
Block a user