This commit is contained in:
Antonio Gonzalez
2020-11-12 20:20:46 -07:00
9 changed files with 381 additions and 32 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -1252,7 +1252,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")
@@ -1283,6 +1283,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
@@ -1305,7 +1309,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")
@@ -1335,6 +1339,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

View File

@@ -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

View File

@@ -2639,6 +2639,7 @@ Partial Class Compras_eFacturas
Protected Sub LnkAgregarPago_Click(sender As Object, e As EventArgs)
Dim sbSinIE As New StringBuilder
Dim TieneCompras As Boolean = False
HdnCveIE.Value = ""
MSGComplemento = ""
@@ -2841,6 +2842,15 @@ Partial Class Compras_eFacturas
GVPDocumentosRelacionadosPagos.DataBind()
If DTDocumentosRelacionados.MAX("CveCompra").ToString.ToEntero > 0 Then
TieneCompras = True
Else
TieneCompras = False
End If
For Each dRow2 As DataRow In DTDocumentosRelacionados.Rows
If dRow2("CveMetodoPago").ToString.ToEntero > 0 Then
If dRow2("CveMetodoPago").ToString.ToEntero = 1 Then
@@ -2947,27 +2957,41 @@ Partial Class Compras_eFacturas
ObjCompras.Dispose()
If Math.Abs(DiferenciaImportes) > 5 Then
TextoDiferenciaImporte = $"<b>&nbsp;&nbsp;-&nbsp;&nbsp; IE ${ImporteIES.FormatoNumero}</b> <div style='color:red'><strong>Diferencia { DiferenciaImportes.FormatoNumero() }</strong></div>"
BtnVincularPago.Visible = False
MSGComplemento = MSGComplemento & $" Existe una diferencia mayor a $5.00 ({Math.Abs(DiferenciaImportes)})"
If TieneCompras Then
If ImporteIES > 0 Then
If Math.Abs(DiferenciaImportes) > 5 Then
TextoDiferenciaImporte = $"<b>&nbsp;&nbsp;-&nbsp;&nbsp; IE ${ImporteIES.FormatoNumero}</b> <div style='color:red'><strong>Diferencia { DiferenciaImportes.FormatoNumero() }</strong></div>"
BtnVincularPago.Visible = False
MSGComplemento = MSGComplemento & $" Existe una diferencia mayor a $5.00 ({Math.Abs(DiferenciaImportes)})"
If TieneRegistros AndAlso UsuarioActual.TienePermisoProceso(286) Then
DivVincularPagoManualmente.Visible = True
If TieneRegistros AndAlso UsuarioActual.TienePermisoProceso(286) Then
DivVincularPagoManualmente.Visible = True
End If
End If
Else
TextoDiferenciaImporte = $"No se encontraron pagos "
BtnVincularPago.Visible = False
MSGComplemento = MSGComplemento & $" No se encontraron pagos "
If TieneRegistros AndAlso UsuarioActual.TienePermisoProceso(286) Then
DivVincularPagoManualmente.Visible = True
End If
End If
Else
'BtnVincularPago.Visible = True
'TextoDiferenciaImporte = ""
BtnVincularPago.Visible = False
MSGComplemento = MSGComplemento & $"No se encontraron compras relacionadas"
DivVincularPagoManualmente.Visible = False
End If
LblSerieFolioPago.Text = $"{SeriePago}-{FolioPago}"
LblImportePago.Text = Monto.ToString("###,###,###.00") 'ImportePago.FormatoNumero
LblPagosCantidad.Text = PagosCantidad.ToString
LblImporteIE.Text = ImporteIES.FormatoNumero
LblDiferencia.Text = If(DiferenciaImportes <> 0, DiferenciaImportes.FormatoNumero, "")
LblDiferencia.Text = If(DiferenciaImportes <> 0 And ImporteIES > 0, DiferenciaImportes.FormatoNumero, "")
If MSGComplemento.Trim.Length > 0 And CveComplementoPagoCompra <= 0 Then

View File

@@ -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

View File

@@ -73,7 +73,7 @@
<asp:BoundField HeaderText="Producto" DataField="PS" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="FechaCaducidad" DataField="FechaCaducidad" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="FechaCaducidad" DataField="FechaCaducidad" DataFormatString="{0:d}" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Sección Actual" DataField="SeccionAlmacen" ItemStyle-Width="15%" />
<%--<asp:BoundField HeaderText="Existencia" DataField="Existencia" DataFormatString="{0:#,###.##}" ItemStyle-Width="5%" />--%>
<asp:TemplateField ItemStyle-Width="7%">
@@ -91,7 +91,7 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="Nuevo Lote" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox runat="server" ID="TxtLote" Text='<%# Eval("Lote").ToString()%>' CssClass="form-control" ClientIDMode="Static" />
<asp:TextBox runat="server" ID="TxtLote" Text='<%# Eval("Lote").ToString()%>' CssClass="form-control input-sm" ClientIDMode="Static" />
</ItemTemplate>
</asp:TemplateField>
@@ -102,8 +102,8 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="Nueva Fecha Cad." ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 138px !important; padding: 0px; margin-bottom: -10px;">
<asp:TextBox runat="server" ID="TxtFechaCadNueva" Text='<%# Eval("FechaCaducidad").ToString()%>' CssClass="form-control" ClientIDMode="Static" />
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 113px !important; padding: 0px; margin-bottom: -10px;">
<asp:TextBox runat="server" ID="TxtFechaCadNueva" Text='<%# Eval("FechaCaducidad", "{0:d}").ToString()%>' CssClass="form-control input-sm" ClientIDMode="Static" />
<span class="input-group-btn ">
<asp:LinkButton runat="server" ID="ImgFecha" class="btn default"> <i class="fa fa-calendar"></i> </asp:LinkButton>
</span>

View File

@@ -47,6 +47,10 @@
<li style="text-align: left!important" runat="server" id="LiLnkGuias" visible="true">
<asp:LinkButton runat="server" ID="LnkAgregarGuia" CssClass="" data-toggle="tooltip" data-placement="left" OnClick="LnkAgregarGuia_Click" title="Paquetería Guías." Text="<i class='fa fa-truck'></i> Paqueteria Guías" Visible="false"></asp:LinkButton>
</li>
<li style="text-align: left!important" runat="server" id="LIContratos" visible="false">
<asp:LinkButton runat="server" ID="LnkAcontratos" CssClass="" data-toggle="tooltip" data-placement="left" OnClick="LnkAcontratos_Click" title="Contratos" Text="<i class='fa fa-file-text'></i> Contratos"></asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LbDescargarExcel" />
@@ -2642,6 +2646,7 @@
</div>
</div>
</div>
<div id="DivCambiarMoneda" class="modal ADS fade">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpdatePanel3" runat="server" class="modal-content rowpadding" tabindex="-1" UpdateMode="Conditional">
@@ -2677,6 +2682,103 @@
</asp:UpdatePanel>
</div>
</div>
<div id="DivmodalConmtrato" class="modal ADS fade">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpModalContrato" runat="server" class="modal-content rowpadding" tabindex="-1" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4>
<asp:Label Text="Contratos" ID="LblTituloContrato" runat="server" />
</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList runat="server" ID="DdlContratosObra" AutoPostBack="true" OnSelectedIndexChanged="DdlContratosCompras_SelectedIndexChanged" DataTextField="ContratoCompleto" DataValueField="CveContrato" CssClass="form-control input-sm select2me" Width="100%">
<asp:ListItem Value="-1">Seleccione uno</asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlContratosObra.ClientID.ToString()%>">Contrato:</label>
</div>
</div>
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoGasto" runat="server" DataTextField="TipoGasto" DataValueField="CveTipoGasto" AppendDataBoundItems="true" CssClass="form-control input-sm select2me" Width="100%">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoGasto.ClientID.ToString()%>">Tipo de Gasto:</label>
<asp:RequiredFieldValidator runat="server" Enabled="true" InitialValue="-1" Display="None" ID="RFVDdlTipoGasto" ControlToValidate="DdlTipoGasto" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo de Gasto''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpAplicaContrato"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="CERFVDdlTipoGasto" runat="server" HighlightCssClass="vco" TargetControlID="RFVDdlTipoGasto" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<br />
<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%">
<Columns>
<asp:TemplateField HeaderText="Producto">
<ItemTemplate>
<asp:Label ID="LblPS" runat="server" CssClass="Texto" Text='<%# Eval("PS")%>' Width="250px"></asp:Label>
</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="90" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PU">
<ItemTemplate>
<span><%# Eval("PU", "{0:N2}")%></span>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Importe">
<ItemTemplate>
<asp:TextBox ID="TxtImporte" Text="" data-cve='<%# Eval("CveContratoDetalle") %>' CssClass="txtimporte" type="number" step="any" Width="90" runat="server" onkeydown="keydownenabledtab(event)"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnAplicarContrato" runat="server" Text="Aceptar" ClientIDMode="Static" CssClass="btn btn-success" OnClick="BtnAplicarContrato_Click" Visible="false" ValidationGroup="GrpAplicaContrato" CausesValidation="true" />
<button type="button" class="btn default" data-dismiss="modal">Cancelar</button>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<script src="/Metronic/assets/global/plugins/dropzone/dropzone.js"></script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="JS" runat="server">
@@ -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();
}
}
</script>

View File

@@ -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