terminando validación de ps en oc al vincular en una compra

This commit is contained in:
Antonio Gonzalez
2020-10-12 19:19:31 -07:00
parent ec04bff28c
commit 4516e08c0e
4 changed files with 850 additions and 1479 deletions

View File

@@ -1521,7 +1521,7 @@
<asp:GridView runat="server" ID="GvOC1" AutoGenerateColumns="false" <asp:GridView runat="server" ID="GvOC1" AutoGenerateColumns="false"
GridLines="None" UseAccessibleHeader="true" EmptyDataText="No se encontraron registros." CssClass="table table-striped table-hover Widthall Sortable" RowStyle-HorizontalAlign="Center" GridLines="None" UseAccessibleHeader="true" EmptyDataText="No se encontraron registros." CssClass="table table-striped table-hover Widthall Sortable" RowStyle-HorizontalAlign="Center"
DataKeyNames="CantidadF,FolioREQ,CveProveedorSucursal,PS,CantidadPendienteVincular,IEPSPS,IVA,RetIVA,RetISR,Descuento,IVAPorcentaje,RetIVAPorcentaje,RetISRPorcentaje,IEPSPSPorcentaje,IEPSPSIVAPorcentaje,Cantidad,CveProveedorOC"> DataKeyNames="CantidadF,FolioREQ,CveProveedorSucursal,CveTipoPS,PS,CantidadPendienteVincular,IEPSPS,IVA,RetIVA,RetISR,Descuento,IVAPorcentaje,RetIVAPorcentaje,RetISRPorcentaje,IEPSPSPorcentaje,IEPSPSIVAPorcentaje,Cantidad,CveProveedorOC,Importe">
<Columns> <Columns>
<asp:TemplateField HeaderText="Folio" ItemStyle-Width="10%" Visible="false"> <asp:TemplateField HeaderText="Folio" ItemStyle-Width="10%" Visible="false">
@@ -1762,7 +1762,7 @@
<asp:UpdatePanel runat="server" ID="UpGvOC2" UpdateMode="Conditional"> <asp:UpdatePanel runat="server" ID="UpGvOC2" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div id="DivDatosCompra" style="height: 250px; overflow-y: auto;"> <div id="DivDatosCompra" style="height: 250px; overflow-y: auto;">
<asp:GridView AutoGenerateColumns="false" runat="server" ID="GvOC2" GridLines="None" EmptyDataText="No se encontraron registros." CssClass="table table-striped table-hover gridconheader Widthall" RowStyle-HorizontalAlign="Center"> <asp:GridView AutoGenerateColumns="false" runat="server" ID="GvOC2" GridLines="None" EmptyDataText="No se encontraron registros." CssClass="table table-striped table-hover gridconheader Widthall" RowStyle-HorizontalAlign="Center" DataKeyNames="Cantidad,UM,PS,SATClaveProductoServicio,PU,Total,Descuento">
<Columns> <Columns>
<asp:BoundField HeaderText="#" DataField="Consec" ItemStyle-Width="20px" /> <asp:BoundField HeaderText="#" DataField="Consec" ItemStyle-Width="20px" />
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" DataFormatString="{0:#,##0.00####}" ItemStyle-Width="40px" /> <asp:BoundField HeaderText="Cantidad" DataField="Cantidad" DataFormatString="{0:#,##0.00####}" ItemStyle-Width="40px" />

View File

@@ -15469,6 +15469,12 @@ Partial Class Compras_Compras
'If DdlOCVinculaInv.SelectedValue.ToEntero = 237 And Not CveFlete > 0 Then Alert("Necesita vincular un flete si selecciona Factura de Flete", TipoMensaje.MsgAdvertencia) : Exit Sub 'If DdlOCVinculaInv.SelectedValue.ToEntero = 237 And Not CveFlete > 0 Then Alert("Necesita vincular un flete si selecciona Factura de Flete", TipoMensaje.MsgAdvertencia) : Exit Sub
'If DdlOCVinculaInv.SelectedValue.ToEntero = 240 And Not CveImportacion > 0 Then Alert("Necesita vincular una Importación si selecciona Factura de Importación", TipoMensaje.MsgAdvertencia) : Exit Sub 'If DdlOCVinculaInv.SelectedValue.ToEntero = 240 And Not CveImportacion > 0 Then Alert("Necesita vincular una Importación si selecciona Factura de Importación", TipoMensaje.MsgAdvertencia) : Exit Sub
If UsuarioActual.CveEmpresa = 119 And DdlTipoComprobante.SelectedValue = "Fac" Then
If Not VerificarProductosCompraConOC() Then
Exit Sub
End If
End If
Dim SubTotalGV = 0.0D Dim SubTotalGV = 0.0D
Dim Amortizacion As Decimal = TmpDT.SUMD("Total") Dim Amortizacion As Decimal = TmpDT.SUMD("Total")
If ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 Then If ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 Then
@@ -19453,7 +19459,7 @@ Partial Class Compras_Compras
Case 237 Case 237
Select Case FleteImportacionOpcion Select Case FleteImportacionOpcion
Case 1 Case 1
If Not ObjInventario.AddFletescompras(CveFlete, CveCompra) Then If Not ObjInventario.AddFletesCompras(CveFlete, CveCompra) Then
ErrorTrans = True ErrorTrans = True
End If End If
'''actualiza la compra para que no se surta en almacen. sino por el flete o importación '''actualiza la compra para que no se surta en almacen. sino por el flete o importación
@@ -20254,36 +20260,97 @@ Partial Class Compras_Compras
End Sub End Sub
'Private Function VerificarProductosSATPS() As Boolean Private Function VerificarProductosSATPS() As Boolean
' Dim CvePSGRuposAux As New StringBuilder("") Dim CvePSGRuposAux As New StringBuilder("")
' For Each gvr As GridViewRow In GvPS.Rows For Each gvr As GridViewRow In GvPS.Rows
' Dim CvePSIndividual As String = gvr.DataKey("CvePS") Dim CvePSIndividual As String = gvr.DataKey("CvePS")
' CvePSGRuposAux.AppendFormat("{0},", CvePSIndividual) CvePSGRuposAux.AppendFormat("{0},", CvePSIndividual)
' Next Next
Dim CvePSGRupos As String = Left(CvePSGRuposAux.ToString, CvePSGRuposAux.Length - 1) Dim CvePSGRupos As String = Left(CvePSGRuposAux.ToString, CvePSGRuposAux.Length - 1)
Dim PSSat As DataTable = GlobalDTPS(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CvePS IN ({0})", CvePSGRuposAux)) Dim PSSat As DataTable = GlobalDTPS(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CvePS IN ({0})", CvePSGRuposAux))
Dim ProductosCodigoSATNoPermitidos As New StringBuilder("") Dim ProductosCodigoSATNoPermitidos As New StringBuilder("")
For Each PS As GridViewRow In GvPS.Rows For Each PS As GridViewRow In GvPS.Rows
Dim PSIndividual As String = PS.DataKey("PS") Dim PSIndividual As String = PS.DataKey("PS")
Dim ClavePSSAT As String = PSSat.FiltroPrimeroValor("CveSATPS", String.Format("PS = '{0}'", PSIndividual)) Dim ClavePSSAT As String = PSSat.FiltroPrimeroValor("CveSATPS", String.Format("PS = '{0}'", PSIndividual))
If ClavePSSAT = "46920" Then If ClavePSSAT = "46920" Then
ProductosCodigoSATNoPermitidos.AppendFormat("{0}</br>", PSIndividual) ProductosCodigoSATNoPermitidos.AppendFormat("{0}</br>", PSIndividual)
End If End If
Next Next
If ProductosCodigoSATNoPermitidos.ToString.Length > 0 Then If ProductosCodigoSATNoPermitidos.ToString.Length > 0 Then
Dim mensajeAdvertencia As String = String.Format("No se permite vinculación de productos con código SAT '01010101', revise los productos:</br></br>{0}", ProductosCodigoSATNoPermitidos.ToString) Dim mensajeAdvertencia As String = String.Format("No se permite vinculación de productos con código SAT '01010101', revise los productos:</br></br>{0}", ProductosCodigoSATNoPermitidos.ToString)
Alert(mensajeAdvertencia, TipoMensaje.MsgAdvertencia) Alert(mensajeAdvertencia, TipoMensaje.MsgAdvertencia)
Return False Return False
End If End If
' Return True Return True
'End Function End Function
Private Function VerificarProductosCompraConOC() As Boolean
Dim ProductosNoValidados As New StringBuilder()
Dim DtCompras As New DataTable()
DtCompras.Columns.Add("Cantidad", GetType(String))
DtCompras.Columns.Add("UM", GetType(String))
DtCompras.Columns.Add("PS", GetType(String))
DtCompras.Columns.Add("SATClaveProductoServicio", GetType(String))
DtCompras.Columns.Add("PU", GetType(String))
DtCompras.Columns.Add("Total", GetType(String))
For Each GvOC2Row As GridViewRow In GvOC2.Rows
Dim Cantidad As String = GvOC2Row.DataKey("Cantidad")
Dim UM As String = GvOC2Row.DataKey("UM")
Dim PS As String = GvOC2Row.DataKey("PS")
Dim SATClaveProductoServicio As String = GvOC2Row.DataKey("SATClaveProductoServicio")
Dim PU As String = (GvOC2Row.DataKey("Total").ToEntero / GvOC2Row.DataKey("Cantidad").ToEntero).ToString
Dim Total As String = GvOC2Row.DataKey("Total")
DtCompras.Rows.Add(Cantidad, UM, PS, SATClaveProductoServicio, PU, Total)
Next
For Each GvOCRow As GridViewRow In GvOC1.Rows
Dim TipoPS As String = GvOCRow.DataKey("CveTipoPS")
If TipoPS = "2" Then
Dim ProductoAisloadoString As String = GvOCRow.DataKey("PS").Split("-"c)(1).Trim()
Dim PSOC As String = ProductoAisloadoString
Dim CantidadOC As String = GvOCRow.DataKey("CantidadF")
Dim PrecioUnitarioOC As String = GvOCRow.DataKey("Importe")
Dim Filtro As String = String.Format("Cantidad = {0} AND PS = '{1}' AND PU = {2}", CantidadOC, PSOC, PrecioUnitarioOC)
Dim RenglonCompras As DataRow = DtCompras.FiltroPrimero(Filtro)
If RenglonCompras Is Nothing Then
Dim FiltroCantidad As String = String.Format("Cantidad = {0} AND PS = '{1}'", CantidadOC, PSOC)
Dim RenglonFiltroCantidad As DataRow = DtCompras.FiltroPrimero(FiltroCantidad)
If RenglonFiltroCantidad Is Nothing Then
ProductosNoValidados.AppendFormat("La Cantidad del producto '{0}' no coincide<br/>", PSOC)
End If
Dim FiltroPU As String = String.Format("PS = '{0}' AND PU = {1}", PSOC, PrecioUnitarioOC)
Dim RenglonFiltroPU As DataRow = DtCompras.FiltroPrimero(FiltroPU)
If RenglonFiltroPU Is Nothing Then
ProductosNoValidados.AppendFormat("El Precio Unitario del producto '{0}' no coincide<br/>", PSOC)
End If
ProductosNoValidados.Append("<br/>")
End If
End If
Next
If ProductosNoValidados.ToString().Length() > 0 Then
Dim AlertProductosNoValidados As String = String.Format("Los siguientes productos no se encuentran en la factura: <br/><br/>{0}", ProductosNoValidados.ToString)
Alert(AlertProductosNoValidados, TipoMensaje.MsgAdvertencia)
Return False
End If
Return True
End Function
End Class End Class
Public Class MMensajeDevolucion Public Class MMensajeDevolucion

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff