diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 40a1431b5..dacf7db97 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -6960,8 +6960,31 @@ Partial Class Compras_Compras
Dim DTDistinct = DT.Copy
If UsuarioActual.Empresa.Funcionalidad(126) = "1" Then
+
+ For Each drowdis As DataRow In DTDistinct.Rows
+ If drowdis("CveTipoGasto").ToString = "" Then
+ drowdis("CveTipoGasto") = 0
+ End If
+ If drowdis("TipoGasto").ToString.Trim = "" Then
+ drowdis("TipoGasto") = "ND"
+
+ End If
+ Next
+
DTDistinct = DTDistinct.FiltraParametros("ISNULL(TipoAF, 0) <> 2", "", {"CveClasificacion", "Clasificacion", "SubProyecto", "CveSubProyecto", "CveTipoGasto", "TipoGasto"})
Else
+
+ For Each drowdis As DataRow In DTDistinct.Rows
+ If drowdis("CveTipoGasto").ToString = "" Then
+ drowdis("CveTipoGasto") = 0
+ End If
+ If drowdis("TipoGasto").ToString.Trim = "" Then
+ drowdis("TipoGasto") = "ND"
+
+ End If
+ Next
+ DTDistinct.AcceptChanges()
+
DTDistinct = DTDistinct.FiltraParametros("ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) = 0 And ISNULL(AplicaCostoIndirecto,0) <> 1", "", {"CveClasificacion", "Clasificacion", "SubProyecto", "CveSubProyecto", "CveTipoGasto", "TipoGasto"})
End If
'RMF, si es concepto relacionado a flete o importacion, no debe de afectar al gasto
@@ -17816,6 +17839,8 @@ Partial Class Compras_Compras
If UsuarioActual.Empresa.Tipo_CentroCosto <> 1 And UsuarioActual.Empresa.Tipo_CentroCosto <> 2 Then
DdlProyecto.SelectedValueExist(GvRow.DataKey("CveProyecto"))
+ Else
+ DdlProyecto.SelectedValueExist("-1")
End If
diff --git a/Contratos/ContratoAvance.aspx b/Contratos/ContratoAvance.aspx
index fdccdf370..2a42ad29a 100644
--- a/Contratos/ContratoAvance.aspx
+++ b/Contratos/ContratoAvance.aspx
@@ -8,8 +8,8 @@
width:100%;
}
.txtimporte{
- background: transparent;
- border: none;
+ /*background: transparent;*/
+ /*border: none;*/
}
.txtcant,.txtimporte,
@@ -183,14 +183,22 @@
-
+
-
+
+
+
+
+
+
+
+
+
@@ -254,115 +262,6 @@
-<%--
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <%# Eval("Cantidad", "{0:N2}")%>
-
-
-
-
- <%# Eval("Importe", "{0:N2}")%>
-
-
-
-
- <%# Eval("Cantidad_Ultima", "{0:N2}")%>
-
-
-
-
- <%# Eval("Importe_Ultima", "{0:N2}")%>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- --%>
@@ -473,6 +372,7 @@
});
});
});
+
function showmodalFile(obj) {
$('#' + obj).data("append", 'my-dropzone');<% Dim url = Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, "")%>
$('#' + obj).data("urlup", '<%= url%>/Ashx/SIGWeb.ashx?Metodo=Uploadfile');
@@ -481,38 +381,92 @@
ADDropzone(obj);
$('#dropmodal').modal();
}
- function ValidateCant(variable) {
+ function ValidateCant(opcion, cve) {
- var txt = $(variable);
- var max = txt.data('cantidad');
- var value = parseInt(txt.val());
- if (value > max) {
- txt.val(max);
+ var txtimporte = $('.txtimporte[data-cve="' + cve + '"]');
+ var txtPorcentaje = $('.txtporcentaje[data-cve="' + cve + '"]');
+ var txtCantidad = $('.txtcant[data-cve="' + cve + '"]');
+
+ var max = parseFloat(txtCantidad.data('cantidad'));
+ var pu = parseFloat(txtCantidad.data('pu'));
+ var cantidad = parseFloat(txtCantidad.val());
+
+
+
+
+ if (!Math.round10) {
+ Math.round10 = function (value, exp) {
+ return decimalAdjust('round', value, exp);
+ };
+ }
+
+ if (opcion == 2) {
+
+ if (txtimporte.val().toString().length > 0) {
+
+ var importe = parseFloat(txtimporte.val());
+ cantidad = parseFloat(importe / pu);
+ txtCantidad.val(cantidad);
+
+ }else{
+ cantidad = 0.0
+ txtCantidad.val('');
+
+ }
}
- if (value < 0) {
- txt.val(0);
+
+ if (opcion == 3) {
+
+ if (txtPorcentaje.val().toString().length > 0) {
+ var porcentaje = parseFloat(txtPorcentaje.val());
+ cantidad = (porcentaje * max / 100);
+ txtCantidad.val(cantidad);
+ } else {
+ cantidad = 0;
+ txtCantidad.val('');
+ }
}
- var importe = $('.txtimporte[data-cve="' + txt.data('cve') + '"]');
- importe.val(parseFloat(txt.val()) * parseFloat(txt.data('pu')));
- //FormatoMoneda2(importe);
+ if (cantidad > max) {
+ txtCantidad.val(max);
+ cantidad = max;
+ }
+ if (cantidad < 0) {
+ txtCantidad.val(0);
+ }
- //if (parseInt(txt.val()) > 0) {
-
- // $($(txt.parent()).parent()).find(".linkfile").removeClass("hidden");
-
- //} else {
-
- // var ocultar = $($(txt.parent()).parent()).find(".linkfile");
-
- // if (!ocultar.hasClass("hidden")) {
- // ocultar.addClass("hidden");
- // }
- //}
+ if (cantidad > 0) {
+ txtimporte.val(cantidad * pu);
+ txtPorcentaje.val(Math.round10(cantidad * 100 / max, -2));
+ } else {
+ txtimporte.val('');
+ txtPorcentaje.val('');
+ }
+
+
}
- //);
+
+ function decimalAdjust(type, value, exp) {
+ // Si el exp no está definido o es cero...
+ if (typeof exp === 'undefined' || +exp === 0) {
+ return Math[type](value);
+ }
+ value = +value;
+ exp = +exp;
+ // Si el valor no es un número o el exp no es un entero...
+ if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
+ return NaN;
+ }
+ // Shift
+ value = value.toString().split('e');
+ value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
+ // Shift back
+ value = value.toString().split('e');
+ return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
+ }
+
diff --git a/Contratos/ContratoAvance.aspx.vb b/Contratos/ContratoAvance.aspx.vb
index 15d5ccce3..a2271dff1 100644
--- a/Contratos/ContratoAvance.aspx.vb
+++ b/Contratos/ContratoAvance.aspx.vb
@@ -136,10 +136,8 @@ Partial Class Contratos_ContratoAvance
Private Sub CargaContrato()
DdlContratos.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}"))
- DdlContratos.DataBind()
-
- 'DDlContratosEstimaciones.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}"))
- 'DDlContratosEstimaciones.DataBind()
+ DdlContratos.DataBind()
+
End Sub
@@ -189,8 +187,16 @@ Partial Class Contratos_ContratoAvance
e.Row.FCTextBox("TxtCantidad").Visible = (fecha = "")
e.Row.FCLinkButton("LnkAnexo").Visible = Not (fecha = "")
- If e.Row.DBCampo("CveContratoDetalle").ToString.ToEntero = 0 Then
+ If e.Row.DBCampo("CveContratoDetalle").ToString.ToEntero = 0 Then
+
e.Row.FCTextBox("TxtCantidad").Visible = False
+ e.Row.FCTextBox("TxtImporte").Visible = False
+ e.Row.FCTextBox("TxtPorcentaje").Visible = False
+
+
+
+
+ 'txtimporte
e.Row.FCLinkButton("LnkAnexo").Visible = False
If e.Row.DBCampo("CveSubFamilias").ToString.ToEntero = 0 Then
@@ -221,9 +227,17 @@ Partial Class Contratos_ContratoAvance
LnkGuardarAvance.Visible = True
+ e.Row.FCTextBox("TxtCantidad").Attributes.Add("onkeyup", $"ValidateCant(1,{e.Row.DataKey("CveContratoDetalle")})")
+ e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"ValidateCant(2,{e.Row.DataKey("CveContratoDetalle")})")
+ e.Row.FCTextBox("TxtPorcentaje").Attributes.Add("onkeyup", $"ValidateCant(3,{e.Row.DataKey("CveContratoDetalle")})")
+
+
If e.Row.DataKey("CantidadMax").ToDouble = 0 Then
LnkAnexo.Visible = False
e.Row.FCTextBox("TxtCantidad").Visible = False
+ e.Row.FCTextBox("TxtImporte").Visible = False
+ e.Row.FCTextBox("TxtPorcentaje").Visible = False
+
LnkGuardarAvance.Visible = False
End If
diff --git a/Contratos/ContratoObra.aspx b/Contratos/ContratoObra.aspx
index 6efbb60f6..d004923ae 100644
--- a/Contratos/ContratoObra.aspx
+++ b/Contratos/ContratoObra.aspx
@@ -740,7 +740,7 @@
-
+
@@ -962,7 +962,7 @@
-
+
diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb
index 43ff3f4ee..7f2e52877 100644
--- a/Contratos/ContratoObra.aspx.vb
+++ b/Contratos/ContratoObra.aspx.vb
@@ -953,6 +953,13 @@ Partial Class Contratos_ContratoObra
Exit Sub
End If
+ If TxtPorAmortizacionAnticipo.Text.ToDecimal < TxtPorAnticipo.Text.ToDecimal Then
+ Alert("El porcentaje de amortización no debe de ser menor al porcentaje de anticipo.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+
+
+
Dim TieneError = False
Dim Modificado = False
' Dim Extension = Session("FileExtension").ToString