-- 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:
2025-02-01 12:28:32 -07:00
parent c9b18ae157
commit bd453a837e
2 changed files with 45 additions and 99 deletions

View File

@@ -1488,7 +1488,7 @@
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Factura de la nota de Credito</span>
<span class="caption-subject bold uppercase">Facturas para devolución</span>
</div>
<div class="actions">
<div class="btn-group">
@@ -1526,23 +1526,22 @@
<br />
<asp:GridView ID="GVDevolucion" runat="server" DataKeyNames="CveMovimientoDetalle,CveAlmacen,Total,PU,Cantidad,CvePS,CveUM,UM,CveClasificacion,Clasificacion,PS,CveTipoPS,PUExtranjero" ShowFooter="true" GridLines="None" AutoGenerateColumns="false" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%" CssClass="table table-striped table-hover Widthall">
<Columns>
<asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="60px">
<asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="60px" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("Cantidad", "{0:N2}")%>'></asp:Label>
<asp:Label runat="server" Text='<%# Eval("Cantidad", "{0:#,##0.####}")%>'></asp:Label>
</ItemTemplate>
<HeaderStyle CssClass="Titulos" />
</asp:TemplateField>
<asp:BoundField HeaderText="Unidad" DataField="UM" ItemStyle-Width="80px" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField ItemStyle-Width="400px" HeaderText="Producto o Servicio" DataField="PS" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Unidad" DataField="UM" ItemStyle-Width="80px" />
<asp:BoundField ItemStyle-Width="400px" HeaderText="Producto o Servicio" DataField="CodigoPS" />
<asp:TemplateField ItemStyle-Width="80px" HeaderText="P.U." ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label Text='<%# Eval("PU", "{0:#,##0.00####}")%>' runat="server"></asp:Label>
<asp:Label Text='<%# Eval("PU", "{0:#,##0.####}")%>' runat="server"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<label>Total</label>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="80px" HeaderText="Devolucion">
<asp:TemplateField ItemStyle-Width="80px" HeaderText="Devolución">
<ItemTemplate>
<asp:TextBox ID="TxtCantidad" Width="50" Mask="999,999.99" min="0" data-max='<%# Eval("Cantidad")%>' data-pu='<%# Eval("PU")%>' type="number" step="any" data-Devolucion="devrow" runat="server"></asp:TextBox>
</ItemTemplate>
@@ -1552,7 +1551,7 @@
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="80px" HeaderText="">
<ItemTemplate>
<asp:TextBox ID="TxtTotalDevolucion" CssClass="devTotal" runat="server" Text="" disabled></asp:TextBox>
<asp:TextBox ID="TxtTotalDevolucion" CssClass="devTotal TextBoxAsLabel" runat="server" Text="" disabled></asp:TextBox>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox CssClass="devTotaltotal" runat="server"></asp:TextBox>
@@ -1564,7 +1563,7 @@
<div class="row">
<div class="col-md-3 pull-right">
<asp:Button ID="BtnVinculaDevolucion" Text="Concluir vinculación de devolución" CssClass="btn btn-primary" OnClick="BtnVinculaDevolucion_Click" runat="server" />
<asp:Button ID="BtnVinculaDevolucion" Text="Concluir vinculación de devolución" CssClass="btn btn-success" OnClick="BtnVinculaDevolucion_Click" runat="server" />
</div>
</div>
@@ -2094,7 +2093,7 @@
<br />
<div class="row" align="right">
<div class="col-md-12 text-right text-small">
<asp:Button Text="Vinculación Completa" ID="BtnVincularOCCompleta" CssClass="btn btn-success" ClientIDMode="Static" runat="server" Visible="false" OnClick="BtnVincularOCCompleta_Click" ValidationGroup="GrpVincularOC" runat="server" />
<asp:Button Text="Vinculación Completa" ID="BtnVincularOCCompleta" CssClass="btn btn-success" ClientIDMode="Static" runat="server" Visible="false" OnClick="BtnVincularOCCompleta_Click" ValidationGroup="GrpVincularOC" />
</div>
</div>
</ContentTemplate>

View File

@@ -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