diff --git a/App_Code/ClsCompras.vb b/App_Code/ClsCompras.vb
index cc76dc5f6..11f45eec7 100644
--- a/App_Code/ClsCompras.vb
+++ b/App_Code/ClsCompras.vb
@@ -439,7 +439,8 @@ Public Class ClsCompras
Optional AplicaCostoIndirecto As Integer = -1, Optional EstatusAlmacen As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveTipoGasto As Integer = -1,
Optional AF_Medida As Integer = -1, Optional AF_TipoMantenimiento As Integer = -1, Optional Referencia As String = "", Optional OtrosGastos As Decimal = 0,
Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0,
- Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0, Optional IEPSPSIVAPorcentaje As Double = 0, Optional NoDeducible As Boolean = False) As Boolean
+ Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0, Optional IEPSPSIVAPorcentaje As Double = 0,
+ Optional NoDeducible As Boolean = False, Optional CveContratoDetalle As Integer = -1) As Boolean
Dim Retorno As Boolean = False
@@ -482,6 +483,7 @@ Public Class ClsCompras
.Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje
.Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje
.Add("@NoDeducible", SqlDbType.Bit).Value = NoDeducible
+ .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle
End With
Try
diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb
index d57f54cd8..bcb4c4ff5 100644
--- a/App_Code/ClsContratos.vb
+++ b/App_Code/ClsContratos.vb
@@ -794,6 +794,9 @@ Public Class ClsContratos
Return Retorno
End Function
+
+
+
#End Region
#Region "C I C L O C O M E R C I A L"
@@ -1061,9 +1064,10 @@ Public Class ClsContratos
End Try
Return Retorno
- End Function
-
+ End Function
+
#End Region
+
#Region "Contratos detalles Avance"
Public Function GetContratosAvanceHistoricos(CveContrato As Integer, CveTipoPresupuesto As Integer, fecha As String) As Boolean
Dim Retorno = False
@@ -1275,6 +1279,30 @@ Public Class ClsContratos
#End Region
+#Region "CONTRATOS OBRA COMPRAS"
+
+ Public Function GetContratosObraCompras(CveContrato As Integer, CveEmpresa As Integer) As Boolean
+ Dim Retorno = False
+
+ DataAdapter("PA_Con_ContratosAvanceObraComprasGet")
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveContrato", SqlDbType.Int).Value = CveContrato
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+ Catch ex As Exception
+ OnError("Ocurrió un error al cargar los avances del Contrato.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
+ End Try
+
+ Return Retorno
+ End Function
+
+#End Region
+
+
#Region " S E C C I O N E S "
Public Function GetSecciones() As Boolean
Dim Retorno As Boolean = False
diff --git a/App_Code/ClsOC.vb b/App_Code/ClsOC.vb
index b12725805..026dd4995 100644
--- a/App_Code/ClsOC.vb
+++ b/App_Code/ClsOC.vb
@@ -1250,7 +1250,7 @@ Public Class ClsOC
pObservacion As String, pCveUsuario As Integer, Optional pCveOrdenCompraPadre As Integer = -1, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Double = 0,
Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0, Optional IVA As Double = 0, Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional Total As Double = 0,
Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0,
- Optional IEPSPSIVAPorcentaje As Double = 0, Optional CveVentaDetalleCotizacion As Integer = -1) As Boolean
+ Optional IEPSPSIVAPorcentaje As Double = 0, Optional CveVentaDetalleCotizacion As Integer = -1, Optional CveTipoGastoObra As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_OC_OrdenesCompraDetalleAdd")
@@ -1281,6 +1281,10 @@ Public Class ClsOC
.Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje
.Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje
.Add("@CveVentaDetalleCotizacion", SqlDbType.Int).Value = CveVentaDetalleCotizacion
+ .Add("@CveTipoGastoObra", SqlDbType.Int).Value = CveTipoGastoObra
+
+
+
End With
Try
@@ -1303,7 +1307,7 @@ Public Class ClsOC
pObservacion As String, pCveUsuario As Integer, pCveOrdenCompraDetalle As Integer, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Double = 0,
Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0, Optional IVA As Double = 0, Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional Total As Double = 0,
Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0,
- Optional IEPSPSIVAPorcentaje As Double = 0) As Integer
+ Optional IEPSPSIVAPorcentaje As Double = 0, Optional CveTipoGastoObra As Integer = -1) As Integer
Dim Retorno As Integer = -1
DataAdapter("PA_OC_OrdenesCompraDetalleUpdate")
@@ -1333,6 +1337,7 @@ Public Class ClsOC
.Add("@RetISRPorcentaje", SqlDbType.Float).Value = RetISRPorcentaje
.Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje
.Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje
+ .Add("@CveTipoGastoObra", SqlDbType.Int).Value = CveTipoGastoObra
End With
Try
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 0268da558..c628638aa 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -2679,7 +2679,7 @@ Partial Class Compras_Compras
TmpDT.Columns.Add("CveContrato", GetType(Integer))
TmpDT.Columns.Add("DifPSSat", GetType(Integer))
-
+ TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
GvPS.DataSource = TmpDT
@@ -5055,7 +5055,8 @@ Partial Class Compras_Compras
CveTipoGasto:=Row("CveTipoGasto").ToString.ToEntero, AF_Medida:=Row("AFMedida").ToString.ToEntero, AF_TipoMantenimiento:=Row("AFTipoMantenimiento").ToString.ToEntero, Referencia:=Referencia, OtrosGastos:=Row("OtrosGastos").ToString.ToDecimal,
RetIVA:=Row("RetIVA").ToString.ToDouble, RetISR:=Row("RetISR").ToString.ToDouble, IEPSPS:=Row("IEPSPS").ToString.ToDouble, IEPSPSIVA:=Row("IEPSPSIVA").ToString.ToDouble,
IVAPorcentaje:=Row("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=Row("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=Row("RetISRPorcentaje").ToString.ToDouble,
- IEPSPSPorcentaje:=Row("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=Row("IEPSPSIVAPorcentaje").ToString.ToDouble, NoDeducible:=If((Row("NoDeducible").ToString().ToUpper().Contiene("TRUE", "1")) AndAlso EsNoDeducible, True, False)) Then
+ IEPSPSPorcentaje:=Row("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=Row("IEPSPSIVAPorcentaje").ToString.ToDouble, NoDeducible:=If((Row("NoDeducible").ToString().ToUpper().Contiene("TRUE", "1")) AndAlso EsNoDeducible, True, False),
+ CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero) Then
ErrorDetalles = True
Exit For
@@ -11262,6 +11263,8 @@ Partial Class Compras_Compras
TmpDT.Columns.Add("DifPSSat", GetType(Integer))
+ TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
+
TmpDTOriginal = New DataTable
TmpDTOriginal.Columns.Add("Consec", GetType(Integer))
TmpDTOriginal.Columns.Add("Cantidad", GetType(Decimal))
@@ -11367,6 +11370,7 @@ Partial Class Compras_Compras
TmpDTOriginal.Columns.Add("NoDeducible", GetType(Boolean))
TmpDTOriginal.Columns.Add("Importe", GetType(Double))
+ TmpDTOriginal.Columns.Add("CveContratoDetalle", GetType(Double))
End Sub
@@ -15645,8 +15649,10 @@ Partial Class Compras_Compras
Dim CveOrdenCompraDetalle As Integer = dr("CveOrdenCompraDetalle").ToString.ToEntero
Dim EntregaDirecta As Integer = dr("EntregaDirecta").ToString.ToEntero
Dim CveSATPS As Integer = gvr.FCDropDownLost("DdlSATPS").SelectedValue.ToEntero
- Dim CveTipoGasto As Integer = -1
- Dim TipoGasto As String = ""
+
+ Dim CveTipoGasto As Integer = dr("CveTipoGastoObra").ToString.ToEntero
+ Dim TipoGasto As String = dr("TipoGasto").ToString
+ Dim CveContratoDetalle As Integer = dr("CveContratoDetalle").ToString.ToEntero
'[IPP] PROVISIONAL PARA TIPO GASTO
If GlobalDTTiposGastos(UsuarioActual.CveEmpresa) IsNot Nothing AndAlso GlobalDTTiposGastos(UsuarioActual.CveEmpresa).Rows.Count = 1 Then
@@ -15657,7 +15663,8 @@ Partial Class Compras_Compras
End If
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, CantidadF:=CantidadF, EntregaDirecta:=EntregaDirecta, CveSATPS:=CveSATPS, CveTipoGasto:=CveTipoGasto, TipoGasto:=TipoGasto)
+ 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)
'CARGA PE
Index = TmpDT.Rows.Count - 1
@@ -17896,7 +17903,7 @@ Partial Class Compras_Compras
Obs As String, PU As Double, Total As Double, IVA As Double, RetIVA As Double, RetISR As Double, IEPSPS As Double, IEPSPSIVA As Double, Descuento As Double, Optional CveOrdenCompraDetalle As Integer = -1, Optional TCalculaTotales As Boolean = True,
Optional PSCodigo As String = "-", Optional PSDescripcion As String = "-", Optional CantidadF As Double = -1, Optional EntregaDirecta As Integer = -1, Optional OtrosGastos As Double = 0,
Optional CveSATPS As Integer = -1, Optional CargaXml As Boolean = False, Optional CveTipoGasto As Integer = -1, Optional TipoGasto As String = "", Optional PorcentajeIVA As Double = 0,
- Optional PorcentajeIEPS As Double = 0, Optional PorcentajeRetIVA As Double = 0, Optional PorcentajeRetISR As Double = 0, Optional NoDeducible As Boolean = False) As Integer
+ Optional PorcentajeIEPS As Double = 0, Optional PorcentajeRetIVA As Double = 0, Optional PorcentajeRetISR As Double = 0, Optional NoDeducible As Boolean = False, Optional CveContratoDetalle As Integer = -1) As Integer
Dim Row As DataRow = Nothing
@@ -18017,6 +18024,8 @@ Partial Class Compras_Compras
Row("CveTipoGasto") = CveTipoGasto
Row("TipoGasto") = If(CveTipoGasto > 0, TipoGasto, "")
+ Row("CveContratoDetalle") = CveContratoDetalle
+
If UsuarioActual.Empresa.UsaAC Then
Row("CveProgramaOperativo") = DdlACGeneral1.SelectedValue.ToEntero
Row("CveUnidadAdministrativa") = DdlACGeneral2.SelectedValue.ToEntero
diff --git a/Contratos/ContratoAvance.aspx.vb b/Contratos/ContratoAvance.aspx.vb
index 0eeb183f3..0163feb42 100644
--- a/Contratos/ContratoAvance.aspx.vb
+++ b/Contratos/ContratoAvance.aspx.vb
@@ -460,7 +460,6 @@ Partial Class Contratos_ContratoAvance
Private Sub BtnDescargarGenerado_Click(sender As Object, e As EventArgs) Handles BtnDescargarGenerado.Click
-
GeneraAnexo(CveEstimacionNueva, NuemeroEstimacionNuevo, Now, DDlContratosEstimaciones.SelectedItem.Text)
End Sub
diff --git a/OC/OC.aspx b/OC/OC.aspx
index b2d5821c9..2c413b4c3 100644
--- a/OC/OC.aspx
+++ b/OC/OC.aspx
@@ -47,6 +47,10 @@
+
+
+
+
@@ -2642,6 +2646,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%# Eval("PU", "{0:N2}")%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3056,6 +3158,36 @@
}
+ function ValidateCant(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')));
+
+ }
+
+
+
+ function keydownenabledtab(event) {
+ var key = event.keyCode;
+
+
+ if (key == 9) {
+ return true;
+ } else {
+ event.preventDefault();
+ }
+
+ }
diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb
index 35b261248..41a611481 100644
--- a/OC/OC.aspx.vb
+++ b/OC/OC.aspx.vb
@@ -547,9 +547,27 @@ Partial Class OC
End Set
End Property
+
+
+ Private Property ContratoObraAplciado As Boolean
+ Get
+ If ViewState("ContratoObraAplciado") Is Nothing Then
+ Return False
+ Else
+ Return Boolean.Parse(ViewState("ContratoObraAplciado").ToString)
+ End If
+ End Get
+ Set(value As Boolean)
+ ViewState("ContratoObraAplciado") = value
+ End Set
+ End Property
+
+
+
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
+
If Not Page.IsPostBack Then
CargaDatosAgregarPS()
@@ -582,6 +600,7 @@ Partial Class OC
CargaDatos(CveOrdenCompra)
Else
+ LIContratos.Visible = True
EsNuevo = True
InicializarValores()
HlAgregarExcel.Visible = True
@@ -1065,6 +1084,8 @@ Partial Class OC
DtDetalle.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer))
+ DtDetalle.Columns.Add("CveTipoGastoObra", GetType(Integer))
+
'DtDetalle.Columns.Add("CveOrdenCompraDetalle", GetType(Integer))
' DtDetalle.Columns.Add("ClasificacionOG", GetType(String))
@@ -2150,7 +2171,7 @@ Partial Class OC
Private Sub AddPS(Cantidad As String, CvePS As Integer, PS As String, Observaciones As String, Importe As Double, Descuento As Double, Total As Double, CveUnidadMedida As Integer, IVAPS As Double, IEPSPS As Double, IEPSPSIVA As Double, CveClasificacion As Integer,
UM As String, Clasificacion As String, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, CodigoAF As String, CveActivoFijo As Integer, TipoDato As Integer,
CveOrdenCompraDetalle As Integer, CveOrdenCompra As Integer, IdCuentaPorEjercer As Integer, IdCuentaComprometido As Integer, CveProgramaOperativo As Integer, CveUnidadAdministrativa As Integer,
- CveFuenteFinanciamiento As Integer, CveTipoGasto As Integer, CveClasificacionOG As Integer, RetIVA As Double, RetISR As Double, Optional CveContratoDetalle As Integer = 0)
+ CveFuenteFinanciamiento As Integer, CveTipoGasto As Integer, CveClasificacionOG As Integer, RetIVA As Double, RetISR As Double, Optional CveContratoDetalle As Integer = -1, Optional CveTipoGastoObra As Integer = -1)
If DtDetalle IsNot Nothing Then
Dim dr As DataRow = DtDetalle.NewRow
@@ -2206,6 +2227,8 @@ Partial Class OC
dr("CveTipoGasto") = CveTipoGasto
dr("CveClasificacionOG") = CveClasificacionOG
dr("CveContratoDetalle") = CveContratoDetalle
+ dr("CveTipoGastoObra") = CveTipoGastoObra
+
DtDetalle.Rows.Add(dr)
DtDetalle.AcceptChanges()
@@ -2488,7 +2511,7 @@ Partial Class OC
IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble,
RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble,
RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble,
- IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) Then
+ IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero) Then
TieneError = True
Exit For
End If
@@ -2566,7 +2589,7 @@ Partial Class OC
dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, pCveOrdenCompraPadre:=CveOrdenCompraPadre, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble,
IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero,
IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble,
- IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero()) Then
+ IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero(), CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero) Then
TieneError = True
Exit For
End If
@@ -2679,7 +2702,7 @@ Partial Class OC
'inserto los nuevos detalles
If Not TieneError Then
For Each dr As DataRow In DtDetalle.FiltraParametros("TipoDato = 0").Rows
- If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero, dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=If(TipoOC = "REQ", -1, dr("CvePresupuestoEgreso").ToString.ToEntero), Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) Then
+ If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero, dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=If(TipoOC = "REQ", -1, dr("CvePresupuestoEgreso").ToString.ToEntero), Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero) Then
TieneError = True
Exit For
Else
@@ -3158,7 +3181,8 @@ Partial Class OC
RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble,
CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble,
RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble,
- IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) Then
+ IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble,
+ CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero) Then
HuboError = True
Exit For
End If
@@ -3199,7 +3223,7 @@ Partial Class OC
'CveOrdenCompra = objOrdenCompra.CveOrdenCompra
If Not HuboError Then
For Each dr As DataRow In DtDetalle.Rows
- If Not objOrdenCompra.AddOrdenCompraDetalle(objOrdenCompra.CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CveOrdenCompra, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) Then
+ If Not objOrdenCompra.AddOrdenCompraDetalle(objOrdenCompra.CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CveOrdenCompra, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveTipoGastoObra:=dr("CveTipoGastoObra").ToString.ToEntero) Then
HuboError = True
Exit For
End If
@@ -3751,6 +3775,15 @@ Partial Class OC
End If
End If
+ If ContratoObraAplciado Then
+ EditingRow.FCDropDownList("DdlClasificacion").Enabled = False
+ EditingRow.FCDropDownList("DdlPS").Enabled = False
+ EditingRow.FCDropDownList("CboUnidadMedidaEdit").Enabled = False
+ EditingRow.FCDropDownList("DdlProyectoEdit").Enabled = False
+ EditingRow.FCDropDownList("DdlSubProyectoEdit").Enabled = False
+ EditingRow.FCTextBox("LblEditCodigo").Enabled = False
+ End If
+
End Sub
Protected Sub GvD_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvD.RowUpdating
Dim Cantidad, Importe, Descuento As Double
@@ -7296,6 +7329,9 @@ Partial Class OC
End If
End If
+
+
+
DdlContratos.Items.Insert(0, New ListItem("Seleccione", "-1"))
UpContrato.Update()
End Sub
@@ -8230,4 +8266,118 @@ Partial Class OC
+ 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"))
+
+
+ DdlTipoGasto.Items.Clear()
+ DdlTipoGasto.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa)
+ DdlTipoGasto.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)
+
+
+ DtDetalle.Rows.Clear()
+
+ Dim CveTipoGastoObra As Integer = DdlTipoGasto.SelectedValue.ToEntero
+
+ 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")
+ Dim UMAbreviatura As String = GvRow.DataKey("Abreviatura").ToString
+
+ Dim SubProyecto As Integer = 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, CvePS, PS, PS, PU, 0, TotalPS,
+ CveUnidadMedida, IvaPS, IEPSPS, IEPSPSIVA, CveClasificacion, UMAbreviatura, Clasificacion, CveProyecto, Proyecto,
+ CveSubProyecto, SubProyecto, Codigo, -1, 0, -1, -1, IdCuentaPorEjercer,
+ IdCuentaComprometido, -1, -1, -1, -1,
+ -1, RetIVA, RetISR, CveContratoDetalle:=CveContratoDetalle, CveTipoGastoObra:=CveTipoGastoObra)
+
+
+ ContratoObraAplciado = True
+
+ End If
+
+ Next
+
+ CargaSuperior()
+ CargaDatosDetalles()
+
+
+ RegistraScript("$('#DivmodalConmtrato').modal('hide')")
+ UPPDetalle.Update()
+
+
+ End Sub
+
End Class