-
+
+
+
@@ -6607,6 +6614,26 @@
}
+
+
+
+ function ValidateCantCon(variable) {
+
+ var txt = $(variable);
+ var max = txt.data('cantidad');
+ var value = parseInt(txt.val());
+ if (value > max) {
+ txt.val(max);
+ }
+ if (value < 0) {
+ txt.val(0);
+ }
+
+ var importe = $('.txtimporte[data-cve="' + txt.data('cve') + '"]');
+ importe.val(parseFloat(txt.val()) * parseFloat(txt.data('pu')));
+
+ }
+
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index ef1b08555..401384bb9 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -1478,6 +1478,10 @@ Partial Class Compras_Compras
UpLnkPaqueteriaGuias.Update()
End If
+ If Not CveCompra > 0 And UsuarioActual.CveRol = 1 Then
+ LIContratos.Visible = True
+ End If
+
'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO
LblSaldoFactura.Text = If(CveCompra > 0, Saldo.FormatoNumero, TxtTotal.Text.FormatoNumero)
'cuando es factura con amortizacion, el importe a descontar es el saldo que se debe de aplicar para la amortizacion
@@ -20821,10 +20825,128 @@ Partial Class Compras_Compras
End Sub
- Protected Sub BtnAplicarContrato_Click(sender As Object, e As EventArgs)
+
+
+#Region "Contratos Obra"
+
+ Protected Sub LnkAcontratos_Click(sender As Object, e As EventArgs)
+
+
+ DdlContratosObra.Items.Clear()
+ DdlContratosObra.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}"))
+ DdlContratosObra.DataBind()
+ DdlContratosObra.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
+
+ DdlTipoGastoContrato.Items.Clear()
+ DdlTipoGastoContrato.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa)
+ DdlTipoGastoContrato.DataBind()
+ DdlTipoGasto.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
+ RegistraScript("$('#DivmodalConmtrato').modal('show')")
+ UpModalContrato.Update()
End Sub
+
+ Protected Sub DdlContratosCompras_SelectedIndexChanged(sender As Object, e As EventArgs)
+
+
+ If DdlContratosObra.SelectedValue.ToEntero > 0 Then
+ Dim ObjContratos As New ClsContratos()
+
+ If ObjContratos.GetContratosObraCompras(DdlContratosObra.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
+
+ If ObjContratos.DtResultados.Rows.Count > 0 Then
+ GvContratosControl.DataSource = ObjContratos.DtResultados
+ BtnAplicarContrato.Visible = True
+ Else
+ GvContratosControl.DataSource = Nothing
+ BtnAplicarContrato.Visible = False
+ End If
+
+ End If
+
+
+ ObjContratos.Dispose()
+
+ GvContratosControl.DataBind()
+
+ UpModalContrato.Update()
+ End If
+
+
+
+ End Sub
+
+
+ Protected Sub BtnAplicarContrato_Click(sender As Object, e As EventArgs)
+
+
+ TmpDT.Rows.Clear()
+
+ Dim CveTipoGastoObra As Integer = DdlTipoGastoContrato.SelectedValue.ToEntero
+ Dim TuipoGasto As String = DdlTipoGastoContrato.SelectedItem.Text
+
+ For Each GvRow As GridViewRow In GvContratosControl.Rows
+
+ Dim CveContratoDetalle As Integer = GvRow.DataKey("CveContratoDetalle").ToEntero
+
+ Dim Cantidad As Double = GvRow.FCTextBox("TxtCantidad").Text.ToDouble
+ Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero
+ Dim PS As String = GvRow.DataKey("PS")
+ Dim PU As Double = GvRow.DataKey("PU").ToDouble
+ Dim TotalPS As Double = GvRow.FCTextBox("TxtImporte").Text.ToDouble
+ Dim CveUnidadMedida As Integer = GvRow.DataKey("CveUnidadMedida").ToEntero
+ Dim UMAbreviatura As String = GvRow.DataKey("Abreviatura").ToString
+
+ Dim SubProyecto As String = GvRow.DataKey("SubProyecto")
+ Dim CveSubProyecto As Integer = GvRow.DataKey("CveSubProyecto").ToEntero
+ Dim Codigo As String = "" 'GvRow.DataKey("Codigo")
+
+ Dim Proyecto As String = GvRow.DataKey("Proyecto")
+ Dim CveProyecto As Integer = GvRow.DataKey("CveProyecto").ToEntero
+
+ Dim RetISR As Double = GvRow.DataKey("RetISR").ToString.ToDouble
+ Dim RetIVA As Double = GvRow.DataKey("RetIVA").ToString.ToDouble
+ Dim IvaPS As Double = GvRow.DataKey("IVA").ToString.ToDouble
+
+ Dim CveClasificacion As Integer = GvRow.DataKey("CveClasificacion").ToString.ToEntero
+ Dim Clasificacion As String = GvRow.DataKey("Clasificacion")
+
+
+ Dim IEPSPS As Double = GvRow.DataKey("IEPSPorcentaje").ToString.ToDouble
+ Dim IEPSPSIVA As Double = If(GvRow.DataKey("IEPSGrabaIVA").ToString = "True", IEPSPS, 0)
+
+ Dim IdCuentaPorEjercer As Integer = -1
+ Dim IdCuentaComprometido As Integer = -1
+
+
+
+
+ If Cantidad > 0 Then
+
+ AddPS(Cantidad, CveUnidadMedida, UMAbreviatura, CveClasificacion, Clasificacion, CvePS, PS, 1, CveSubProyecto.ToString, SubProyecto, Proyecto, CveProyecto.ToString, "", PU, PU * Cantidad, IvaPS, RetIVA, RetISR, IEPSPS, IEPSPSIVA, 0, CveContratoDetalle:=CveContratoDetalle,
+ CveTipoGasto:=CveTipoGastoObra, TipoGasto:=TuipoGasto)
+
+
+ 'ContratoObraAplciado = True
+
+ End If
+
+ Next
+
+ AddPS2()
+
+
+ RegistraScript("$('#DivmodalConmtrato').modal('hide')")
+
+
+
+ End Sub
+
+#End Region
+
Protected Sub ChkMostrarTodos_CheckedChanged(sender As Object, e As EventArgs)
CargaNCINV(ShowAllPendientes:=True)
UpFacturaNC.Update()
diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb
index a6b9a134c..8573e6e37 100644
--- a/Contratos/ContratoObra.aspx.vb
+++ b/Contratos/ContratoObra.aspx.vb
@@ -4622,7 +4622,7 @@ Partial Class Contratos_ContratoObra
CveUnidadMedida = GlobalDTUnidadesMedida(CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveUnidadMedida").ToString.ToEntero
End If
- If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, DrowPS("Codigo").ToString.Trim, "", "", DrowPS("Producto").ToString, DrowPS("PU").ToString.ToDouble, -1, 0, False, 0, False, If(TipoCargaPresupuesto = EnumTipoCargaPresupuesto.Ventas, True, False),
+ If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, DrowPS("Codigo").ToString.Trim, "", "", DrowPS("Producto").ToString, DrowPS("PU").ToString.ToDouble, 0, 0, False, 0, False, If(TipoCargaPresupuesto = EnumTipoCargaPresupuesto.Ventas, True, False),
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1, CveTipoPS:=2, CveSATPS:=-1, CveMarca:=-1, CveTamaƱo:=-1, CveMedida:=-1, CveRinTamaƱo:=-1, CveModelo:=-1, Litraje:=-1, IEPSPorcentaje:=-1, CveClasificacion2:=-1, CveClasificacionDetalle:=-1) > 0 Then
CvePS = ObjPS.CvePS
Else