Verificar el producto y la cantidad si el subproyecto tienen contrato
This commit is contained in:
@@ -5400,12 +5400,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row col-md-12" align="right" runat="server" id="divBusqueda" visible="false">
|
||||
<input type="text" id="TxtBusqueda3" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda3','{0}');", GvContratosControl.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda3','{0}');", GvContratosControl.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<asp:GridView ID="GvContratosControl" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron partidas"
|
||||
DataKeyNames="CveContratoDetalle,CvePS,PS,Cantidad,PU,CantidadMax,CveUnidadMedida,Abreviatura,CveSubProyecto,SubProyecto,Codigo,CveProyecto,Proyecto,IVA,RetISR,RetIVA,IEPSPorcentaje,IEPSGrabaIVA,CveClasificacion,Clasificacion"
|
||||
CssClass="table GVEstimacion table-advance table-hover" GridLines="None" Width="100%">
|
||||
CssClass="table GVEstimacion table-advance table-hover Widthall ScrollAD mysmallbtn" GridLines="None" Width="100%">
|
||||
<Columns>
|
||||
|
||||
<asp:TemplateField HeaderText="Producto">
|
||||
@@ -5439,6 +5443,9 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group form-md-line-input input-iconright" style="text-align:right!important">
|
||||
<asp:CheckBox ID="ChkContinualAgregandoControl" runat="server" TextAlign="Left" Text="Continuar agregando" CssClass="form-control" Checked="true" Visible="false"/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18126,46 +18126,86 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
|
||||
ActualizaTotales = True
|
||||
Select Case Modalidad
|
||||
Case "A" 'ADD
|
||||
|
||||
Dim SATClavePS = -1
|
||||
Dim PSRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
If PSRow IsNot Nothing Then
|
||||
SATClavePS = PSRow("SATClavePS").ToString.ToEntero
|
||||
End If
|
||||
Dim IVA As Double
|
||||
If chkImportacion.Checked Then
|
||||
IVA = (txtImportacion.Text.Trim.ToDouble / (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.Trim.ToDouble))
|
||||
Dim ObjContratos As New ClsContratos
|
||||
Dim TieneError As Boolean = False
|
||||
Dim Mensaje As String = ""
|
||||
Dim dttemp As DataTable = GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString))
|
||||
If dttemp IsNot Nothing AndAlso dttemp.Rows.Count > 0 Then
|
||||
Dim drContrato As DataRow = dttemp.Rows(0)
|
||||
If ObjContratos.GetContratosDetalle(drContrato("CveContrato").ToString.ToEntero) Then
|
||||
Dim dtContratodetalle As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlPS.SelectedValue.ToString))
|
||||
If dtContratodetalle IsNot Nothing AndAlso dtContratodetalle.Rows.Count > 0 Then
|
||||
Dim drContratoDetalle As DataRow = dtContratodetalle(0)
|
||||
If Convert.ToBoolean(drContratoDetalle("LimitarCantidad")) Then
|
||||
If ObjContratos.GetReporteContratosAvancesDetalleControl(drContrato("CveContrato").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
Dim dtContratodetalleControl As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlPS.SelectedValue.ToString))
|
||||
If dtContratodetalleControl IsNot Nothing AndAlso dtContratodetalleControl.Rows.Count > 0 Then
|
||||
Dim drContratoDetalleControl As DataRow = dtContratodetalleControl(0)
|
||||
If TxtCantidad.Text.Trim.ToDouble > drContratoDetalleControl("FaltanteCantidad").ToString.ToDouble Then
|
||||
Mensaje = String.Format("La cantidad del Producto/Servicio debe ser menor o igual a {0}", drContratoDetalleControl("FaltanteCantidad").ToString)
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
Mensaje = "Este producto no pertence al contrato seleccionado"
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
Mensaje = "Error al consultar el contrato"
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)
|
||||
Mensaje = "Este producto no pertence al contrato seleccionado"
|
||||
TieneError = True
|
||||
End If
|
||||
AddPS(TxtCantidad.Text.Trim.ToDouble, ddlUM.SelectedValue.ToEntero, ddlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, HdnTipoPS.Value.ToEntero,
|
||||
DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, Total, IVA,
|
||||
TxtRetIVAModal.Text.ToDouble / 100, TxtRetISRModal.Text.ToDouble / 100, TxtIEPSModal.Text.ToDouble / 100, 0, TxtDescuentoModal.Text.ToDouble, OtrosGastos:=TxtOtrosGastos.Text.ToDouble, CveTipoGasto:=DdlTipoGasto.SelectedValue.ToEntero, TipoGasto:=DdlTipoGasto.SelectedItem.Text,
|
||||
NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS)
|
||||
Else
|
||||
Mensaje = "Error al consultar el contrato"
|
||||
|
||||
AddPS2()
|
||||
LimpiaAgregar()
|
||||
End If
|
||||
End If
|
||||
If Not TieneError Then
|
||||
Select Case Modalidad
|
||||
Case "A" 'ADD
|
||||
|
||||
If ChkAgregar.Checked = True And Modalidad = "A" Then
|
||||
RegistraScript("displayToastr(1);", "display")
|
||||
Else
|
||||
Dim SATClavePS = -1
|
||||
Dim PSRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
If PSRow IsNot Nothing Then
|
||||
SATClavePS = PSRow("SATClavePS").ToString.ToEntero
|
||||
End If
|
||||
Dim IVA As Double
|
||||
If chkImportacion.Checked Then
|
||||
IVA = (txtImportacion.Text.Trim.ToDouble / (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.Trim.ToDouble))
|
||||
Else
|
||||
IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)
|
||||
End If
|
||||
AddPS(TxtCantidad.Text.Trim.ToDouble, ddlUM.SelectedValue.ToEntero, ddlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, HdnTipoPS.Value.ToEntero,
|
||||
DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, Total, IVA,
|
||||
TxtRetIVAModal.Text.ToDouble / 100, TxtRetISRModal.Text.ToDouble / 100, TxtIEPSModal.Text.ToDouble / 100, 0, TxtDescuentoModal.Text.ToDouble, OtrosGastos:=TxtOtrosGastos.Text.ToDouble, CveTipoGasto:=DdlTipoGasto.SelectedValue.ToEntero, TipoGasto:=DdlTipoGasto.SelectedItem.Text,
|
||||
NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS)
|
||||
|
||||
AddPS2()
|
||||
LimpiaAgregar()
|
||||
|
||||
If ChkAgregar.Checked = True And Modalidad = "A" Then
|
||||
RegistraScript("displayToastr(1);", "display")
|
||||
Else
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
|
||||
End If
|
||||
|
||||
Case "U" 'UPDATE
|
||||
UpdatePS()
|
||||
Alert("Concepto actualizado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
|
||||
End If
|
||||
End Select
|
||||
ActualizaTotales = False
|
||||
|
||||
Case "U" 'UPDATE
|
||||
UpdatePS()
|
||||
Alert("Concepto actualizado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
|
||||
End Select
|
||||
ActualizaTotales = False
|
||||
If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero)
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero)
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
CompruebaAgregar()
|
||||
GuardaAC()
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
CompruebaAgregar()
|
||||
GuardaAC()
|
||||
End If
|
||||
Else
|
||||
Alert(Mensaje, TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
'If UsuarioActual.Empresa.Funcionalidad(577).ToString = "1" Then
|
||||
@@ -20786,9 +20826,17 @@ Partial Class Compras_Compras
|
||||
If ObjContratos.DtResultados.Rows.Count > 0 Then
|
||||
GvContratosControl.DataSource = ObjContratos.DtResultados
|
||||
BtnAplicarContrato.Visible = True
|
||||
divBusqueda.Visible = True
|
||||
ChkContinualAgregandoControl.Visible = True
|
||||
ChkContinualAgregandoControl.Checked = True
|
||||
|
||||
Else
|
||||
GvContratosControl.DataSource = Nothing
|
||||
BtnAplicarContrato.Visible = False
|
||||
divBusqueda.Visible = False
|
||||
ChkContinualAgregandoControl.Visible = False
|
||||
ChkContinualAgregandoControl.Checked = False
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -20863,11 +20911,9 @@ Partial Class Compras_Compras
|
||||
Next
|
||||
|
||||
AddPS2()
|
||||
|
||||
|
||||
RegistraScript("$('#DivmodalConmtrato').modal('hide')")
|
||||
|
||||
|
||||
If Not ChkContinualAgregandoControl.Checked Then
|
||||
RegistraScript("$('#DivmodalConmtrato').modal('hide')")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
35
OC/OC.aspx
35
OC/OC.aspx
@@ -2747,33 +2747,33 @@
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row col-md-12" align="right" runat="server" id="divBusqueda" visible="false">
|
||||
<input type="text" id="TxtBusqueda3" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda3','{0}');", GvContratosControl.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda3','{0}');", GvContratosControl.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<asp:GridView ID="GvContratosControl" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron partidas"
|
||||
DataKeyNames="CveContratoDetalle,CvePS,PS,Cantidad,PU,CantidadMax,CveUnidadMedida,Abreviatura,CveSubProyecto,SubProyecto,Codigo,CveProyecto,Proyecto,IVA,RetISR,RetIVA,IEPSPorcentaje,IEPSGrabaIVA,CveClasificacion,Clasificacion"
|
||||
CssClass="table GVEstimacion table-advance table-hover" GridLines="None" Width="100%">
|
||||
CssClass="table GVEstimacion table-advance table-hover Widthall ScrollAD mysmallbtn" GridLines="None" Width="100%">
|
||||
<Columns>
|
||||
|
||||
<asp:TemplateField HeaderText="Producto">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LblPS" runat="server" CssClass="Texto" Text='<%# Eval("PS")%>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Cant. Max" ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<span><%# Eval("CantidadMax", "{0:N2}")%></span>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Cantidad">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtCantidad" Text="" CssClass="txtcant" onkeyup="ValidateCant(this)" type="number" step="any"
|
||||
data-cantidad='<%# Eval("CantidadMax")%>' data-pu='<%# Eval("PU")%>' data-cve='<%# Eval("CveContratoDetalle") %>'
|
||||
Width="70" runat="server"></asp:TextBox>
|
||||
<asp:Label ID="LblPS" runat="server" CssClass="Texto" Text='<%# Eval("PS")%>' Width="250px"></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField HeaderText="PU" ItemStyle-HorizontalAlign="Right">
|
||||
<asp:TemplateField HeaderText="Cantidad">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtCantidad" Text="" CssClass="txtcant" onkeyup="ValidateCantCon(this)" type="number" step="any"
|
||||
data-cantidad='<%# Eval("CantidadMax")%>' data-pu='<%# Eval("PU")%>' data-cve='<%# Eval("CveContratoDetalle") %>'
|
||||
Width="90" runat="server"></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField HeaderText="PU">
|
||||
<ItemTemplate>
|
||||
<span><%# Eval("PU", "{0:N2}")%></span>
|
||||
</ItemTemplate>
|
||||
@@ -2790,8 +2790,9 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row form-group form-md-line-input input-iconright" style="text-align:right!important">
|
||||
<asp:CheckBox ID="ChkContinualAgregandoControl" runat="server" TextAlign="Left" Text="Continuar agregando" CssClass="form-control" Checked="true" Visible="false"/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
191
OC/OC.aspx.vb
191
OC/OC.aspx.vb
@@ -2094,101 +2094,142 @@ Partial Class OC
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
If DtDetalle IsNot Nothing Then
|
||||
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=DdlP2.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then
|
||||
Dim ObjCon As New ClsContratos
|
||||
Dim CvePresupuesto As Integer = 0
|
||||
Dim Autorizado As Double = 0
|
||||
Dim Ejercido As Double = 0
|
||||
If ObjCon.GetPresupuestos(-1, "-1", DdlSubProyecto.SelectedValue.ToEntero, 2, -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjCon.DtResultados.Rows.Count > 0 Then
|
||||
CvePresupuesto = ObjCon.DtResultados.Rows(0)("CvePresupuesto").ToString.ToEntero
|
||||
If CvePresupuesto > 0 Then
|
||||
If ObjCon.GetPresupuestosDetalle(CvePresupuesto, -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows.Count > 0 Then
|
||||
Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows(0)("Importe").ToString.ToDouble
|
||||
'Valida cantidad en contrato
|
||||
Dim ObjContratos As New ClsContratos
|
||||
Dim TieneError As Boolean = False
|
||||
Dim Mensaje As String = ""
|
||||
Dim dttemp As DataTable = GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString))
|
||||
If dttemp IsNot Nothing AndAlso dttemp.Rows.Count > 0 Then
|
||||
Dim drContrato As DataRow = dttemp.Rows(0)
|
||||
If ObjContratos.GetContratosDetalle(drContrato("CveContrato").ToString.ToEntero) Then
|
||||
Dim dtContratodetalle As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlP2.SelectedValue.ToString))
|
||||
If dtContratodetalle IsNot Nothing AndAlso dtContratodetalle.Rows.Count > 0 Then
|
||||
Dim drContratoDetalle As DataRow = dtContratodetalle(0)
|
||||
If Convert.ToBoolean(drContratoDetalle("LimitarCantidad")) Then
|
||||
If ObjContratos.GetReporteContratosAvancesDetalleControl(drContrato("CveContrato").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
Dim dtContratodetalleControl As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlP2.SelectedValue.ToString))
|
||||
If dtContratodetalleControl IsNot Nothing AndAlso dtContratodetalleControl.Rows.Count > 0 Then
|
||||
Dim drContratoDetalleControl As DataRow = dtContratodetalleControl(0)
|
||||
If TxtCant.Text.Trim.ToDouble > drContratoDetalleControl("FaltanteCantidad").ToString.ToDouble Then
|
||||
Mensaje = String.Format("La cantidad del Producto/Servicio debe ser menor o igual a {0}", drContratoDetalleControl("FaltanteCantidad").ToString)
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
Mensaje = "Este producto no pertence al contrato seleccionado"
|
||||
TieneError = True
|
||||
End If
|
||||
If ObjCon.GetPresupuestosRep(CvePresupuesto, -1, 1, $"01/09/{DateTime.Now.Year - 1}".ToDate, Now, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero,
|
||||
Else
|
||||
Mensaje = "Error al consultar el contrato"
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Mensaje = "Este producto no pertence al contrato seleccionado"
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
Mensaje = "Error al consultar el contrato"
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
|
||||
ObjContratos.Dispose()
|
||||
If DtDetalle IsNot Nothing Then
|
||||
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=DdlP2.SelectedValue.ToEntero).FiltroPrimero("")
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then
|
||||
Dim ObjCon As New ClsContratos
|
||||
Dim CvePresupuesto As Integer = 0
|
||||
Dim Autorizado As Double = 0
|
||||
Dim Ejercido As Double = 0
|
||||
If ObjCon.GetPresupuestos(-1, "-1", DdlSubProyecto.SelectedValue.ToEntero, 2, -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjCon.DtResultados.Rows.Count > 0 Then
|
||||
CvePresupuesto = ObjCon.DtResultados.Rows(0)("CvePresupuesto").ToString.ToEntero
|
||||
If CvePresupuesto > 0 Then
|
||||
If ObjCon.GetPresupuestosDetalle(CvePresupuesto, -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows.Count > 0 Then
|
||||
Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows(0)("Importe").ToString.ToDouble
|
||||
End If
|
||||
End If
|
||||
If ObjCon.GetPresupuestosRep(CvePresupuesto, -1, 1, $"01/09/{DateTime.Now.Year - 1}".ToDate, Now, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero,
|
||||
DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveUsuario, DdlClasificacion.SelectedValue.ToEntero) Then
|
||||
If ObjCon.DtResultados.Rows.Count > 0 Then
|
||||
Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDouble
|
||||
If ObjCon.DtResultados.Rows.Count > 0 Then
|
||||
Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDouble
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
ObjCon.Dispose()
|
||||
ObjCon.Dispose()
|
||||
|
||||
If CvePresupuesto > 0 And Autorizado > 0 Then
|
||||
Dim Diferencia As Double = (Ejercido + If(txtPrecioUnitario.Text.ToDouble > 0, (txtPrecioUnitario.Text.ToDouble * TxtCant.Text.ToDouble) - TxtDescuentoAdd.Text.ToDouble, 0)) - Autorizado
|
||||
If Diferencia > 0 Then
|
||||
Alert($"No hay presupuesto disponible en el subproyecto <b>{DdlSubProyecto.SelectedItem.Text}</b> y la clasificación <b>{DdlClasificacion.SelectedItem.Text}</b> se excede por <b>{Diferencia.FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
If CvePresupuesto > 0 And Autorizado > 0 Then
|
||||
Dim Diferencia As Double = (Ejercido + If(txtPrecioUnitario.Text.ToDouble > 0, (txtPrecioUnitario.Text.ToDouble * TxtCant.Text.ToDouble) - TxtDescuentoAdd.Text.ToDouble, 0)) - Autorizado
|
||||
If Diferencia > 0 Then
|
||||
Alert($"No hay presupuesto disponible en el subproyecto <b>{DdlSubProyecto.SelectedItem.Text}</b> y la clasificación <b>{DdlClasificacion.SelectedItem.Text}</b> se excede por <b>{Diferencia.FormatoNumero}</b>", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Dim RetISR As Double = DrPS("RetISR").ToString.ToDouble
|
||||
Dim RetIVA As Double = DrPS("RetIVA").ToString.ToDouble
|
||||
Dim IvaPS As Double = DrPS("IVA").ToString.ToDouble
|
||||
Dim RetISR As Double = DrPS("RetISR").ToString.ToDouble
|
||||
Dim RetIVA As Double = DrPS("RetIVA").ToString.ToDouble
|
||||
Dim IvaPS As Double = DrPS("IVA").ToString.ToDouble
|
||||
|
||||
'If IvaPS = -1 Then 'IVA DE LA SUCURSAL
|
||||
' IvaPS = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDouble
|
||||
'End If
|
||||
'If IvaPS = -1 Then 'IVA DE LA SUCURSAL
|
||||
' IvaPS = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDouble
|
||||
'End If
|
||||
|
||||
Dim IEPSPS As Double = DrPS("IEPSPorcentaje").ToString.ToDouble
|
||||
Dim IEPSPSIVA As Double = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0)
|
||||
Dim IdCuentaPorEjercer As Integer = If(HdnCveCuentaPorEjercer.Value = String.Empty, -1, HdnCveCuentaPorEjercer.Value.ToEntero)
|
||||
Dim IdCuentaComprometido As Integer = If(HdnCveCuentaComprometido.Value = String.Empty, -1, HdnCveCuentaComprometido.Value.ToEntero)
|
||||
Dim Proyecto As String = If(DdlProyecto.SelectedValue.ToString.ToEntero > 0, DdlProyecto.SelectedItem.Text, "Sin Proyecto")
|
||||
Dim SubProyecto As String = If(DdlSubProyecto.SelectedValue.ToString.ToEntero > 0, DdlSubProyecto.SelectedItem.Text, "Sin SubProyecto")
|
||||
Dim TotalPS As Double = If(txtPrecioUnitario.Text.ToDouble > 0, (txtPrecioUnitario.Text.ToDouble * TxtCant.Text.ToDouble) - TxtDescuentoAdd.Text.ToDouble, 0)
|
||||
Dim ImportePS As Double = If(txtPrecioUnitario.Text.ToDouble > 0, txtPrecioUnitario.Text.ToDouble, 0)
|
||||
Dim CveOrdenCompraDetalle As Integer = DtDetalle.MAX("CveOrdenCompraDetalle").ToEntero + 100
|
||||
Dim IEPSPS As Double = DrPS("IEPSPorcentaje").ToString.ToDouble
|
||||
Dim IEPSPSIVA As Double = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0)
|
||||
Dim IdCuentaPorEjercer As Integer = If(HdnCveCuentaPorEjercer.Value = String.Empty, -1, HdnCveCuentaPorEjercer.Value.ToEntero)
|
||||
Dim IdCuentaComprometido As Integer = If(HdnCveCuentaComprometido.Value = String.Empty, -1, HdnCveCuentaComprometido.Value.ToEntero)
|
||||
Dim Proyecto As String = If(DdlProyecto.SelectedValue.ToString.ToEntero > 0, DdlProyecto.SelectedItem.Text, "Sin Proyecto")
|
||||
Dim SubProyecto As String = If(DdlSubProyecto.SelectedValue.ToString.ToEntero > 0, DdlSubProyecto.SelectedItem.Text, "Sin SubProyecto")
|
||||
Dim TotalPS As Double = If(txtPrecioUnitario.Text.ToDouble > 0, (txtPrecioUnitario.Text.ToDouble * TxtCant.Text.ToDouble) - TxtDescuentoAdd.Text.ToDouble, 0)
|
||||
Dim ImportePS As Double = If(txtPrecioUnitario.Text.ToDouble > 0, txtPrecioUnitario.Text.ToDouble, 0)
|
||||
Dim CveOrdenCompraDetalle As Integer = DtDetalle.MAX("CveOrdenCompraDetalle").ToEntero + 100
|
||||
|
||||
'Si es Proveedor Extranjero el IVA es 0%
|
||||
If GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros($"CveProveedor = {DdlProveedores.SelectedValue} AND RFC = 'XEXX010101000'").Rows.Count = 1 Then
|
||||
IvaPS = 0
|
||||
End If
|
||||
'Si es Proveedor Extranjero el IVA es 0%
|
||||
If GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros($"CveProveedor = {DdlProveedores.SelectedValue} AND RFC = 'XEXX010101000'").Rows.Count = 1 Then
|
||||
IvaPS = 0
|
||||
End If
|
||||
|
||||
AddPS(TxtCant.Text, DdlP2.SelectedValue.ToEntero, DdlP2.SelectedText, TxtObsPS.Text, ImportePS, TxtDescuentoAdd.Text.ToDouble, TotalPS,
|
||||
AddPS(TxtCant.Text, DdlP2.SelectedValue.ToEntero, DdlP2.SelectedText, TxtObsPS.Text, ImportePS, TxtDescuentoAdd.Text.ToDouble, TotalPS,
|
||||
CboUnidadMedida.SelectedValue.ToEntero, IvaPS, IEPSPS, IEPSPSIVA, DdlClasificacion.SelectedValue.ToEntero, CboUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedItem.Text, DdlProyecto.SelectedValue.ToEntero, Proyecto,
|
||||
DdlSubProyecto.SelectedValue.ToEntero, SubProyecto, LblCodigo.Text, HdnCveActivoFijo.Value.ToEntero, 0, CveOrdenCompraDetalle, CveOrdenCompra, IdCuentaPorEjercer,
|
||||
IdCuentaComprometido, DdlACGeneral1.SelectedValue.ToEntero, DdlACGeneral2.SelectedValue.ToEntero, DdlACGeneral3.SelectedValue.ToEntero, DdlACGeneral4.SelectedValue.ToEntero,
|
||||
DdlACGeneral5.SelectedValue.ToEntero, RetIVA, RetISR, CveCultivoCuadroDetalle:=DdlCultivosCuadro.SelectedValue.ToEntero, Cuadro:=DdlCultivosCuadro.SelectedItem.Text)
|
||||
|
||||
TxtCant.Text = ""
|
||||
CboUnidadMedida.SelectedIndex = 0
|
||||
DdlClasificacion.SelectedIndex = 0
|
||||
DdlP2.SelectedValue = "-1"
|
||||
DdlP2.SelectedText = "Seleccione un producto o servicio"
|
||||
txtPrecioUnitario.Text = ""
|
||||
TxtObsPS.Text = ""
|
||||
HdnCveActivoFijo.Value = ""
|
||||
LblCodigo.Text = ""
|
||||
LblCvePOA.Text = ""
|
||||
TxtCant.Focus()
|
||||
TxtCant.Text = ""
|
||||
CboUnidadMedida.SelectedIndex = 0
|
||||
DdlClasificacion.SelectedIndex = 0
|
||||
DdlP2.SelectedValue = "-1"
|
||||
DdlP2.SelectedText = "Seleccione un producto o servicio"
|
||||
txtPrecioUnitario.Text = ""
|
||||
TxtObsPS.Text = ""
|
||||
HdnCveActivoFijo.Value = ""
|
||||
LblCodigo.Text = ""
|
||||
LblCvePOA.Text = ""
|
||||
TxtCant.Focus()
|
||||
|
||||
Total.Text = "0.00"
|
||||
TxtDescuentoAdd.Text = "0.00"
|
||||
Total.Text = "0.00"
|
||||
TxtDescuentoAdd.Text = "0.00"
|
||||
|
||||
End If
|
||||
|
||||
CargaSuperior()
|
||||
CargaDatosDetalles()
|
||||
|
||||
UPPDetalle.Update()
|
||||
Else
|
||||
Alert(Mensaje, TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
CargaSuperior()
|
||||
CargaDatosDetalles()
|
||||
|
||||
UPPDetalle.Update()
|
||||
|
||||
|
||||
ObjContratos.Dispose()
|
||||
End Sub
|
||||
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,
|
||||
@@ -8396,9 +8437,17 @@ Partial Class OC
|
||||
If ObjContratos.DtResultados.Rows.Count > 0 Then
|
||||
GvContratosControl.DataSource = ObjContratos.DtResultados
|
||||
BtnAplicarContrato.Visible = True
|
||||
divBusqueda.Visible = True
|
||||
ChkContinualAgregandoControl.Visible = True
|
||||
ChkContinualAgregandoControl.Checked = True
|
||||
|
||||
Else
|
||||
GvContratosControl.DataSource = Nothing
|
||||
BtnAplicarContrato.Visible = False
|
||||
divBusqueda.Visible = False
|
||||
ChkContinualAgregandoControl.Visible = False
|
||||
ChkContinualAgregandoControl.Checked = False
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user