Verificar el producto y la cantidad si el subproyecto tienen contrato
This commit is contained in:
@@ -5400,12 +5400,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<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="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
<asp:GridView ID="GvContratosControl" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron partidas"
|
<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"
|
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>
|
<Columns>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="Producto">
|
<asp:TemplateField HeaderText="Producto">
|
||||||
@@ -5439,6 +5443,9 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</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
|
End If
|
||||||
|
|
||||||
ActualizaTotales = True
|
ActualizaTotales = True
|
||||||
Select Case Modalidad
|
Dim ObjContratos As New ClsContratos
|
||||||
Case "A" 'ADD
|
Dim TieneError As Boolean = False
|
||||||
|
Dim Mensaje As String = ""
|
||||||
Dim SATClavePS = -1
|
Dim dttemp As DataTable = GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString))
|
||||||
Dim PSRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
|
If dttemp IsNot Nothing AndAlso dttemp.Rows.Count > 0 Then
|
||||||
If PSRow IsNot Nothing Then
|
Dim drContrato As DataRow = dttemp.Rows(0)
|
||||||
SATClavePS = PSRow("SATClavePS").ToString.ToEntero
|
If ObjContratos.GetContratosDetalle(drContrato("CveContrato").ToString.ToEntero) Then
|
||||||
End If
|
Dim dtContratodetalle As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlPS.SelectedValue.ToString))
|
||||||
Dim IVA As Double
|
If dtContratodetalle IsNot Nothing AndAlso dtContratodetalle.Rows.Count > 0 Then
|
||||||
If chkImportacion.Checked Then
|
Dim drContratoDetalle As DataRow = dtContratodetalle(0)
|
||||||
IVA = (txtImportacion.Text.Trim.ToDouble / (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.Trim.ToDouble))
|
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
|
Else
|
||||||
IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)
|
Mensaje = "Este producto no pertence al contrato seleccionado"
|
||||||
|
TieneError = True
|
||||||
End If
|
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,
|
Else
|
||||||
DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, Total, IVA,
|
Mensaje = "Error al consultar el contrato"
|
||||||
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()
|
End If
|
||||||
LimpiaAgregar()
|
End If
|
||||||
|
If Not TieneError Then
|
||||||
|
Select Case Modalidad
|
||||||
|
Case "A" 'ADD
|
||||||
|
|
||||||
If ChkAgregar.Checked = True And Modalidad = "A" Then
|
Dim SATClavePS = -1
|
||||||
RegistraScript("displayToastr(1);", "display")
|
Dim PSRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
|
||||||
Else
|
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"))
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
|
||||||
End If
|
End Select
|
||||||
|
ActualizaTotales = False
|
||||||
|
|
||||||
Case "U" 'UPDATE
|
If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero)
|
||||||
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.UsaAC Then
|
||||||
|
CompruebaAgregar()
|
||||||
If UsuarioActual.Empresa.UsaAC Then
|
GuardaAC()
|
||||||
CompruebaAgregar()
|
End If
|
||||||
GuardaAC()
|
Else
|
||||||
|
Alert(Mensaje, TipoMensaje.MsgAdvertencia)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'If UsuarioActual.Empresa.Funcionalidad(577).ToString = "1" Then
|
'If UsuarioActual.Empresa.Funcionalidad(577).ToString = "1" Then
|
||||||
@@ -20786,9 +20826,17 @@ Partial Class Compras_Compras
|
|||||||
If ObjContratos.DtResultados.Rows.Count > 0 Then
|
If ObjContratos.DtResultados.Rows.Count > 0 Then
|
||||||
GvContratosControl.DataSource = ObjContratos.DtResultados
|
GvContratosControl.DataSource = ObjContratos.DtResultados
|
||||||
BtnAplicarContrato.Visible = True
|
BtnAplicarContrato.Visible = True
|
||||||
|
divBusqueda.Visible = True
|
||||||
|
ChkContinualAgregandoControl.Visible = True
|
||||||
|
ChkContinualAgregandoControl.Checked = True
|
||||||
|
|
||||||
Else
|
Else
|
||||||
GvContratosControl.DataSource = Nothing
|
GvContratosControl.DataSource = Nothing
|
||||||
BtnAplicarContrato.Visible = False
|
BtnAplicarContrato.Visible = False
|
||||||
|
divBusqueda.Visible = False
|
||||||
|
ChkContinualAgregandoControl.Visible = False
|
||||||
|
ChkContinualAgregandoControl.Checked = False
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
@@ -20863,11 +20911,9 @@ Partial Class Compras_Compras
|
|||||||
Next
|
Next
|
||||||
|
|
||||||
AddPS2()
|
AddPS2()
|
||||||
|
If Not ChkContinualAgregandoControl.Checked Then
|
||||||
|
RegistraScript("$('#DivmodalConmtrato').modal('hide')")
|
||||||
RegistraScript("$('#DivmodalConmtrato').modal('hide')")
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
35
OC/OC.aspx
35
OC/OC.aspx
@@ -2747,33 +2747,33 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<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="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
<asp:GridView ID="GvContratosControl" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron partidas"
|
<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"
|
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>
|
<Columns>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="Producto">
|
<asp:TemplateField HeaderText="Producto">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Label ID="LblPS" runat="server" CssClass="Texto" Text='<%# Eval("PS")%>'></asp:Label>
|
<asp:Label ID="LblPS" runat="server" CssClass="Texto" Text='<%# Eval("PS")%>' Width="250px"></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>
|
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</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>
|
<ItemTemplate>
|
||||||
<span><%# Eval("PU", "{0:N2}")%></span>
|
<span><%# Eval("PU", "{0:N2}")%></span>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
@@ -2790,8 +2790,9 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|||||||
191
OC/OC.aspx.vb
191
OC/OC.aspx.vb
@@ -2094,101 +2094,142 @@ Partial Class OC
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'Valida cantidad en contrato
|
||||||
If DtDetalle IsNot Nothing Then
|
Dim ObjContratos As New ClsContratos
|
||||||
Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=DdlP2.SelectedValue.ToEntero).FiltroPrimero("")
|
Dim TieneError As Boolean = False
|
||||||
If DrPS Is Nothing Then
|
Dim Mensaje As String = ""
|
||||||
Alert("Ocurrió un error al cargar la información del producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
Dim dttemp As DataTable = GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString))
|
||||||
Exit Sub
|
If dttemp IsNot Nothing AndAlso dttemp.Rows.Count > 0 Then
|
||||||
End If
|
Dim drContrato As DataRow = dttemp.Rows(0)
|
||||||
|
If ObjContratos.GetContratosDetalle(drContrato("CveContrato").ToString.ToEntero) Then
|
||||||
If UsuarioActual.Empresa.Funcionalidad(532) = "1" Then
|
Dim dtContratodetalle As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlP2.SelectedValue.ToString))
|
||||||
Dim ObjCon As New ClsContratos
|
If dtContratodetalle IsNot Nothing AndAlso dtContratodetalle.Rows.Count > 0 Then
|
||||||
Dim CvePresupuesto As Integer = 0
|
Dim drContratoDetalle As DataRow = dtContratodetalle(0)
|
||||||
Dim Autorizado As Double = 0
|
If Convert.ToBoolean(drContratoDetalle("LimitarCantidad")) Then
|
||||||
Dim Ejercido As Double = 0
|
If ObjContratos.GetReporteContratosAvancesDetalleControl(drContrato("CveContrato").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||||
If ObjCon.GetPresupuestos(-1, "-1", DdlSubProyecto.SelectedValue.ToEntero, 2, -1, UsuarioActual.CveEmpresa) Then
|
Dim dtContratodetalleControl As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlP2.SelectedValue.ToString))
|
||||||
If ObjCon.DtResultados.Rows.Count > 0 Then
|
If dtContratodetalleControl IsNot Nothing AndAlso dtContratodetalleControl.Rows.Count > 0 Then
|
||||||
CvePresupuesto = ObjCon.DtResultados.Rows(0)("CvePresupuesto").ToString.ToEntero
|
Dim drContratoDetalleControl As DataRow = dtContratodetalleControl(0)
|
||||||
If CvePresupuesto > 0 Then
|
If TxtCant.Text.Trim.ToDouble > drContratoDetalleControl("FaltanteCantidad").ToString.ToDouble Then
|
||||||
If ObjCon.GetPresupuestosDetalle(CvePresupuesto, -1, UsuarioActual.CveEmpresa) Then
|
Mensaje = String.Format("La cantidad del Producto/Servicio debe ser menor o igual a {0}", drContratoDetalleControl("FaltanteCantidad").ToString)
|
||||||
If ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows.Count > 0 Then
|
TieneError = True
|
||||||
Autorizado = ObjCon.DtResultados.FiltraParametros($"CveClasificacion = {DdlClasificacion.SelectedValue.ToEntero} AND Importe > 0").Rows(0)("Importe").ToString.ToDouble
|
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
Mensaje = "Este producto no pertence al contrato seleccionado"
|
||||||
|
TieneError = True
|
||||||
End If
|
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
|
DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveUsuario, DdlClasificacion.SelectedValue.ToEntero) Then
|
||||||
If ObjCon.DtResultados.Rows.Count > 0 Then
|
If ObjCon.DtResultados.Rows.Count > 0 Then
|
||||||
Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDouble
|
Ejercido = ObjCon.DtResultados.Rows(0)("Ejercido").ToString.ToDouble
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
ObjCon.Dispose()
|
||||||
ObjCon.Dispose()
|
|
||||||
|
|
||||||
If CvePresupuesto > 0 And Autorizado > 0 Then
|
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
|
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
|
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)
|
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
|
Exit Sub
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
Dim RetISR As Double = DrPS("RetISR").ToString.ToDouble
|
Dim RetISR As Double = DrPS("RetISR").ToString.ToDouble
|
||||||
Dim RetIVA As Double = DrPS("RetIVA").ToString.ToDouble
|
Dim RetIVA As Double = DrPS("RetIVA").ToString.ToDouble
|
||||||
Dim IvaPS As Double = DrPS("IVA").ToString.ToDouble
|
Dim IvaPS As Double = DrPS("IVA").ToString.ToDouble
|
||||||
|
|
||||||
'If IvaPS = -1 Then 'IVA DE LA SUCURSAL
|
'If IvaPS = -1 Then 'IVA DE LA SUCURSAL
|
||||||
' IvaPS = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDouble
|
' IvaPS = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDouble
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
Dim IEPSPS As Double = DrPS("IEPSPorcentaje").ToString.ToDouble
|
Dim IEPSPS As Double = DrPS("IEPSPorcentaje").ToString.ToDouble
|
||||||
Dim IEPSPSIVA As Double = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0)
|
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 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 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 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 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 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 ImportePS As Double = If(txtPrecioUnitario.Text.ToDouble > 0, txtPrecioUnitario.Text.ToDouble, 0)
|
||||||
Dim CveOrdenCompraDetalle As Integer = DtDetalle.MAX("CveOrdenCompraDetalle").ToEntero + 100
|
Dim CveOrdenCompraDetalle As Integer = DtDetalle.MAX("CveOrdenCompraDetalle").ToEntero + 100
|
||||||
|
|
||||||
'Si es Proveedor Extranjero el IVA es 0%
|
'Si es Proveedor Extranjero el IVA es 0%
|
||||||
If GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros($"CveProveedor = {DdlProveedores.SelectedValue} AND RFC = 'XEXX010101000'").Rows.Count = 1 Then
|
If GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros($"CveProveedor = {DdlProveedores.SelectedValue} AND RFC = 'XEXX010101000'").Rows.Count = 1 Then
|
||||||
IvaPS = 0
|
IvaPS = 0
|
||||||
End If
|
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,
|
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,
|
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,
|
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)
|
DdlACGeneral5.SelectedValue.ToEntero, RetIVA, RetISR, CveCultivoCuadroDetalle:=DdlCultivosCuadro.SelectedValue.ToEntero, Cuadro:=DdlCultivosCuadro.SelectedItem.Text)
|
||||||
|
|
||||||
TxtCant.Text = ""
|
TxtCant.Text = ""
|
||||||
CboUnidadMedida.SelectedIndex = 0
|
CboUnidadMedida.SelectedIndex = 0
|
||||||
DdlClasificacion.SelectedIndex = 0
|
DdlClasificacion.SelectedIndex = 0
|
||||||
DdlP2.SelectedValue = "-1"
|
DdlP2.SelectedValue = "-1"
|
||||||
DdlP2.SelectedText = "Seleccione un producto o servicio"
|
DdlP2.SelectedText = "Seleccione un producto o servicio"
|
||||||
txtPrecioUnitario.Text = ""
|
txtPrecioUnitario.Text = ""
|
||||||
TxtObsPS.Text = ""
|
TxtObsPS.Text = ""
|
||||||
HdnCveActivoFijo.Value = ""
|
HdnCveActivoFijo.Value = ""
|
||||||
LblCodigo.Text = ""
|
LblCodigo.Text = ""
|
||||||
LblCvePOA.Text = ""
|
LblCvePOA.Text = ""
|
||||||
TxtCant.Focus()
|
TxtCant.Focus()
|
||||||
|
|
||||||
Total.Text = "0.00"
|
Total.Text = "0.00"
|
||||||
TxtDescuentoAdd.Text = "0.00"
|
TxtDescuentoAdd.Text = "0.00"
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
CargaSuperior()
|
||||||
|
CargaDatosDetalles()
|
||||||
|
|
||||||
|
UPPDetalle.Update()
|
||||||
|
Else
|
||||||
|
Alert(Mensaje, TipoMensaje.MsgAdvertencia)
|
||||||
End If
|
End If
|
||||||
|
ObjContratos.Dispose()
|
||||||
CargaSuperior()
|
|
||||||
CargaDatosDetalles()
|
|
||||||
|
|
||||||
UPPDetalle.Update()
|
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
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,
|
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,
|
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
|
If ObjContratos.DtResultados.Rows.Count > 0 Then
|
||||||
GvContratosControl.DataSource = ObjContratos.DtResultados
|
GvContratosControl.DataSource = ObjContratos.DtResultados
|
||||||
BtnAplicarContrato.Visible = True
|
BtnAplicarContrato.Visible = True
|
||||||
|
divBusqueda.Visible = True
|
||||||
|
ChkContinualAgregandoControl.Visible = True
|
||||||
|
ChkContinualAgregandoControl.Checked = True
|
||||||
|
|
||||||
Else
|
Else
|
||||||
GvContratosControl.DataSource = Nothing
|
GvContratosControl.DataSource = Nothing
|
||||||
BtnAplicarContrato.Visible = False
|
BtnAplicarContrato.Visible = False
|
||||||
|
divBusqueda.Visible = False
|
||||||
|
ChkContinualAgregandoControl.Visible = False
|
||||||
|
ChkContinualAgregandoControl.Checked = False
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user