-- mejoras registro de compras E189, RNC

This commit is contained in:
2025-01-07 15:26:36 -07:00
parent 1c9c5e659d
commit dd0372a05a
2 changed files with 111 additions and 118 deletions

View File

@@ -672,7 +672,7 @@
<th style="width: 15px">#</th> <th style="width: 15px">#</th>
<th style="width: 45px">Cant</th> <th style="width: 45px">Cant</th>
<th style="width: 70px">Unidad</th> <th style="width: 70px">Unidad</th>
<th style="width: 299px">Clasificación <th style="width: 349px">Clasificación
<asp:HyperLink ID="HplAddClasificacion" data-toggle="tooltip" data-placement="top" NavigateUrl="/Ventas/CatClasificaciones.aspx" CssClass="btn btn-default btn-circle btn-xs " ToolTip="Agregar Clasificacion" runat="server"><i class="fa fa-plus" style="color:black" aria-hidden="true"></i></asp:HyperLink>&nbsp;&nbsp;&nbsp; <asp:HyperLink ID="HplAddClasificacion" data-toggle="tooltip" data-placement="top" NavigateUrl="/Ventas/CatClasificaciones.aspx" CssClass="btn btn-default btn-circle btn-xs " ToolTip="Agregar Clasificacion" runat="server"><i class="fa fa-plus" style="color:black" aria-hidden="true"></i></asp:HyperLink>&nbsp;&nbsp;&nbsp;
@@ -682,7 +682,7 @@
</span> </span>
<br /> <br />
Producto o Servicio<asp:HyperLink ID="HyperLink1" data-toggle="tooltip" CssClass="btn btn-default btn-circle btn-xs " data-placement="top" ToolTip="Agregar Producto o Servicio" NavigateUrl="/Ventas/CatPS.aspx" runat="server"><i class="fa fa-plus" style="color:black" aria-hidden="true"></i></asp:HyperLink></th> Producto o Servicio<asp:HyperLink ID="HyperLink1" data-toggle="tooltip" CssClass="btn btn-default btn-circle btn-xs " data-placement="top" ToolTip="Agregar Producto o Servicio" NavigateUrl="/Ventas/CatPS.aspx" runat="server"><i class="fa fa-plus" style="color:black" aria-hidden="true"></i></asp:HyperLink></th>
<th style="width: 350px">Observación</th> <th style="width: 300px">Observación</th>
<th style="width: 150px"> <th style="width: 150px">
<asp:Label ID="LitHProyecto" runat="server" Text=""></asp:Label> <asp:Label ID="LitHProyecto" runat="server" Text=""></asp:Label>
<asp:Label runat="server" ID="LblSubProyectoHeader" Text=""></asp:Label>&nbsp; <asp:Label runat="server" ID="LblSubProyectoHeader" Text=""></asp:Label>&nbsp;
@@ -772,7 +772,7 @@
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<%-- 3 --%> <%-- 3 --%>
<asp:TemplateField ItemStyle-VerticalAlign="Top" ItemStyle-Width="299"> <asp:TemplateField ItemStyle-VerticalAlign="Top" ItemStyle-Width="349">
<ItemTemplate> <ItemTemplate>
<div style="float: left; width: 100%;"> <div style="float: left; width: 100%;">
<span style="width: 100%; border-bottom: 1px solid gray;"> <span style="width: 100%; border-bottom: 1px solid gray;">
@@ -785,7 +785,7 @@
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<%-- 4 --%> <%-- 4 --%>
<asp:BoundField DataField="Obs" ItemStyle-Width="350px" /> <asp:BoundField DataField="Obs" ItemStyle-Width="300px" />
<%-- 5 --%> <%-- 5 --%>
<asp:TemplateField ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left"> <asp:TemplateField ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left">
<ItemTemplate> <ItemTemplate>

View File

@@ -1907,8 +1907,8 @@ Partial Class Compras_Compras
SubTotalConceptos = TmpDT.SUMD("Total").RoundSQL SubTotalConceptos = TmpDT.SUMD("Total").RoundSQL
If Not TmpDT.Columns.Contains("Amortizacion") Then TmpDT.Columns.Add("Amortizacion", GetType(Decimal)) If Not TmpDT.Columns.Contains("Amortizacion") Then TmpDT.Columns.Add("Amortizacion", GetType(Decimal))
If Not TmpDT.Columns.Contains("AplicaLote") Then TmpDT.Columns.Add("AplicaLote", GetType(Boolean)) If Not TmpDT.Columns.Contains("AplicaLote") Then TmpDT.Columns.Add(New DataColumn("AplicaLote", GetType(Boolean)) With {.DefaultValue = False})
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean)) If Not TmpDT.Columns.Contains("AplicaCaducidad") Then TmpDT.Columns.Add(New DataColumn("AplicaCaducidad", GetType(Boolean)) With {.DefaultValue = False})
If Not TmpDT.Columns.Contains("Lote") Then TmpDT.Columns.Add("Lote", GetType(String)) If Not TmpDT.Columns.Contains("Lote") Then TmpDT.Columns.Add("Lote", GetType(String))
If Not TmpDT.Columns.Contains("FechaCaducidad") Then TmpDT.Columns.Add("FechaCaducidad", GetType(Date)) If Not TmpDT.Columns.Contains("FechaCaducidad") Then TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
@@ -3154,36 +3154,34 @@ Partial Class Compras_Compras
'VINCULACIÓN OC - NUEVA DICIEMBRE 2015 'VINCULACIÓN OC - NUEVA DICIEMBRE 2015
If dr("OCVinculada").ToString() <> "" Then If dr("OCVinculada").ToString() <> "" Then
Dim DtOCs As New DataTable
Dim OCS As String = "", CveOCS As String = "" Dim OCS As String = "", CveOCS As String = ""
Dim DtOCs As New DataTable
DtOCs.Columns.Add("FolioOC", GetType(Integer)) DtOCs.Columns.Add("SerieFolioOC", GetType(String))
DtOCs.Columns.Add("CveOrdenCompra", GetType(Integer)) DtOCs.Columns.Add("CveOrdenCompra", GetType(Integer))
DtOCs.Columns.Add("Fecha", GetType(Date))
DtOCs.Columns.Add("Descripcion", GetType(String))
For Each drt As DataRow In TmpDT.Rows For Each drt As DataRow In TmpDT.FiltraParametros("", "", {"SerieFolioOC", "CveOrdenCompra"}).Rows
If drt("FolioOC").ToString <> "" Then If drt("SerieFolioOC").ToString <> "" Then
Dim DrOC As DataRow = DtOCs.NewRow Dim DrOC As DataRow = DtOCs.NewRow
DrOC("FolioOC") = drt("FolioOC").ToString DrOC("SerieFolioOC") = drt("SerieFolioOC").ToString
DrOC("CveOrdenCompra") = drt("CveOrdenCompra").ToString DrOC("CveOrdenCompra") = drt("CveOrdenCompra").ToString
DtOCs.Rows.Add(DrOC) DtOCs.Rows.Add(DrOC)
End If End If
Next Next
DtOCs = DtOCs.FiltraParametros("", "", {"FolioOC", "CveOrdenCompra"})
DtOCs.Columns.Add("Fecha", GetType(Date))
DtOCs.Columns.Add("Descripcion", GetType(String))
If DtOCs.Rows.Count > 0 Then If DtOCs.Rows.Count > 0 Then
For Each drt As DataRow In DtOCs.Rows For Each drt As DataRow In DtOCs.Rows
If ObjOC.GetOrdenesCompraRep("OC", -1, -1, -1, -1, MinFecha, MaxFecha, drt("CveOrdenCompra").ToString.ToEntero, CveProveedor, -1, -1, -1, UsuarioActual.CveEmpresa, -1) Then OCS += If(OCS <> "", String.Format(",{0}", drt("SerieFolioOC").ToString), drt("SerieFolioOC").ToString)
If ObjOC.DtResultados.Rows.Count = 1 Then CveOCS += If(CveOCS <> "", String.Format(",{0}", drt("CveOrdenCompra").ToString), drt("CveOrdenCompra").ToString)
OCS += If(OCS <> "", String.Format(",{0}", drt("FolioOC").ToString), drt("FolioOC").ToString) 'If ObjOC.GetOrdenesCompraRep("OC", -1, -1, -1, -1, MinFecha, MaxFecha, drt("CveOrdenCompra").ToString.ToEntero, CveProveedor, -1, -1, -1, UsuarioActual.CveEmpresa, -1) Then
CveOCS += If(CveOCS <> "", String.Format(",{0}", drt("CveOrdenCompra").ToString), drt("CveOrdenCompra").ToString) ' If ObjOC.DtResultados.Rows.Count = 1 Then
drt("Fecha") = ObjOC.DtResultados.FiltroPrimeroValor("FechaIng") ' OCS += If(OCS <> "", String.Format(",{0}", drt("FolioOC").ToString), drt("FolioOC").ToString)
drt("Descripcion") = ObjOC.DtResultados.FiltroPrimeroValor("Descripcion") ' CveOCS += If(CveOCS <> "", String.Format(",{0}", drt("CveOrdenCompra").ToString), drt("CveOrdenCompra").ToString)
End If ' drt("Fecha") = ObjOC.DtResultados.FiltroPrimeroValor("FechaIng")
End If ' drt("Descripcion") = ObjOC.DtResultados.FiltroPrimeroValor("Descripcion")
' End If
'End If
Next Next
End If End If
@@ -4301,7 +4299,7 @@ Partial Class Compras_Compras
Dim AnioFactura As Integer = TxtFecha.Text.ToDate.Year Dim AnioFactura As Integer = TxtFecha.Text.ToDate.Year
Dim Fecha28Dic As Date = New Date(2024, 12, 28) Dim Fecha28Dic As Date = New Date(2024, 12, 28)
If NowADS() >= Fecha28Dic Then If NowADS() >= Fecha28Dic AndAlso TxtFecha.Text.ToDate.Year < 2025 Then
Alert("A partir del 28 de diciembre de 2024 no se pueden registrar facturas de 2024.", TipoMensaje.MsgAdvertencia) Alert("A partir del 28 de diciembre de 2024 no se pueden registrar facturas de 2024.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
@@ -7752,8 +7750,8 @@ Partial Class Compras_Compras
If CveMovimientoInventario > 0 Then If CveMovimientoInventario > 0 Then
Dim TempParametros As String = Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoInventario)) Dim TempParametros As String = Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoInventario))
Msg.AppendFormat("</br><a class=""Texto"" target='_blank' href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"">Ver Movimiento de Almacen</a>", CveMovimientoInventario) Msg.AppendFormat("</br><a class=""Texto"" target='_blank' href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"">Ver Movimiento de Almacen</a>&nbsp;&nbsp;", CveMovimientoInventario)
Msg.AppendFormat("</br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Entrada Almacen</a>", TempParametros) Msg.AppendFormat("<a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}""><i class='fa fa-file-pdf-o' aria-hidden='true'></i> Imprimir</a>", TempParametros)
End If End If
If UsuarioActual.Empresa.TipoContabilidad = 2 Then If UsuarioActual.Empresa.TipoContabilidad = 2 Then
@@ -11087,7 +11085,7 @@ Partial Class Compras_Compras
If OC.GetOC(CveOC, UsuarioActual.CveEmpresa) Then If OC.GetOC(CveOC, UsuarioActual.CveEmpresa) Then
TxtOC.Text = OC.Folio.ToString TxtOC.Text = OC.SerieFolio
'RegistraScript(String.Format("$get('TxtOC').value = '{0}';tb_remove;", OC.Folio)) 'RegistraScript(String.Format("$get('TxtOC').value = '{0}';tb_remove;", OC.Folio))
RegistraScript("tb_remove();") RegistraScript("tb_remove();")
@@ -11141,29 +11139,26 @@ Partial Class Compras_Compras
#Region " ALMACEN " #Region " ALMACEN "
Private Sub CargaGvInv() Private Sub CargaGvInv()
If Not TmpDT.Columns.Contains("UUIDRow") Then TmpDT.Columns.Add("UUIDRow", GetType(String))
If Not TmpDT.Columns.Contains("UUIDRow") Then
TmpDT.Columns.Add("UUIDRow", GetType(String))
End If
For Each dRow As DataRow In TmpDT.Rows For Each dRow As DataRow In TmpDT.Rows
If dRow("UUIDRow").ToString.Trim = "" Then If dRow("UUIDRow").ToString.Trim = "" Then
dRow("UUIDRow") = Guid.NewGuid().ToString() dRow("UUIDRow") = Guid.NewGuid().ToString()
End If End If
Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero 'Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
dRow("AplicaLote") = False 'dRow("AplicaLote") = False
dRow("AplicaCaducidad") = False 'dRow("AplicaCaducidad") = False
If CvePS > 0 Then 'If CvePS > 0 Then
Dim drPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimero($"CvePS={CvePS}") ' Dim drPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If drPS IsNot Nothing Then ' If drPS IsNot Nothing Then
dRow("AplicaLote") = If(drPS("AplicaLote").ToString = "", False, Boolean.Parse(drPS("AplicaLote").ToString)) ' dRow("AplicaLote") = If(drPS("AplicaLote").ToString = "", False, Boolean.Parse(drPS("AplicaLote").ToString))
dRow("AplicaCaducidad") = If(drPS("AplicaCaducidad").ToString = "", False, Boolean.Parse(drPS("AplicaCaducidad").ToString)) ' dRow("AplicaCaducidad") = If(drPS("AplicaCaducidad").ToString = "", False, Boolean.Parse(drPS("AplicaCaducidad").ToString))
'Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaCaducidad", $"CvePS={CvePS}")) ' 'Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaCaducidad", $"CvePS={CvePS}"))
End If ' End If
End If 'End If
Next Next
TmpDT.AcceptChanges() TmpDT.AcceptChanges()
@@ -11175,16 +11170,14 @@ Partial Class Compras_Compras
DtInv = TmpDT.FiltraParametros(String.Format("CveTipoPS = 2")).Copy DtInv = TmpDT.FiltraParametros(String.Format("CveTipoPS = 2")).Copy
End If End If
For Each dRow As DataRow In DtInv.Rows For Each dRow As DataRow In DtInv.Rows
Dim AplicaLote As Boolean = False
'Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero Boolean.TryParse(dRow("AplicaLote").ToString, AplicaLote)
Dim AplicaLote As Boolean = Boolean.Parse(dRow("AplicaLote").ToString) 'Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaLote", $"CvePS={CvePS}")) Dim AplicaCaducidad As Boolean = False
Dim AplicaCaducidad As Boolean = Boolean.Parse(dRow("AplicaCaducidad").ToString) 'Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaCaducidad", $"CvePS={CvePS}")) Boolean.TryParse(dRow("AplicaCaducidad").ToString, AplicaCaducidad)
GvInv.Columns(7).Visible = AplicaLote GvInv.Columns(7).Visible = AplicaLote
GvInv.Columns(8).Visible = AplicaCaducidad GvInv.Columns(8).Visible = AplicaCaducidad
Next Next
GvInv.DataSource = DtInv GvInv.DataSource = DtInv
@@ -11254,25 +11247,10 @@ Partial Class Compras_Compras
Protected Sub GVINV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvInv.RowDataBound Protected Sub GVINV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvInv.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
Dim AplicaLote As Boolean = e.Row.DBCampo("AplicaLote").ToBool
Dim AplicaCaducidad As Boolean = e.Row.DBCampo("AplicaCaducidad").ToBool
Dim CvePS As Integer = e.Row.DataKey("CvePS").ToEntero If AplicaLote Then e.Row.FCTextBox("TxtLote").Visible = True
Dim AplicaLote As Boolean = False
Dim AplicaCaducidad As Boolean = False
If CvePS > 0 Then
Dim drPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimero($"CvePS={CvePS}")
If drPS IsNot Nothing Then
AplicaLote = If(drPS("AplicaLote").ToString = "", False, Boolean.Parse(drPS("AplicaLote").ToString)) 'Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaLote", $"CvePS={CvePS}"))
AplicaCaducidad = If(drPS("AplicaCaducidad").ToString = "", False, Boolean.Parse(drPS("AplicaCaducidad").ToString)) 'Boolean.Parse(GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("AplicaCaducidad", $"CvePS={CvePS}"))
End If
End If
If AplicaLote Then
e.Row.FCTextBox("TxtLote").Visible = True
End If
If AplicaCaducidad Then If AplicaCaducidad Then
Dim DvFechaCaducidad As HtmlGenericControl = TryCast(e.Row.FindControl("DvFechaCaducidad"), HtmlGenericControl) Dim DvFechaCaducidad As HtmlGenericControl = TryCast(e.Row.FindControl("DvFechaCaducidad"), HtmlGenericControl)
DvFechaCaducidad.Visible = True DvFechaCaducidad.Visible = True
@@ -11283,6 +11261,13 @@ Partial Class Compras_Compras
Dim StrTipo As String = "CveTipoAlmacen IN (1,2,7,14,19)" Dim StrTipo As String = "CveTipoAlmacen IN (1,2,7,14,19)"
If DdlTipoCompra.SelectedValue.Contiene("9", "12") Then StrTipo = "CveTipoAlmacen IN (21)" If DdlTipoCompra.SelectedValue.Contiene("9", "12") Then StrTipo = "CveTipoAlmacen IN (21)"
If EsDevolucionApoyoLogistico Then StrTipo = "CveTipoAlmacen = 27" If EsDevolucionApoyoLogistico Then StrTipo = "CveTipoAlmacen = 27"
If CompraEstaVinculadaOC Then
'filtrar solo los almacenes de las sucursales especficiadsa en el tmpdt. para encasillarlo
Dim dttt As DataTable = TmpDT.FiltraParametros("", DistinctColumns:={"CveSubProyecto"})
If dttt IsNot Nothing AndAlso dttt.Rows.Count > 0 Then
StrTipo = StrTipo & " AND CveSubProyecto IN (" & DttoString(dttt, "CveSubProyecto") & ") "
End If
End If
e.Row.FCDropDownList("ddlEAlmacen").DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros(StrTipo) e.Row.FCDropDownList("ddlEAlmacen").DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros(StrTipo)
e.Row.FCDropDownList("ddlEAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) e.Row.FCDropDownList("ddlEAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1"))
@@ -11303,7 +11288,6 @@ Partial Class Compras_Compras
e.Row.FCTextBox("TbCantidad").Enabled = True e.Row.FCTextBox("TbCantidad").Enabled = True
e.Row.FCTextBox("TbCantidad").Attributes.Add("onblur", String.Format("ValidarCantidad(this,{0})", If(e.Row.DBCampo("CantidadF").ToString.ToDecimal > e.Row.DBCampo("Cantidad").ToString.ToDecimal, e.Row.DBCampo("Cantidad"), e.Row.DBCampo("CantidadF")))) e.Row.FCTextBox("TbCantidad").Attributes.Add("onblur", String.Format("ValidarCantidad(this,{0})", If(e.Row.DBCampo("CantidadF").ToString.ToDecimal > e.Row.DBCampo("Cantidad").ToString.ToDecimal, e.Row.DBCampo("Cantidad"), e.Row.DBCampo("CantidadF"))))
e.Row.FCTextBox("TbCantidad").Text = If(e.Row.DBCampo("CantidadF").ToString.ToDecimal > e.Row.DBCampo("Cantidad").ToString.ToDecimal, e.Row.DBCampo("Cantidad"), e.Row.DBCampo("CantidadF")) e.Row.FCTextBox("TbCantidad").Text = If(e.Row.DBCampo("CantidadF").ToString.ToDecimal > e.Row.DBCampo("Cantidad").ToString.ToDecimal, e.Row.DBCampo("Cantidad"), e.Row.DBCampo("CantidadF"))
End If End If
'SIEMPRE ENABLED FALSE 'SIEMPRE ENABLED FALSE
@@ -11336,10 +11320,14 @@ Partial Class Compras_Compras
'que no sea recepcion alamcen adelantado. DdlOCVinculaInv 'que no sea recepcion alamcen adelantado. DdlOCVinculaInv
If (UsuarioActual.Empresa.Funcionalidad(567) = "1" OrElse UsuarioActual.TienePermisoProceso(121)) AndAlso DdlOCVinculaInv.SelectedValue <> "176" Then If (UsuarioActual.Empresa.Funcionalidad(567) = "1" OrElse UsuarioActual.TienePermisoProceso(121)) AndAlso DdlOCVinculaInv.SelectedValue <> "176" Then
If e.Row.FCDropDownList("ddlEAlmacen").Items.Count > 1 Then If e.Row.FCDropDownList("ddlEAlmacen").Items.Count > 1 Then
e.Row.FCDropDownList("ddlEAlmacen").SelectedIndex = 1 If UsuarioActual.CveAlmacen > 0 Then
e.Row.FCDropDownList("ddlEAlmacen").SelectedValueExist(UsuarioActual.CveAlmacen)
Else
e.Row.FCDropDownList("ddlEAlmacen").SelectedIndex = 1
End If
e.Row.FCCheckBox("cbInv").Checked = True e.Row.FCCheckBox("cbInv").Checked = True
ddlAlmacenConsignacion_SelectedIndexChanged(e.Row.FCDropDownList("ddlEAlmacen"), Nothing) 'ddlAlmacenConsignacion_SelectedIndexChanged(e.Row.FCDropDownList("ddlEAlmacen"), Nothing)
CambiaTotalDevengar(Nothing, Nothing) ' CambiaTotalDevengar(Nothing, Nothing)
End If End If
End If End If
If e.Row.DBCampo("Consec").ToEntero = 0 Then e.Row.BackColor = Drawing.Color.PaleGreen If e.Row.DBCampo("Consec").ToEntero = 0 Then e.Row.BackColor = Drawing.Color.PaleGreen
@@ -11388,17 +11376,6 @@ Partial Class Compras_Compras
End If End If
End If End If
If UsuarioActual.Empresa.Funcionalidad(574).ToEntero = 1 Then
'e.Row.Cells(4).Text = e.Row.DataKey("PUProtoPago").ToDecimal.ToString("###,###,###.00")
'If PorcentajeProntoPago > 0 Then
' e.Row.Cells(4).Text = e.Row.DataKey("PUProtoPago").ToDecimal - ()
'End If
End If
''VALIDA UNIDAD DE MEDIDA ''VALIDA UNIDAD DE MEDIDA
'If e.Row.DBCampo("CvePS").ToString.ToEntero > 0 Then 'If e.Row.DBCampo("CvePS").ToString.ToEntero > 0 Then
@@ -11453,6 +11430,14 @@ Partial Class Compras_Compras
If DdlTipoCompra.SelectedValue.ToEntero = 10 Then StrAlmacenes = $"Modalidad = 0" If DdlTipoCompra.SelectedValue.ToEntero = 10 Then StrAlmacenes = $"Modalidad = 0"
If EsDevolucionApoyoLogistico Then StrAlmacenes = " CveTipoAlmacen = 27" If EsDevolucionApoyoLogistico Then StrAlmacenes = " CveTipoAlmacen = 27"
If CompraEstaVinculadaOC Then
'filtrar solo los almacenes de las sucursales especficiadsa en el tmpdt. para encasillarlo
Dim dttt As DataTable = TmpDT.FiltraParametros("", DistinctColumns:={"CveSubProyecto"})
If dttt IsNot Nothing AndAlso dttt.Rows.Count > 0 Then
StrAlmacenes = StrAlmacenes & " AND CveSubProyecto IN (" & DttoString(dttt, "CveSubProyecto") & ") "
End If
End If
e.Row.FCDropDownList("ddlAlmacen").DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros(StrAlmacenes) e.Row.FCDropDownList("ddlAlmacen").DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros(StrAlmacenes)
e.Row.FCDropDownList("ddlAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) e.Row.FCDropDownList("ddlAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1"))
e.Row.FCDropDownList("ddlAlmacen").DataBind() e.Row.FCDropDownList("ddlAlmacen").DataBind()
@@ -11469,7 +11454,11 @@ Partial Class Compras_Compras
'que no sea recepcion almacen adelantado. DdlOCVinculaInv 'que no sea recepcion almacen adelantado. DdlOCVinculaInv
If (UsuarioActual.Empresa.Funcionalidad(567) = "1" OrElse UsuarioActual.TienePermisoProceso(121)) AndAlso DdlOCVinculaInv.SelectedValue <> "176" Then If (UsuarioActual.Empresa.Funcionalidad(567) = "1" OrElse UsuarioActual.TienePermisoProceso(121)) AndAlso DdlOCVinculaInv.SelectedValue <> "176" Then
If e.Row.FCDropDownList("ddlAlmacen").Items.Count > 1 Then If e.Row.FCDropDownList("ddlAlmacen").Items.Count > 1 Then
e.Row.FCDropDownList("ddlAlmacen").SelectedIndex = 1 If UsuarioActual.CveAlmacen > 0 Then
e.Row.FCDropDownList("ddlAlmacen").SelectedValueExist(UsuarioActual.CveAlmacen)
Else
e.Row.FCDropDownList("ddlAlmacen").SelectedIndex = 1
End If
e.Row.FCCheckBox("cbAll").Checked = True e.Row.FCCheckBox("cbAll").Checked = True
End If End If
End If End If
@@ -11477,6 +11466,13 @@ Partial Class Compras_Compras
End Sub End Sub
Public Function DttoString(dtt As DataTable, NombreColumna As String) As String
Return String.Join(", ", dtt.AsEnumerable().
Where(Function(row) Not row.IsNull(NombreColumna)).
Select(Function(row) row(NombreColumna).ToString()))
End Function
Protected Sub ddlAlmacen_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Protected Sub ddlAlmacen_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim Ddl As DropDownList = CType(sender, DropDownList) Dim Ddl As DropDownList = CType(sender, DropDownList)
@@ -12122,7 +12118,7 @@ Partial Class Compras_Compras
End Sub End Sub
Protected Sub CambiaTotalDevengar(sender As Object, e As EventArgs) Protected Sub CambiaTotalDevengar(sender As Object, e As EventArgs)
CalculaTotalPorDevengar() If UsuarioActual.Empresa.UsaAC Then CalculaTotalPorDevengar()
End Sub End Sub
#End Region #End Region
@@ -15484,6 +15480,8 @@ Partial Class Compras_Compras
AjusteProntoPagoPorcentajeIVA = TmpDT.MAX("IVAPorcentaje").ToDecimal AjusteProntoPagoPorcentajeIVA = TmpDT.MAX("IVAPorcentaje").ToDecimal
AjusteProntoPagoConIVA = (ImporteCompraConIVA - ImporteOCConIVA) AjusteProntoPagoConIVA = (ImporteCompraConIVA - ImporteOCConIVA)
AjusteProntoPagoSinIVA = (ImporteCompraSinIVA - ImporteOCSinIVA) AjusteProntoPagoSinIVA = (ImporteCompraSinIVA - ImporteOCSinIVA)
If Math.Abs(AjusteProntoPagoConIVA) < 1 Then AjusteProntoPagoConIVA = 0 Else ImporteRNC += AjusteProntoPagoConIVA
If Math.Abs(AjusteProntoPagoSinIVA) < 1 Then AjusteProntoPagoSinIVA = 0
If ConfirmaVinculacionOC_RNC(AjusteProntoPagoPorcentajeIVA) Then If ConfirmaVinculacionOC_RNC(AjusteProntoPagoPorcentajeIVA) Then
Vinculacion() Vinculacion()
@@ -15505,9 +15503,9 @@ Partial Class Compras_Compras
For Each gvr As GridViewRow In GvOC1.Rows For Each gvr As GridViewRow In GvOC1.Rows
If gvr.DataKey("IVAPorcentaje").ToDecimal > 0 Then If gvr.DataKey("IVAPorcentaje").ToDecimal > 0 Then
ImporteOCConIVA = ImporteOCConIVA + (gvr.FCTextBox("TxtCantidad").Text.ToDecimal * gvr.FCTextBox("TxtPU").Text.ToDecimal) ImporteOCConIVA = ImporteOCConIVA + (gvr.FCTextBox("TxtCantidad").Text.ToDecimal * gvr.FCTextBox("TxtPU").Text.ToDecimal) '- gvr.DataKey("Descuento").ToDecimal
Else Else
ImporteOCSinIVA = ImporteOCSinIVA + (gvr.FCTextBox("TxtCantidad").Text.ToDecimal * gvr.FCTextBox("TxtPU").Text.ToDecimal) ImporteOCSinIVA = ImporteOCSinIVA + (gvr.FCTextBox("TxtCantidad").Text.ToDecimal * gvr.FCTextBox("TxtPU").Text.ToDecimal) '- gvr.DataKey("Descuento").ToDecimal
End If End If
Next Next
@@ -15534,7 +15532,6 @@ Partial Class Compras_Compras
End Sub End Sub
Private Sub Vinculacion(Optional VinculacionCompleta As Boolean = False) Private Sub Vinculacion(Optional VinculacionCompleta As Boolean = False)
'SI PUEDE RECIBIR POR OC Y COMPRA 'SI PUEDE RECIBIR POR OC Y COMPRA
If UsuarioActual.CveEmpresa = 119 AndAlso UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 AndAlso CveTipoConcepto = 1 Then If UsuarioActual.CveEmpresa = 119 AndAlso UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 AndAlso CveTipoConcepto = 1 Then
@@ -15596,6 +15593,7 @@ Partial Class Compras_Compras
Dim PU As Decimal = gvr.FCTextBox("TxtPU").Text.ToDecimal Dim PU As Decimal = gvr.FCTextBox("TxtPU").Text.ToDecimal
Dim tDescuento As Decimal = dr("Descuento").ToString.ToDecimal Dim tDescuento As Decimal = dr("Descuento").ToString.ToDecimal
Dim Total As Decimal = If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, Math.Round((gvr.FCTextBox("TxtCantidad").Text.ToDecimal * gvr.FCTextBox("TxtPU").Text.ToDecimal) - (TxtDescuento.Text.ToDouble / TotalRows).ToDecimal, 2), Cantidad * PU - tDescuento) 'gvr.FCTextBox("TxtTotalOC1").Text.ToDecimal) Dim Total As Decimal = If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, Math.Round((gvr.FCTextBox("TxtCantidad").Text.ToDecimal * gvr.FCTextBox("TxtPU").Text.ToDecimal) - (TxtDescuento.Text.ToDouble / TotalRows).ToDecimal, 2), Cantidad * PU - tDescuento) 'gvr.FCTextBox("TxtTotalOC1").Text.ToDecimal)
'Dim Total As Decimal = gvr.FCTextBox("TxtTotalOC1").Text.ToDecimal 'Dim Total As Decimal = gvr.FCTextBox("TxtTotalOC1").Text.ToDecimal
'Dim IVA As Decimal = gvr.FCHiddenField("HdnOC1IVA").Value.ToDecimal 'Dim IVA As Decimal = gvr.FCHiddenField("HdnOC1IVA").Value.ToDecimal
'Dim RetIVA As Double = gvr.FCHiddenField("HdnOC1RetIVA").Value.ToDecimal 'Dim RetIVA As Double = gvr.FCHiddenField("HdnOC1RetIVA").Value.ToDecimal
@@ -15627,6 +15625,12 @@ Partial Class Compras_Compras
End If End If
End If End If
If UsuarioActual.Empresa.Funcionalidad(574) = "1" Then
PU = ((PU * Cantidad) - tDescuento) / Cantidad
Descuentos = 0
Descuento = 0
End If
AddPS(Cantidad, CveUM, UM, CveClasificacion, Clasificacion, CvePS, PS, CveTipoPS, CveSubProyectoContrato, SubProyecto, Proyecto, CveProyecto, Obs, PU, Total, IVA, RetIVA, RetISR, IEPSPS, IEPSPSIVA, Descuento, CveOrdenCompraDetalle, False, AddPS(Cantidad, CveUM, UM, CveClasificacion, Clasificacion, CvePS, PS, CveTipoPS, CveSubProyectoContrato, SubProyecto, Proyecto, CveProyecto, Obs, PU, Total, IVA, RetIVA, RetISR, IEPSPS, IEPSPSIVA, Descuento, CveOrdenCompraDetalle, False,
CantidadF:=CantidadF, EntregaDirecta:=EntregaDirecta, CveSATPS:=CveSATPS, CveTipoGasto:=CveTipoGasto, TipoGasto:=TipoGasto, CveContratoDetalle:=CveContratoDetalle, CveCultivoCuadroDetalle:=CveCultivoCuadroDetalle, CveSATPSActualizado:=CveSATPSActualizado) CantidadF:=CantidadF, EntregaDirecta:=EntregaDirecta, CveSATPS:=CveSATPS, CveTipoGasto:=CveTipoGasto, TipoGasto:=TipoGasto, CveContratoDetalle:=CveContratoDetalle, CveCultivoCuadroDetalle:=CveCultivoCuadroDetalle, CveSATPSActualizado:=CveSATPSActualizado)
@@ -15640,7 +15644,7 @@ Partial Class Compras_Compras
TmpDT.Rows(Index)("CveClasificacionOG") = dr("CveClasificacionOG").ToString.ToEntero TmpDT.Rows(Index)("CveClasificacionOG") = dr("CveClasificacionOG").ToString.ToEntero
'TmpDT.Rows(Index)("PSCodigo") = DtTemporalXML.Rows(IndexTmpOriginal)("PSCodigo") 'TmpDT.Rows(Index)("PSCodigo") = DtTemporalXML.Rows(IndexTmpOriginal)("PSCodigo")
TmpDT.Rows(Index)("PSCodigo") = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("PSCodigo", "").ToString TmpDT.Rows(Index)("PSCodigo") = dr("PS").ToString ' GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimeroValor("PSCodigo", "").ToString
Dim CveAF As String = dr("CveActivoFijo").ToString Dim CveAF As String = dr("CveActivoFijo").ToString
If CveAF <> "" AndAlso CveAF <> "-1" Then If CveAF <> "" AndAlso CveAF <> "-1" Then
@@ -15657,7 +15661,7 @@ Partial Class Compras_Compras
IndexTmpOriginal += 1 IndexTmpOriginal += 1
Next Next
If UsuarioActual.Empresa.Funcionalidad(574) = "1" AndAlso (AjusteProntoPagoConIVA > 0 Or AjusteProntoPagoSinIVA > 0) Then If UsuarioActual.Empresa.Funcionalidad(574) = "1" AndAlso (ImporteRNC > 0 Or AjusteProntoPagoSinIVA > 0) Then
Dim CvePS_RNC As Integer = UsuarioActual.Empresa.Funcionalidad(580).ToEntero Dim CvePS_RNC As Integer = UsuarioActual.Empresa.Funcionalidad(580).ToEntero
If CvePS_RNC = 0 Then If CvePS_RNC = 0 Then
@@ -15689,8 +15693,8 @@ Partial Class Compras_Compras
Dim UM As String = PSRow("UnidadMedida").ToString Dim UM As String = PSRow("UnidadMedida").ToString
If AjusteProntoPagoConIVA > 0 Then If ImporteRNC > 0 Then
AddPS(1, CveUM, UM, CveClasificacion, Clasificacion, CvePS_RNC, PS, 1, CveSubProyectoPrincipal.ToString, SubProyecto, "", "-1", "", AjusteProntoPagoConIVA, AjusteProntoPagoConIVA, AjusteProntoPagoPorcentajeIVA, 0, 0, 0, 0, 0) AddPS(1, CveUM, UM, CveClasificacion, Clasificacion, CvePS_RNC, PS, 1, CveSubProyectoPrincipal.ToString, SubProyecto, "", "-1", "", ImporteRNC, ImporteRNC, AjusteProntoPagoPorcentajeIVA, 0, 0, 0, 0, 0)
End If End If
If AjusteProntoPagoSinIVA > 0 Then If AjusteProntoPagoSinIVA > 0 Then
@@ -15698,14 +15702,13 @@ Partial Class Compras_Compras
End If End If
End If End If
CompraEstaVinculadaOC = True
AddPS2(False) 'AddPS2(False)
'AJUSTE DE REDONDEO O DIFERENCIA PERMITIDA DE IMPORTE 'AJUSTE DE REDONDEO O DIFERENCIA PERMITIDA DE IMPORTE
AjustaImporteUltimoConcepto((If(TieneAmortizacion, TmpDT.SUMD("ImporteSinImpuestos"), TxtSubTotal2.Text.ToDouble) + TxtOtrosImpuestos.Text.ToDouble).ToDecimal - If(TieneAmortizacion, TmpDT.SUM("ImporteSinImpuestos").ToString.ToDecimal, TmpDT.SUM("Total").ToString.ToDecimal)) AjustaImporteUltimoConcepto((If(TieneAmortizacion, TmpDT.SUMD("ImporteSinImpuestos"), TxtSubTotal2.Text.ToDouble) + TxtOtrosImpuestos.Text.ToDouble).ToDecimal - If(TieneAmortizacion, TmpDT.SUM("ImporteSinImpuestos").ToString.ToDecimal, TmpDT.SUM("Total").ToString.ToDecimal))
'AjustaImporteUltimoConcepto(TxtSubTotal2.Text.ToDecimal + TxtOtrosImpuestos.Text.ToDecimal - (TmpDT.SUM("Total").ToString.ToDecimal)) 'AjustaImporteUltimoConcepto(TxtSubTotal2.Text.ToDecimal + TxtOtrosImpuestos.Text.ToDecimal - (TmpDT.SUM("Total").ToString.ToDecimal))
BtnGuardar.Enabled = True BtnGuardar.Enabled = True
If Not CierrePeriodo Then If Not CierrePeriodo Then
BtnGuardar.Visible = True BtnGuardar.Visible = True
@@ -15804,9 +15807,7 @@ Partial Class Compras_Compras
End If End If
CalculaTotales() CalculaTotales()
CompraEstaVinculadaOC = True
End Sub End Sub
@@ -16917,8 +16918,9 @@ Partial Class Compras_Compras
Private Sub CargaSerie() Private Sub CargaSerie()
Dim AplicaCaducidad As Boolean = False Dim AplicaCaducidad As Boolean = False
If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).Rows(0) IsNot Nothing Then Dim drr As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltroPrimero("")
AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).Rows(0)("AplicaCaducidad").ToString = "True", True, False) If drr IsNot Nothing Then
AplicaCaducidad = If(drr("AplicaCaducidad").ToString = "True", True, False)
End If End If
If AplicaCaducidad Then If AplicaCaducidad Then
@@ -16969,7 +16971,7 @@ Partial Class Compras_Compras
Protected Sub BtnAgregarPS_Click(sender As Object, e As EventArgs) Protected Sub BtnAgregarPS_Click(sender As Object, e As EventArgs)
Dim SerieLote As String = TxtSerieLote.Text.Replace(" ", String.Empty) Dim SerieLote As String = TxtSerieLote.Text.Replace(" ", String.Empty)
Dim AplicaCaducidad As Boolean = False Dim AplicaCaducidad As Boolean = False
Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltroPrimero("", "PS") Dim dr As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltroPrimero("", "PS")
If dr IsNot Nothing Then AplicaCaducidad = dr("AplicaCaducidad").ToString = "True" If dr IsNot Nothing Then AplicaCaducidad = dr("AplicaCaducidad").ToString = "True"
'VALIDA QUE LA SERIE NO SEA IGUAL AL CODIGO O CODIGOBARRAS 'VALIDA QUE LA SERIE NO SEA IGUAL AL CODIGO O CODIGOBARRAS
@@ -21992,7 +21994,7 @@ Partial Class Compras_Compras
.NombreProveedor = NombreProveedor, .NombreProveedor = NombreProveedor,
.Fecha = Fecha, .Fecha = Fecha,
.CveMoneda = CveMoneda, .CveMoneda = CveMoneda,
.Serie = If(EsDRMN, $"DRNC-{Serie}", Serie), .Serie = $"D-{Serie}",
.Folio = Folio, .Folio = Folio,
.CveCompraAmortizacion = CveCompraRegistrada .CveCompraAmortizacion = CveCompraRegistrada
} }
@@ -22849,23 +22851,15 @@ Public Class ClsCompraManagerCompras
TmpDT.Columns.Add("CveSATPSActualizado") TmpDT.Columns.Add("CveSATPSActualizado")
SubTotalConceptos = TmpDT.SUMD("Total").RoundSQL SubTotalConceptos = TmpDT.SUMD("Total").RoundSQL
If Not TmpDT.Columns.Contains("Amortizacion") Then If Not TmpDT.Columns.Contains("Amortizacion") Then TmpDT.Columns.Add("Amortizacion", GetType(Decimal))
TmpDT.Columns.Add("Amortizacion", GetType(Decimal))
End If
If Not TmpDT.Columns.Contains("AplicaLote") Then TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
If Not TmpDT.Columns.Contains("AplicaLote") Then If Not TmpDT.Columns.Contains("AplicaCaducidad") Then TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean))
TmpDT.Columns.Add("AplicaLote", GetType(Boolean))
End If If Not TmpDT.Columns.Contains("Lote") Then TmpDT.Columns.Add("Lote", GetType(String))
If Not TmpDT.Columns.Contains("AplicaCaducidad") Then
TmpDT.Columns.Add("AplicaCaducidad", GetType(Boolean)) If Not TmpDT.Columns.Contains("FechaCaducidad") Then TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
End If
If Not TmpDT.Columns.Contains("Lote") Then
TmpDT.Columns.Add("Lote", GetType(String))
End If
If Not TmpDT.Columns.Contains("FechaCaducidad") Then
TmpDT.Columns.Add("FechaCaducidad", GetType(Date))
End If
'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101 'VALIDA QUE EL XML SI VIENE CON EL CODIGO SAT 01010101
Dim ProductosCodigoSATNoPermitidos As New StringBuilder("") Dim ProductosCodigoSATNoPermitidos As New StringBuilder("")
@@ -22875,7 +22869,6 @@ Public Class ClsCompraManagerCompras
If ProductosCodigoSATNoPermitidos.ToString.Length > 0 Then If ProductosCodigoSATNoPermitidos.ToString.Length > 0 Then
Errores.AppendLine($"El comprobante contiene productos con código SAT '01010101', revise los productos:</br></br>{ProductosCodigoSATNoPermitidos.ToString}") Errores.AppendLine($"El comprobante contiene productos con código SAT '01010101', revise los productos:</br></br>{ProductosCodigoSATNoPermitidos.ToString}")
End If End If
Else Else
GuardaLog($"Error al cargar detalles GetFacturasComparacionXML.") GuardaLog($"Error al cargar detalles GetFacturasComparacionXML.")