Merge - Recepcion Usados
This commit is contained in:
@@ -6698,8 +6698,15 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
Next
|
||||
|
||||
'obtengo si hay servicios
|
||||
Dim CostosIndirectosTardados As Decimal = TmpDT.SUMD("Total", "ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) = 0 And ISNULL(AplicaCostoIndirecto,0) <> 1 And ISNULL(CveTipoPS,0) = 1")
|
||||
'consideracion, si la oc, se le agrego un servicio y este no se cargo en la entrada al almacen.
|
||||
If CostoIndirectoAcum176 = 0 AndAlso CostosIndirectosTardados > 0 Then
|
||||
CostosIndirectosTardados = CostosIndirectosTardados * TCO
|
||||
End If
|
||||
|
||||
'calcula la diferencia entre lo recibido por la OC, considerando costos indirectos y lo que se ingresaria en la compra
|
||||
SumatoriaOCINV = SumatoriaInventario - (TmpDT.SUMD("Total") * TCO).RoundSQL 'sumatoria de la factura
|
||||
SumatoriaOCINV = SumatoriaInventario - (TmpDT.SUMD("Total") * TCO).RoundSQL + CostosIndirectosTardados 'sumatoria de la factura
|
||||
If SumatoriaOCINV.RoundSQL <> 0 Then
|
||||
' se abona el costo, cambiamos su naturaleza
|
||||
'SumatoriaOCINV = -SumatoriaOCINV
|
||||
@@ -17669,7 +17676,7 @@ Partial Class Compras_Compras
|
||||
ViewState("IVAPS") = Drr("IVA").ToString().ToDouble()
|
||||
DdlProyecto.SelectedValueExist(Drr("CveProyecto"))
|
||||
|
||||
'DdlIVA.Enabled = True
|
||||
DdlIVA.Enabled = True
|
||||
|
||||
If Not Modalidad = "U" Then
|
||||
|
||||
@@ -17989,13 +17996,13 @@ Partial Class Compras_Compras
|
||||
Row("IEPSPSPorcentaje") = PorcentajeIEPS
|
||||
Else
|
||||
'If DdlIVA.SelectedValue.ToDouble = 0 Then Row("IVA") = 0 Else Row("IVA") = Math.Round(IVA * Total, DecimalesPermitidos)
|
||||
Row("IVA") = Math.Round(IVA * Total, DecimalesPermitidos)
|
||||
Row("IVA") = Math.Round(IVA * Total, 2)
|
||||
Row("IVAPorcentaje") = IVA
|
||||
Row("RetIVA") = Math.Round(RetIVA * Total, DecimalesPermitidos)
|
||||
Row("RetIVA") = Math.Round(RetIVA * Total, 2)
|
||||
Row("RetIVAPorcentaje") = RetIVA
|
||||
Row("RetISR") = Math.Round(RetISR * Total, DecimalesPermitidos)
|
||||
Row("RetISR") = Math.Round(RetISR * Total, 2)
|
||||
Row("RetISRPorcentaje") = RetISR
|
||||
Row("IEPSPS") = Math.Round(IEPSPS * Total, DecimalesPermitidos)
|
||||
Row("IEPSPS") = Math.Round(IEPSPS * Total, 2)
|
||||
Row("IEPSPSPorcentaje") = IEPSPS
|
||||
End If
|
||||
Row("ImporteConImpuestos") = (Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble) + Row("IVA").ToString.ToDouble + Row("IEPSPS").ToString.ToDouble - (Row("RetIVA").ToString.ToDouble + Row("RetISR").ToString.ToDouble)
|
||||
|
||||
@@ -214,7 +214,7 @@
|
||||
</ItemTemplate>
|
||||
<ItemStyle HorizontalAlign="Left" />
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Importe">
|
||||
<asp:TemplateField HeaderText="Importe" ItemStyle-Width="125px">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlTotal" runat="server" Text='<%# String.Format("{0} {1}", Eval("Total", "{0:N2}"), Eval("Abreviatura")) %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
@@ -555,7 +555,7 @@
|
||||
<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"
|
||||
DataKeyNames="CveFactura,CveCompra,CveIE,Fecha,FechaPago,ImpPagado,CvePrePolizaDetalle"
|
||||
data-sort="true" Width="100%" EmptyDataText="No se encontró registros con la información del complemento de pago"
|
||||
ShowHeaderWhenEmpty="true" AutoGenerateColumns="False">
|
||||
<Columns>
|
||||
@@ -570,6 +570,13 @@
|
||||
|
||||
<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}" />
|
||||
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LblCveIE" runat="server" />
|
||||
<asp:Label ID="LblCvePrePolizaDetalle" runat="server" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
@@ -2697,17 +2697,36 @@ Partial Class Compras_eFacturas
|
||||
|
||||
namespaces.AddNamespace(XMLDoc.DocumentElement.Prefix, "http://www.sat.gob.mx/cfd/3")
|
||||
namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital")
|
||||
namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos")
|
||||
|
||||
' namespaces.AddNamespace("pago10", "http://www.sat.gob.mx/Pagos")
|
||||
nodeComp = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", XMLDoc.DocumentElement.Prefix), namespaces)
|
||||
|
||||
|
||||
nodeaGral = XMLDoc.SelectSingleNode(String.Format("//{0}:Comprobante", XMLDoc.DocumentElement.Prefix), namespaces)
|
||||
|
||||
nodeTFD = nodeComp.SelectSingleNode(String.Format("//{0}:TimbreFiscalDigital", "tfd"), namespaces)
|
||||
nodePagos = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos/{0}:Pago", "pago10"), namespaces)
|
||||
nodePagos2 = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos", "pago10"), namespaces)
|
||||
'Monto = ValorXML(nodePagos, "Monto").ToDecimal
|
||||
|
||||
Dim nodePago As XmlNodeList = nodePagos.SelectNodes(String.Format("//{0}:DoctoRelacionado", "pago10"), namespaces)
|
||||
Dim PrefijoPagos As String = ""
|
||||
|
||||
For Each nodoPrefijo As XmlNode In nodeComp.ChildNodes
|
||||
If nodoPrefijo.Prefix <> "tfd" Then
|
||||
PrefijoPagos = nodoPrefijo.Prefix
|
||||
End If
|
||||
Next
|
||||
|
||||
namespaces.AddNamespace(PrefijoPagos, "http://www.sat.gob.mx/Pagos")
|
||||
nodeComp = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", XMLDoc.DocumentElement.Prefix), namespaces)
|
||||
|
||||
|
||||
nodePagos = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos/{0}:Pago", PrefijoPagos), namespaces)
|
||||
nodePagos2 = nodeComp.SelectSingleNode(String.Format("//{0}:Pagos", PrefijoPagos), namespaces)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
' Dim nodePago As XmlNodeList = nodePagos.SelectNodes(String.Format("//{0}:DoctoRelacionado", "pago10"), namespaces)
|
||||
|
||||
SeriePago = ValorXML(nodeaGral, "Serie")
|
||||
FolioPago = ValorXML(nodeaGral, "Folio")
|
||||
@@ -2735,11 +2754,12 @@ Partial Class Compras_eFacturas
|
||||
DTDocumentosRelacionados.Columns.Add("FechaPago", GetType(Date))
|
||||
DTDocumentosRelacionados.Columns.Add("CveMetodoPago", GetType(Integer))
|
||||
DTDocumentosRelacionados.Columns.Add("SerieFolioCompra")
|
||||
DTDocumentosRelacionados.Columns.Add("CvePrePolizaDetalle", GetType(Integer))
|
||||
|
||||
|
||||
|
||||
Dim nodePagosN As XmlNodeList
|
||||
nodePagosN = nodeComp.SelectNodes(String.Format("//{0}:Pagos", "pago10"), namespaces)
|
||||
nodePagosN = nodeComp.SelectNodes(String.Format("//{0}:Pagos", PrefijoPagos), namespaces)
|
||||
|
||||
|
||||
|
||||
@@ -2775,7 +2795,7 @@ Partial Class Compras_eFacturas
|
||||
|
||||
|
||||
Dim ObjCompraFolios As New ClsCompras
|
||||
If ObjCompraFolios.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa, OP:=If(CveComplementoPagoCompra > 0, 2, 1), CveFactura:=CveFacturaComplemento) Then
|
||||
If ObjCompraFolios.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace($"{PrefijoPagos}:", ""), UsuarioActual.CveEmpresa, OP:=If(CveComplementoPagoCompra > 0, 2, 1), CveFactura:=CveFacturaComplemento) Then
|
||||
'
|
||||
'.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa) Then
|
||||
If ObjCompraFolios.DtResultados.Rows.Count > 0 Then
|
||||
@@ -2789,7 +2809,7 @@ Partial Class Compras_eFacturas
|
||||
dRow2("CveFactura") = drow("CveFactura").ToString.ToEntero
|
||||
dRow2("CveMetodoPago") = drow("CveMetodoPago").ToString.ToEntero
|
||||
dRow2("SerieFolioCompra") = drow("SerieFolioCompra").ToString
|
||||
|
||||
dRow2("CvePrePolizaDetalle") = drow("CvePrePolizaDetalle").ToString
|
||||
|
||||
If drow("CveIE").ToString.ToEntero > 0 Then
|
||||
|
||||
@@ -2860,7 +2880,7 @@ Partial Class Compras_eFacturas
|
||||
|
||||
Dim TieneRegistros As Boolean = False
|
||||
|
||||
If ObjCompras.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa) Then
|
||||
If ObjCompras.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", "").Replace("pagos10:", ""), UsuarioActual.CveEmpresa) Then
|
||||
GvVincularPago.DataSource = ObjCompras.DtResultados
|
||||
|
||||
If ObjCompras.DtResultados.Rows.Count > 0 Then
|
||||
@@ -2906,6 +2926,9 @@ Partial Class Compras_eFacturas
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
|
||||
|
||||
If MSGComplemento.Trim.Length > 0 Then
|
||||
' BtnVincularPago.Visible = False
|
||||
ViculacionConPUE = True
|
||||
@@ -2954,11 +2977,30 @@ Partial Class Compras_eFacturas
|
||||
|
||||
|
||||
GvVincularPago.DataBind()
|
||||
UpVincularPago.Update()
|
||||
|
||||
|
||||
|
||||
ListaComprasPUE = ListaComprasPUEInterna
|
||||
|
||||
|
||||
If DivVincularPagoManualmente.Visible Then
|
||||
|
||||
For Each GvRowValidaCompra As GridViewRow In GVPDocumentosRelacionadosPagos.Rows
|
||||
If GvRowValidaCompra.DataKey("CveCompra").ToEntero > 0 Then
|
||||
DivVincularPagoManualmente.Visible = True
|
||||
Exit For
|
||||
Else
|
||||
DivVincularPagoManualmente.Visible = False
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
UpVincularPago.Update()
|
||||
|
||||
|
||||
RegistraScript("$('#ModalVincularPago').modal('show')", "VincularPagoModalShow")
|
||||
End Sub
|
||||
|
||||
@@ -2982,13 +3024,27 @@ Partial Class Compras_eFacturas
|
||||
ObjCompra.IniciaTransacSQL()
|
||||
|
||||
|
||||
For Each Gv As GridViewRow In GvVincularPago.Rows
|
||||
For Each Gv As GridViewRow In GVPDocumentosRelacionadosPagos.Rows
|
||||
|
||||
If Not ObjCompra.AddComplementoPago(Gv.DataKey("CveIE").ToEntero, Gv.DataKey("CveCompra").ToEntero, Gv.DataKey("Monto").ToDecimal, Gv.DataKey("CvePrePolizaDetalle").ToEntero, CveFacturaPago) > 0 Then
|
||||
TieneError = True
|
||||
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
|
||||
@@ -3001,6 +3057,7 @@ Partial Class Compras_eFacturas
|
||||
|
||||
If ViculacionConPUE Then
|
||||
|
||||
|
||||
For Each CveCompraVinculada In ListaComprasPUE
|
||||
objEventos.AddEventoBitacora($"Complemento { ComplementoConPUE } vinculado manualmente (Compra PUE) ", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=CveCompraVinculada)
|
||||
Next
|
||||
@@ -3020,6 +3077,8 @@ Partial Class Compras_eFacturas
|
||||
|
||||
ObjCompra.Commit()
|
||||
|
||||
HdnCveIE.Value = ""
|
||||
|
||||
Alert("El pago fue vinculado correctamente", TipoMensaje.MsgInformacion)
|
||||
RegistraScript("$('#ModalVincularPago').modal('hide')", "VincularPagoModalHide")
|
||||
CargaDatos()
|
||||
@@ -3042,33 +3101,83 @@ Partial Class Compras_eFacturas
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnVincularManualmente_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
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
|
||||
GvVincularPago.DataSource = ObjCompras.DtResultados
|
||||
If ObjCompras.DtResultados.Rows.Count > 0 Then
|
||||
SerieFolioIE = ObjCompras.DtResultados.Rows(0)("SerieFolio").ToString
|
||||
End If
|
||||
ImportePago = ObjCompras.DtResultados.SUMD("Monto")
|
||||
|
||||
'GvVincularPago.DataSource = ObjCompras.DtResultados
|
||||
|
||||
'If ObjCompras.DtResultados.Rows.Count > 0 Then
|
||||
' SerieFolioIE = ObjCompras.DtResultados.Rows(0)("SerieFolio").ToString
|
||||
'End If
|
||||
|
||||
|
||||
'ImportePago = ObjCompras.DtResultados.SUMD("Monto")
|
||||
|
||||
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
|
||||
Exit For
|
||||
Else
|
||||
ErrorVinculacion = True
|
||||
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Else
|
||||
ErrorVinculacion = True
|
||||
End If
|
||||
|
||||
ImporteIES = ObjCompras.DtResultados.FiltraParametros("CveIE > 0").SUM("Importe")
|
||||
ObjCompras.Dispose()
|
||||
If Not ErrorVinculacion Then
|
||||
ImporteIES = ObjCompras.DtResultados.FiltraParametros("CveIE > 0").SUM("Importe")
|
||||
ObjCompras.Dispose()
|
||||
|
||||
BtnVincularPago.Visible = True
|
||||
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
|
||||
|
||||
LblSerieFolioPago.Text = $"{SeriePago}-{FolioPago}"
|
||||
LblImportePago.Text = ImportePago.FormatoNumero
|
||||
'LblSerieFolioIE.Text = SerieFolioIE
|
||||
LblImporteIE.Text = ImporteIES.FormatoNumero
|
||||
|
||||
GvVincularPago.DataBind()
|
||||
UpVincularPago.Update()
|
||||
ObjCompras.Dispose()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GVPDocumentosRelacionadosPagos_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GVPDocumentosRelacionadosPagos.RowCreated
|
||||
|
||||
Reference in New Issue
Block a user