This commit is contained in:
2021-02-24 12:31:09 -07:00
94 changed files with 27729 additions and 14870 deletions

View File

@@ -3217,6 +3217,12 @@
</div>
</div>
</div>
<div class="row" style="align-items: center" id="divDevAuto" runat="server" visible="false">
<label class="col-md-4">Devolución automática:</label>
<div class="col-md-8">
<asp:CheckBox Text="" runat="server" ID="CheckDevAuto" Visible="True" />
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnCancelarCompra2" OnClick="BtnCancelarCompra2_Click" runat="server" CssClass="btn btn-success" Text="Cancelar Compra" ValidationGroup="GrpCancelarCompra" />

View File

@@ -1591,8 +1591,12 @@ Partial Class Compras_Compras
LtlTareaNueva.Text = String.Format("<a class=""caption-subject bold font-green"" onclick=""OpenModalNewTareaUserControl(1,-1,{{CveCompra:{0}}});""> <i class=""fa fa-plus""'></i> Tarea</a>", CveCompra)
End If
'Valida si tienes permisos para devolucion automatica y si cumple con las condiciones para mostrarlo
If UsuarioActual.TienePermisoProceso(315) And GvInvMov.Rows.Count > 0 Then
divDevAuto.Visible = True
End If
End If
'SE OCUPAN AFUERA DEL POSTBACK ??
cargaddlVinculacionServcios()
@@ -3984,6 +3988,20 @@ Partial Class Compras_Compras
Protected Sub BtnGuardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnGuardar.Click
'------------------INICIA VALIDACIONES------------------
Dim TempIva As Decimal
For Each drowv As DataRow In TmpDT.Rows
TempIva = TempIva + (drowv("Total").ToString.ToDecimal * drowv("IVAPorcentaje").ToString.ToDecimal)
Next
Dim DifGenelraIvas As Decimal = (TxtIVA.Text.ToDecimal - TempIva)
If Math.Abs(DifGenelraIvas) > 0.2 Then
Alert($"Los importes no coinciden, error en calculo de IVA diferencia { DifGenelraIvas }", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim EstatusCredito As Integer = 0
Dim CveSubProyecto As Integer = 0
'Credito Multiple
@@ -4582,7 +4600,7 @@ Partial Class Compras_Compras
'End If
'METODO DE PREPOLIZA DE ALMACEN
If UsuarioActual.CveEmpresa.Contiene(1, 119, 72, 80, 140, 141, 152, 153, 159, 160, 161, 162, 163) And UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Then
If UsuarioActual.CveEmpresa.Contiene(1, 119, 72, 80, 140, 141, 152, 153, 154, 159, 160, 161, 162, 163) And UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Then
Dim ImporteAlmacen = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND CveTipoPS = 2").ToString.ToDecimal
If ImporteAlmacen > 0 Then
If Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then
@@ -5258,7 +5276,6 @@ Partial Class Compras_Compras
'hay que restarle descuento
importeconcepto = If(DdlMoneda.SelectedValue.ToEntero = 1, dr("pu").ToString.ToDecimal, dr("pu").ToString.ToDecimal * TipoCambioGuardar) - (If(DdlMoneda.SelectedValue.ToEntero = 1, dr("descuento").ToString.ToDecimal, dr("descuento").ToString.ToDecimal * TipoCambioGuardar) / dr("cantidad").ToString.ToDecimal)
If Not ObjInventario.AddMovimientoDetalle(cvemovimientoentrada, dr("cantidad").ToString.ToDouble, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, importeconcepto, -1, PUTC:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, dr("pu").ToString.ToDecimal), CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero) Then
ErrorMovInv = True
Exit For
End If
@@ -14506,7 +14523,7 @@ Partial Class Compras_Compras
Protected Sub BtnRefacturacionVer_Click(sender As Object, e As EventArgs) Handles BtnRefacturacionVer.Click
Dim Opcion As Integer = 1
If UsuarioActual.CveEmpresa.Contiene(119, 72, 1) Then Opcion = 2
If UsuarioActual.CveEmpresa.Contiene(119, 1) Then Opcion = 2
Dim ObjCompras As New ClsCompras
@@ -14754,7 +14771,7 @@ Partial Class Compras_Compras
If UsuarioActual.TienePermisoProceso(140) Then
If CveMovimientoAlmacen > 0 And EstatusAlmacen = 2 Then
BtnCancelarCompra.Visible = True
ElseIf CveMovimientoAlmacen = 0 Then
Else
BtnCancelarCompra.Visible = True
End If
End If
@@ -14791,6 +14808,70 @@ Partial Class Compras_Compras
End If
ObjComprasComprobacion.Dispose()
'DEVOLUCIÓN AUTOMATICA
If CheckDevAuto.Checked Then
Dim ErrorMovInv As Boolean = False
Dim cvemovimientoentrada As Integer
Dim folio As Integer
Dim fecha As Date = TxtFechaCancelacion.Text.ToDate
Dim importeconcepto As Decimal
Dim ObjInventario As New ClsInventarios
Dim ObjCompra As New ClsCompras
Dim tbmovs As DataTable = Nothing
Dim TmpDT As DataTable = Nothing
Dim TipoCambioGuardar As Decimal = 1
Dim tcvealmacen As Integer = 0
If ObjCompra.GetCompraDetalle(CveCompra) Then
If ObjCompra.DtResultados.Rows.Count > 0 Then
TmpDT = ObjCompra.DtResultados
End If
End If
If ObjInventario.GetInv_ComprasMov(CveCompra, UsuarioActual.CveEmpresa) Then
If ObjInventario.DtResultados.Rows.Count > 0 Then
tbmovs = ObjInventario.DtResultados
End If
End If
If DdlMoneda.SelectedValue.ToEntero > 1 Then
TipoCambioGuardar = If(DivTC.Visible, TxtTC.Text.ToDecimal, LblTC.Text.Substring(3).ToDecimal)
End If
TipoCambio = If(DivTC.Visible, TipoCambioGuardar, TipoCambio)
For Each dtMovs As DataRow In TmpDT.Rows
If TmpDT.Rows.Count > 0 Then
tcvealmacen = dtMovs("AlmacenRegistrado").ToString.ToEntero
Exit For
End If
Next
folio = ObjInventario.GetFolioSiguiente(13, UsuarioActual.CveEmpresa)
cvemovimientoentrada = ObjInventario.AddMovimiento(tcvealmacen, 13, 1, fecha, folio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, TipoCambio:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, TipoCambioGuardar), Modulo:="Devolucion Automatica")
If cvemovimientoentrada <= 0 Then
ErrorMovInv = True
Else
For Each dr As DataRow In tbmovs.Rows
If dr("cvealmacen").ToString.ToEntero = tcvealmacen And dr("CveCompraDetalle").ToString.ToEntero <> -1 And dr("origen").ToString.ToEntero <> -1 And dr("Total").ToString.ToDecimal <> 0 Then
'hay que restarle descuento
importeconcepto = dr("Total").ToString.ToDecimal
If Not ObjInventario.AddMovimientoDetalle(cvemovimientoentrada, dr("cantidad").ToString.ToDouble, dr("cveum").ToString.ToEntero, dr("cveps").ToString.ToEntero, importeconcepto, -1, CveCompraDetalle:=dr("CveCompraDetalle").ToString.ToEntero, Serie:=dr("Serie").ToString) Then
ErrorMovInv = True
Exit Sub
End If
End If
Next
End If
If ErrorMovInv = True Then
ObjInventario.RollBack()
End If
ObjInventario.Dispose()
ObjCompra.Dispose()
End If
Dim ObjAC As ClsContPAQi = Nothing
If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then
ObjAC = New ClsContPAQi(UsuarioActual.Empresa)
@@ -14808,7 +14889,7 @@ Partial Class Compras_Compras
' MES ANTERIOR, MOVIMIENTOS CONTRARIOS (NEGATIVOS)
If TxtFecha.Text.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or TxtFecha.Text.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Or DdlTipoComprobante.SelectedValue.Contiene("NC") Then
If True Then
'CREA POLIZA NEGATIVA
If IdPoliza > 0 AndAlso ObjAC IsNot Nothing AndAlso UsuarioActual.Empresa.UsaAC Then
@@ -14963,6 +15044,8 @@ Partial Class Compras_Compras
ObjAC.Dispose()
End If
End Sub
Private Sub btnProrateo_Click(sender As Object, e As EventArgs) Handles btnProrateo.Click, btnProrateo2.Click
@@ -17690,6 +17773,7 @@ Partial Class Compras_Compras
DdlClasificacionChange()
End Sub
Private Sub DdlClasificacionChange()
CargaPS(DdlClasificacion.SelectedValue.ToEntero)
If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
@@ -17742,8 +17826,7 @@ Partial Class Compras_Compras
DdlPS.DataSource = If(CveClasificacion > 0, DTTemp.FiltraParametros($"CveClasificacion = {CveClasificacion}"), DTTemp)
Else
DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
DdlPS.DataSource = If(CveClasificacion > 0, GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros($"CveClasificacion = {CveClasificacion}"), GlobalDTPSSimplificado(UsuarioActual.CveEmpresa))
End If
@@ -17878,12 +17961,12 @@ Partial Class Compras_Compras
Exit Sub
End If
If UsuarioActual.Empresa.Tipo_CentroCosto = 3 Or UsuarioActual.Empresa.Tipo_CentroCosto = 4 Or UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then
If Not DdlProyecto.SelectedValue.ToEntero > 0 Then
Alert("Es necesario seleccionar un proyecto.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
'If UsuarioActual.Empresa.Tipo_CentroCosto = 3 Or UsuarioActual.Empresa.Tipo_CentroCosto = 4 Or UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then
' If Not DdlProyecto.SelectedValue.ToEntero > 0 Then
' Alert("Es necesario seleccionar un proyecto.", TipoMensaje.MsgAdvertencia)
' Exit Sub
' End If
'End If
If Not DdlSubProyecto.SelectedValue.ToEntero > 0 Then
Alert("Es necesario seleccionar un subproyecto.", TipoMensaje.MsgAdvertencia)

View File

@@ -289,6 +289,12 @@ Partial Class PopUpVerFactura
If UrlParametros("CVEMOVIMIENTO") IsNot Nothing AndAlso UrlParametros("CVEMOVIMIENTO").ToString.ToEntero > 0 Then
ImprimirEtiqueta(UrlParametros("CVEMOVIMIENTO").ToString.ToEntero, UrlParametros("MODALIDAD").ToString)
End If
End If
If UrlParametros("OP").ToString = "Etiqueta2" Then
If UrlParametros("CVEPS") IsNot Nothing AndAlso UrlParametros("CVEPS").ToString.ToEntero > 0 Then
ImprimirEtiqueta2(UrlParametros("CVEPS").ToString.ToEntero, UrlParametros("PS").ToString, UrlParametros("CVEALMACEN").ToString, UrlParametros("MODALIDAD").ToString)
End If
End If
'IMPRIME OC
@@ -4381,7 +4387,7 @@ Partial Class PopUpVerFactura
Private Sub ImprimirEtiqueta(CveMovimiento As Integer, Modalidad As String)
Dim ObjInventarios As New ClsInventarios
Dim PS As String = ""
Dim All As Byte()
Using ms As New MemoryStream
Using d As New Document
@@ -4393,7 +4399,7 @@ Partial Class PopUpVerFactura
Dim CvePS As Integer = DetalleRow.Item("CvePS").ToString.ToEntero
Dim Lote As String = DetalleRow.Item("Lote").ToString
Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate
Dim PS As String = String.Format("{0} - {1}", DetalleRow.Item("Codigo").ToString, DetalleRow.Item("PS").ToString)
PS = String.Format("{0} - {1}", DetalleRow.Item("Codigo").ToString, DetalleRow.Item("PS").ToString)
If Modalidad = "Individual" Then
Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS)
@@ -4428,7 +4434,65 @@ Partial Class PopUpVerFactura
End Using
All = ms.ToArray()
End Using
ImprimirbytesPDF(All, "Etiquetas")
ImprimirbytesPDF(All, PS.ToString)
If Modalidad = "Individual" Then
Else
End If
ObjInventarios.Dispose()
End Sub
Private Sub ImprimirEtiqueta2(CvePS As Integer, PS As String, CveAlmacen As String, Modalidad As String)
Dim ObjInventarios As New ClsInventarios
Dim All As Byte()
Using ms As New MemoryStream
Using d As New Document
Using Copy As New PdfCopy(d, ms)
d.Open()
If ObjInventarios.GetExistenciasCaducidad(CvePS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveAlmacen.ToString) Then
If ObjInventarios.DtResultados IsNot Nothing Then
For Each DetalleRow As DataRow In ObjInventarios.DtResultados.Rows
Dim Lote As String = DetalleRow.Item("Lote").ToString
Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate
If Modalidad = "Individual" Then
Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS)
Dim reader As New PdfReader(reporteByte)
Dim Paginas As Integer = reader.NumberOfPages
Dim Contador As Integer = 0
While Contador < Paginas
Contador += 1
Copy.AddPage(Copy.GetImportedPage(reader, Contador))
End While
Else
Dim Cant As Integer = DetalleRow.Item("Cantidad").ToString.ToEntero - 1
For contador As Integer = 0 To Cant
Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS)
Dim reader As New PdfReader(reporteByte)
Dim Paginas As Integer = reader.NumberOfPages
Dim Cont As Integer = 0
While Cont < Paginas
Cont += 1
Copy.AddPage(Copy.GetImportedPage(reader, Cont))
End While
Next
End If
Next
End If
End If
d.Close()
End Using
End Using
All = ms.ToArray()
End Using
ImprimirbytesPDF(All, PS.ToString)
If Modalidad = "Individual" Then
@@ -4447,7 +4511,7 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("QR", QrDescarga))
params.Add(New ReportParameter("PS", PS))
params.Add(New ReportParameter("Lote", Lote))
params.Add(New ReportParameter("FechaCad", FechaCaducidad.ToString()))
params.Add(New ReportParameter("FechaCad", FechaCaducidad.ToString("dd/MM/yyyy")))
Return StreamPDF("Empresas/Grales/Formatos/EtiquetaDeRecepcion.rdlc", New DataTable, params)
End Function
#End Region

View File

@@ -244,7 +244,7 @@
<asp:TextBox ID="TxtTotal" runat="server" CssClass="form-control input-sm" Visible="false" MaxLength="12" Width="140px" placeholder="Total" Enabled="false" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
</div>
</div>
<div class="row" runat="server" id="rowComisiones" visible="false">
<div class="row" runat="server" >
<label class="col-md-2" runat="server" id="lblpagocomisiones">Otros Ingresos:</label>
<div class="col-md-3">
<asp:CheckBox ID="ChkAjusteOI" runat="server" AutoPostBack="true" />

View File

@@ -112,11 +112,11 @@ Partial Class Compras_ReembolsosComprobaciones
CbPermitirExcedente.Visible = False
End If
If UsuarioActual.CveEmpresa.Contiene(1, 4, 7, 11, 12, 72, 80, 119) Then
rowComisiones.Visible = True
End If
' If UsuarioActual.CveEmpresa.Contiene(1, 4, 7, 11, 12, 72, 80, 119) Then
'rowComisiones.Visible = True
' End If
If UsuarioActual.CveEmpresa = 119 Then
If UsuarioActual.CveEmpresa = 119 Then
ChkReembolsarSinBancos.Visible = True
End If

View File

@@ -509,13 +509,16 @@
<h4 class="modal-title">Vincular Complemento de Pago</h4>
</div>
<div class="modal-body">
<div class="row" runat="server" id="DivVincularPagoManualmente" visible="false">
<div class="row" runat="server" id="DivVincularPagoManualmente" style="visibility:hidden!important">
<div class="col-md-2">
<a runat="server" class="btn btn-circle btn-default" href="javascript:AbrirVentana('/Bancos/PopUpBuscarIE.aspx?OPCION=Complementos',800,600,'N');"><i class='fa fa-plus'></i>Vincular IE Manualmente</a>
<asp:Button ID="BtnVincularManualmente" runat="server" ClientIDMode="Static" OnClick="BtnVincularManualmente_Click" Style="display: none;" class="btn btn-primary" />
<asp:HiddenField runat="server" ID="HdnCveIE" ClientIDMode="Static" Value="-1" />
<asp:HiddenField runat="server" ID="HdnIdDocumento" ClientIDMode="Static" Value="-1" />
</div>
</div>
<br />
<table class="table table-hover table-striped ScrollAD mysmallbtn Widthall">
<tr style="border: 0px!important">
@@ -555,10 +558,11 @@
<hr style="border: 0; height: 1px; background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));" />
<asp:GridView ID="GVPDocumentosRelacionadosPagos" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD mysmallbtn"
DataKeyNames="CveFactura,CveCompra,CveIE,Fecha,FechaPago,ImpPagado,CvePrePolizaDetalle"
DataKeyNames="CveFactura,CveCompra,SerieFolio,CveIE,Fecha,FechaPago,ImpPagado,CvePrePolizaDetalle,IdDocumento,FolioPago,Manual"
data-sort="true" Width="100%" EmptyDataText="No se encontró registros con la información del complemento de pago"
ShowHeaderWhenEmpty="true" AutoGenerateColumns="False">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields ="CveCompra" DataNavigateUrlFormatString ="/Compras/Compras.aspx?CveCompra={0}" DataTextField ="SerieFolio" HeaderText="SerieFolio" />
<asp:BoundField DataField="Fecha" HeaderText="Fecha" ItemStyle-HorizontalAlign="center" DataFormatString="{0:d}" />
<asp:BoundField DataField="IdDocumento" HeaderText="UUID" ItemStyle-HorizontalAlign="Left" />
@@ -567,7 +571,7 @@
<%-- <asp:BoundField DataField="FolioPago" HeaderText="Folio Pago" ItemStyle-HorizontalAlign="Right" />--%>
<asp:HyperLinkField DataNavigateUrlFields ="CveIE" DataNavigateUrlFormatString ="/Bancos/IE.aspx?CveIE={0}" DataTextField ="FolioPago" HeaderText="Folio Pago"/>
<asp:BoundField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10px" />
<asp:BoundField DataField="FechaPago" HeaderText="Fecha Pago" ItemStyle-HorizontalAlign="center" DataFormatString="{0:d}" />
<asp:BoundField DataField="ImportePago" HeaderText="Importe Pago" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N2}" />
@@ -765,9 +769,15 @@
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript">
function VinculacionManual(v) {
$get("HdnCveIE").value = v;
function VinculacionManual(CveIE) {
$('#HdnCveIE').val(CveIE);
$('#BtnVincularManualmente').click();
}
//function VinculacionManual(v) {
// $get("HdnCveIE").value = v;
// $('#BtnVincularManualmente').click();
//}
</script>
</asp:Content>

View File

@@ -604,6 +604,85 @@ Partial Class Compras_eFacturas
End Set
End Property
Property DTGVPagosVinculacion As DataTable
Get
If ViewState("DTGVPagosVinculacion") Is Nothing Then
Return New DataTable
Else
Return DirectCast(ViewState("DTGVPagosVinculacion"), DataTable)
End If
End Get
Set(value As DataTable)
ViewState("DTGVPagosVinculacion") = value
End Set
End Property
Private Property CurretUUIDPagoVincular As String
Get
If ViewState("CurretUUIDPagoVincular") Is Nothing Then
Return "-1"
Else
Return ViewState("CurretUUIDPagoVincular").ToString
End If
End Get
Set(value As String)
ViewState("CurretUUIDPagoVincular") = value
End Set
End Property
Private Property XMLNodosPagosModalCount As Integer
Get
If ViewState("XMLNodosPagosModalCount") Is Nothing Then
Return -1
Else
Return ViewState("XMLNodosPagosModalCount").ToString.ToEntero
End If
End Get
Set(value As Integer)
ViewState("XMLNodosPagosModalCount") = value
End Set
End Property
Private Property MontoPago As Decimal
Get
If ViewState("MontoPago") Is Nothing Then
Return 0
Else
Return (ViewState("MontoPago")).ToString.ToDecimal
End If
End Get
Set(value As Decimal)
ViewState("MontoPago") = value
End Set
End Property
Private Property ComprasEnComplemento As Integer
Get
If ViewState("ComprasEnComplemento") Is Nothing Then
Return -1
Else
Return ViewState("ComprasEnComplemento").ToString.ToEntero
End If
End Get
Set(value As Integer)
ViewState("ComprasEnComplemento") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
@@ -2682,7 +2761,11 @@ Partial Class Compras_eFacturas
Dim FechaPago As Date
Dim PagosCantidad As Integer = 0
DTGVPagosVinculacion = New DataTable
MontoPago = 0D
ComprasEnComplemento = 0
XMLNodosPagosModalCount = 0
Dim XMLDoc As New XmlDocument
Dim Archivo As String = String.Format("{0}Empresas\{1}\Compras\{2}\{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, gvRow.DataKey("RFCDe"), gvRow.DataKey("XML"))
@@ -2759,13 +2842,14 @@ Partial Class Compras_eFacturas
DTDocumentosRelacionados.Columns.Add("SerieFolioCompra")
DTDocumentosRelacionados.Columns.Add("CvePrePolizaDetalle", GetType(Integer))
DTDocumentosRelacionados.Columns.Add("Tipo", GetType(String))
DTDocumentosRelacionados.Columns.Add("Manual", GetType(Boolean))
Dim nodePagosN As XmlNodeList
nodePagosN = nodeComp.SelectNodes(String.Format("//{0}:Pagos", PrefijoPagos), namespaces)
For Each NodosPagos As XmlNode In nodePagosN
For Each innernode As XmlNode In NodosPagos
@@ -2788,14 +2872,20 @@ Partial Class Compras_eFacturas
Nrow("ImpPagado") = ValorXML(node, "ImpPagado").ToDecimal
Nrow("Fecha") = FechaPago
Nrow("Tipo") = "17"
Nrow("Manual") = False
DTDocumentosRelacionados.Rows.Add(Nrow)
StrUUID.AppendFormat("'{0}',", ValorXML(node, "IdDocumento").Replace("'", ""))
XMLNodosPagosModalCount = XMLNodosPagosModalCount + 1
Next
Next
Next
MontoPago = Monto
Dim ObjCompraFolios As New ClsCompras
If ObjCompraFolios.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace($"{PrefijoPagos}:", ""), UsuarioActual.CveEmpresa, OP:=If(CveComplementoPagoCompra > 0, 2, 1), CveFactura:=CveFacturaComplemento) Then
@@ -2820,19 +2910,13 @@ Partial Class Compras_eFacturas
If drow("CveIE").ToString.ToEntero > 0 Then
dRow2("CveIE") = drow("CveIE").ToString.ToEntero
dRow2("ImportePago") = drow("Importe").ToString.ToDecimal
End If
dRow2("FolioPago") = drow("FolioIE")
dRow2("FechaPago") = drow("FechaDocumento")
End If
Next
Next
@@ -2843,6 +2927,12 @@ Partial Class Compras_eFacturas
GVPDocumentosRelacionadosPagos.DataSource = DTDocumentosRelacionados
GVPDocumentosRelacionadosPagos.DataBind()
DTGVPagosVinculacion = DTDocumentosRelacionados
ComprasEnComplemento = DTGVPagosVinculacion.COUNT("CveCompra", " CveCompra > 0")
If DTDocumentosRelacionados.MAX("CveCompra").ToString.ToEntero > 0 Then
@@ -2873,6 +2963,7 @@ Partial Class Compras_eFacturas
DT_ComprasSinIE.Columns.Add("SerieFolioCompra")
For Each dRow As DataRow In DTDocumentosRelacionados.Rows
Dim nRow As DataRow = DT_ComprasSinIE.NewRow
nRow("CveCompra") = dRow("CveCompra").ToString.ToEntero
' nRow("CveFactura") = dRow("CveFactura").ToString.ToEntero
@@ -2881,7 +2972,6 @@ Partial Class Compras_eFacturas
DT_ComprasSinIE.Rows.Add(nRow)
Next
@@ -3057,27 +3147,40 @@ Partial Class Compras_eFacturas
For Each Gv As GridViewRow In GVPDocumentosRelacionadosPagos.Rows
If HdnCveIE.Value.ToEntero > 0 Then
If Gv.DataKey("CveCompra").ToEntero > 0 And Gv.FCLabel("LblCveIE").Text.ToEntero > 0 Then
If Not ObjCompra.AddComplementoPago(Gv.FCLabel("LblCveIE").Text.ToEntero, Gv.DataKey("CveCompra").ToEntero, Gv.DataKey("ImpPagado").ToDecimal, Gv.FCLabel("LblCvePrePolizaDetalle").Text.ToEntero, CveFacturaPago) > 0 Then
TieneError = True
Exit For
End If
If Gv.DataKey("CveCompra").ToEntero > 0 Then
If Not ObjCompra.AddComplementoPago(Gv.DataKey("CveIE").ToEntero, Gv.DataKey("CveCompra").ToEntero, Gv.DataKey("ImpPagado").ToDecimal, Gv.DataKey("CvePrePolizaDetalle").ToEntero, CveFacturaPago) > 0 Then
TieneError = True
Exit For
End If
Else
If Gv.DataKey("CveCompra").ToEntero > 0 Then
If Not ObjCompra.AddComplementoPago(Gv.DataKey("CveIE").ToEntero, Gv.DataKey("CveCompra").ToEntero, Gv.DataKey("ImpPagado").ToDecimal, Gv.DataKey("CvePrePolizaDetalle").ToEntero, CveFacturaPago) > 0 Then
TieneError = True
Exit For
End If
End If
End If
' If HdnCveIE.Value.ToEntero > 0 Then
' If Gv.DataKey("CveCompra").ToEntero > 0 And Gv.FCLabel("LblCveIE").Text.ToEntero > 0 Then
' If Not ObjCompra.AddComplementoPago(Gv.FCLabel("LblCveIE").Text.ToEntero, Gv.DataKey("CveCompra").ToEntero, Gv.DataKey("ImpPagado").ToDecimal, Gv.FCLabel("LblCvePrePolizaDetalle").Text.ToEntero, CveFacturaPago) > 0 Then
' TieneError = True
' Exit For
' End If
' End If
'Else
' If Gv.DataKey("CveCompra").ToEntero > 0 Then
' If Not ObjCompra.AddComplementoPago(Gv.DataKey("CveIE").ToEntero, Gv.DataKey("CveCompra").ToEntero, Gv.DataKey("ImpPagado").ToDecimal, Gv.DataKey("CvePrePolizaDetalle").ToEntero, CveFacturaPago) > 0 Then
' TieneError = True
' Exit For
' End If
' End If
'End If
Next
If Not TieneError AndAlso Not ObjCompra.AddVincularPago(CveFacturaPago) Then
TieneError = True
End If
@@ -3096,13 +3199,21 @@ Partial Class Compras_eFacturas
End If
If HdnCveIE.Value.ToEntero > 0 Then
For Each Gv As GridViewRow In GVPDocumentosRelacionadosPagos.Rows
For Each dRow As DataRow In DT_ComprasSinIE.Rows
objEventos.AddEventoBitacora($"Complemento { dRow("SerieFolioPago").ToString } vinculado manualmente a compra {dRow("SerieFolioCompra").ToString}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=dRow("CveCompra").ToString.ToEntero)
Next
If Boolean.Parse(Gv.DataKey("Manual").ToString) Then
objEventos.AddEventoBitacora($"Complemento { LblSerieFolioPago.Text} vinculado manualmente a compra {Gv.DataKey("SerieFolio").ToString} y Pago { Gv.DataKey("FolioPago").ToString }", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=Gv.DataKey("CveCompra").ToString.ToEntero)
End If
Next
End If
'If HdnCveIE.Value.ToEntero > 0 Then
' For Each dRow As DataRow In DT_ComprasSinIE.Rows
' objEventos.AddEventoBitacora($"Complemento { dRow("SerieFolioPago").ToString } vinculado manualmente a compra {dRow("SerieFolioCompra").ToString}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=dRow("CveCompra").ToString.ToEntero)
' Next
'End If
@@ -3135,82 +3246,246 @@ Partial Class Compras_eFacturas
If HdnCveIE.Value <> "-1" AndAlso IsNumeric(HdnCveIE.Value) AndAlso HdnCveIE.Value.ToEntero > 0 Then
'VincularComplementoManualGV(HdnCveIE.Value.ToEntero)
Dim ImportePago As Double = 0
Dim ImporteIES As Double = 0
Dim SerieFolioIE As String = ""
Dim ObjCompras As New ClsCompras
Dim ErrorVinculacion = True
If ObjCompras.GetCompararComplementoPago(CveProveedor, -1, "", UsuarioActual.CveEmpresa, HdnCveIE.Value.ToEntero) Then
For Each Drow As DataRow In ObjCompras.DtResultados.Rows
For Each GvRow As GridViewRow In GVPDocumentosRelacionadosPagos.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If Drow("CveCompra").ToString.ToEntero = GvRow.DataKey("CveCompra").ToEntero Then
GvRow.FCLabel("LblCveIE").Text = Drow("CveIE").ToString.ToEntero.ToString
GvRow.FCLabel("LblCvePrePolizaDetalle").Text = Drow("CvePrePolizaDetalle").ToString.ToEntero.ToString
End If
End If
Next
Next
For Each dRow As DataRow In DTGVPagosVinculacion.Rows
For Each GvRow As GridViewRow In GVPDocumentosRelacionadosPagos.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If HdnIdDocumento.Value = dRow("IdDocumento").ToString Then 'And dRow("CveIE").ToString.ToEntero <= 0
If GvRow.FCLabel("LblCveIE").Text.ToEntero > 0 And GvRow.FCLabel("LblCvePrePolizaDetalle").Text.ToEntero > 0 Then
ErrorVinculacion = False
dRow("CveIE") = HdnCveIE.Value.ToEntero
Else
Dim ObjIE As New ClsBancos()
If ObjCompras.DtResultados.Rows.Count > 0 Then
GvRow.FCLabel("LblCveIE").Text = ObjCompras.DtResultados(0)("CveIE").ToString.ToEntero.ToString
GvRow.FCLabel("LblCvePrePolizaDetalle").Text = ObjCompras.DtResultados(0)("CvePrePolizaDetalle").ToString.ToEntero.ToString
Else
ErrorVinculacion = True
Exit For
End If
'If ObjIE.GetBancosIE(HdnCveIE.Value.ToEntero, UsuarioActual.CveEmpresa) Then
' Try
' dRow("FolioPago") = ObjIE.Folio
' dRow("ImportePago") = dRow("ImpPagado")
' dRow("FechaPago") = ObjIE.FechaDocumento
' dRow("Tipo") = "E"
' ' dRow("Diferencia") = 0D
' dRow("Manual") = True
' Catch ex As Exception
' End Try
'End If
Dim ObjCompras As New ClsCompras
If ObjCompras.GetCompararComplementoPago(CveProveedor, -1, "", UsuarioActual.CveEmpresa, HdnCveIE.Value.ToEntero) Then
Try
dRow("FolioPago") = ObjCompras.DtResultados(0)("FolioIE")
dRow("ImportePago") = dRow("ImpPagado")
dRow("FechaPago") = ObjCompras.DtResultados(0)("Fecha").ToString.ToDate
dRow("CvePrePolizaDetalle") = ObjCompras.DtResultados(0)("CvePrePolizaDetalle").ToString.ToEntero
dRow("Tipo") = "E"
' dRow("Diferencia") = 0D
dRow("Manual") = True
Catch ex As Exception
End Try
End If
End If
ObjCompras.Dispose()
Next
ObjIE.Dispose()
End If
Next
End If
DTGVPagosVinculacion.AcceptChanges()
HdnIdDocumento.Value = "-1"
GVPDocumentosRelacionadosPagos.DataSource = DTGVPagosVinculacion
GVPDocumentosRelacionadosPagos.DataBind()
UpVincularPago.Update()
CurretUUIDPagoVincular = ""
ValidaTablaDeVinculacion()
Exit Sub
'**********************************************************************************************************************
'If HdnCveIE.Value <> "-1" AndAlso IsNumeric(HdnCveIE.Value) AndAlso HdnCveIE.Value.ToEntero > 0 Then
' Dim ImportePago As Double = 0
' Dim ImporteIES As Double = 0
' Dim SerieFolioIE As String = ""
' Dim ObjCompras As New ClsCompras
' Dim ErrorVinculacion = True
' If ObjCompras.GetCompararComplementoPago(CveProveedor, -1, "", UsuarioActual.CveEmpresa, HdnCveIE.Value.ToEntero) Then
' For Each Drow As DataRow In ObjCompras.DtResultados.Rows
' For Each GvRow As GridViewRow In GVPDocumentosRelacionadosPagos.Rows
' If GvRow.RowType = DataControlRowType.DataRow Then
' If Drow("CveCompra").ToString.ToEntero = GvRow.DataKey("CveCompra").ToEntero Then
' GvRow.FCLabel("LblCveIE").Text = Drow("CveIE").ToString.ToEntero.ToString
' GvRow.FCLabel("LblCvePrePolizaDetalle").Text = Drow("CvePrePolizaDetalle").ToString.ToEntero.ToString
' End If
' End If
' Next
' Next
' For Each GvRow As GridViewRow In GVPDocumentosRelacionadosPagos.Rows
' If GvRow.RowType = DataControlRowType.DataRow Then
' If GvRow.FCLabel("LblCveIE").Text.ToEntero > 0 And GvRow.FCLabel("LblCvePrePolizaDetalle").Text.ToEntero > 0 Then
' ErrorVinculacion = False
' Else
' If ObjCompras.DtResultados.Rows.Count > 0 Then
' GvRow.FCLabel("LblCveIE").Text = ObjCompras.DtResultados(0)("CveIE").ToString.ToEntero.ToString
' GvRow.FCLabel("LblCvePrePolizaDetalle").Text = ObjCompras.DtResultados(0)("CvePrePolizaDetalle").ToString.ToEntero.ToString
' Else
' ErrorVinculacion = True
' Exit For
' End If
' End If
' End If
' Next
' Else
' ErrorVinculacion = True
' End If
' If Not ErrorVinculacion Then
' ImporteIES = ObjCompras.DtResultados.FiltraParametros("CveIE > 0").SUM("Importe")
' ObjCompras.Dispose()
' BtnVincularPago.Visible = True
' LblSerieFolioPago.Text = $"{SeriePago}-{FolioPago}"
' LblImportePago.Text = ImportePago.FormatoNumero
' 'LblSerieFolioIE.Text = SerieFolioIE
' LblImporteIE.Text = ImporteIES.FormatoNumero
' GvVincularPago.DataBind()
' UpVincularPago.Update()
' ObjCompras.Dispose()
' Else
' Alert("No se pudo realizar la vinculacion manual", TipoMensaje.MsgAdvertencia)
' End If
'End If
End Sub
Private Function ValidaTablaDeVinculacion() As Boolean
Dim ResPuesta As Boolean = False
Dim Vinculados As Integer = 0
Dim TodoVinculado As Boolean = False
Dim Diferencia As Boolean = If(Math.Abs(DTGVPagosVinculacion.SUM("ImpPagado") - DTGVPagosVinculacion.SUM("ImportePago")).ToDecimal > 0.1D, True, False)
Dim VinculacionManual As Boolean = If(DTGVPagosVinculacion.FiltraParametros("Manual = 1").Rows.Count > 0, True, False)
Dim PermisoVinculacionDiferencia As Boolean = UsuarioActual.TienePermisoProceso(286)
Dim PermisoVinculacionManual As Boolean = UsuarioActual.TienePermisoProceso(286)
Dim MontoSuma As Decimal = DTGVPagosVinculacion.SUM("ImportePago").ToString.ToDecimal
For Each dRow As DataRow In DTGVPagosVinculacion.Rows
If dRow("CveIE").ToString.ToEntero > 0 Then
Vinculados = Vinculados + 1
End If
Next
'If XMLNodosPagosModalCount = Vinculados Then
If ComprasEnComplemento = Vinculados And ComprasEnComplemento > 0 Then '
TodoVinculado = True
End If
If TodoVinculado Then
If Diferencia Then
If PermisoVinculacionDiferencia Then
If VinculacionManual Then
If PermisoVinculacionManual Then
ResPuesta = True
Else
ResPuesta = False
End If
Else
ResPuesta = True
End If
Else
ResPuesta = False
End If
Else
ErrorVinculacion = True
If VinculacionManual Then
If PermisoVinculacionManual Then
ResPuesta = True
Else
ResPuesta = False
End If
Else
ResPuesta = True
End If
End If
If Not ErrorVinculacion Then
ImporteIES = ObjCompras.DtResultados.FiltraParametros("CveIE > 0").SUM("Importe")
ObjCompras.Dispose()
Else
ResPuesta = False
End If
BtnVincularPago.Visible = True
LblSerieFolioPago.Text = $"{SeriePago}-{FolioPago}"
LblImportePago.Text = ImportePago.FormatoNumero
'LblSerieFolioIE.Text = SerieFolioIE
LblImporteIE.Text = ImporteIES.FormatoNumero
If Not MontoSuma = MontoPago And ResPuesta Then
GvVincularPago.DataBind()
UpVincularPago.Update()
ObjCompras.Dispose()
Else
Alert("No se pudo realizar la vinculacion manual", TipoMensaje.MsgAdvertencia)
If Not PermisoVinculacionDiferencia Then
ResPuesta = False
End If
End If
End Sub
If ResPuesta Then
BtnVincularPago.Visible = True
Else
BtnVincularPago.Visible = False
End If
UpVincularPago.Update()
Return ResPuesta
End Function
Private Sub GVPDocumentosRelacionadosPagos_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GVPDocumentosRelacionadosPagos.RowCreated
@@ -3220,7 +3495,7 @@ Partial Class Compras_eFacturas
Dim HeaderCell = New TableCell
HeaderCell.Text = "Documentos Relacionados"
HeaderCell.ColumnSpan = 8
HeaderCell.ColumnSpan = 9
HeaderCell.Attributes.Add("style", "border-top: 1px solid #ddd; vertical-align: top; background-color: #DDD; color: #333333;font-family: 'Open Sans', sans-serif;font-size: 12px; text-align:center!important; font-weight: bold;")
HeaderGridRow.Cells.Add(HeaderCell)
GVPDocumentosRelacionadosPagos.Controls(0).Controls.AddAt(0, HeaderGridRow)
@@ -3240,12 +3515,26 @@ Partial Class Compras_eFacturas
e.Row.ToolTip = "Compra registrada"
e.Row.Cells(4).ForeColor = Drawing.Color.Green
If e.Row.DataKey("CveIE").ToEntero <= 0 Or Boolean.Parse(e.Row.DataKey("Manual")) = True Then
e.Row.Cells(6).Controls.Clear()
Dim LiteralVincular As New Literal
If UsuarioActual.TienePermisoProceso(286) Then ' permiso vinculación manual
LiteralVincular.Text = $"<a title='Vinculación manual' onclick="" { $"$('#HdnIdDocumento').val('{ e.Row.DataKey("IdDocumento") }');AbrirVentana('/Bancos/PopUpBuscarIE.aspx?OPCION=Complementos',800,600,'N');" }"" ><i class='fa fa-external-link' aria-hidden='true'></i></a>"
Else
LiteralVincular.Text = "-"
End If
e.Row.Cells(6).Controls.Add(LiteralVincular)
End If
Else
e.Row.Cells(4).Text = "<i class='fa fa-check-circle' aria-hidden='true'></i>"
e.Row.ToolTip = "Factura recibida sin registrar"
End If
Else
e.Row.Cells(4).Text = "<i class='fa red fa-ban' aria-hidden='true'></i>"
e.Row.ToolTip = "No se encontro el Folio Fiscal en el sistema"