EMD - Mejoras Propuestas - Sayri, pendiente verificar correo

This commit is contained in:
rakcsle
2024-03-05 13:18:49 -07:00
parent b63ce53815
commit b59061dc84
4 changed files with 294 additions and 2 deletions

View File

@@ -921,7 +921,23 @@
<asp:Button runat="server" ID="btnProrateo" Visible="false" Text="Prorratear" CommandArgument="Compras" CssClass="btn btn-success" />
<asp:Button runat="server" ID="btnProrateo2" Visible="false" Text="Prorratear Nomina" CommandArgument="Nomina" CssClass="btn btn-success" />
<asp:Button runat="server" ID="BtnProrateoDeducible" Visible="false" Text="Prorratear 8.5%" CommandArgument="Prorratear Deducible" CssClass="btn btn-success" />
</div>
</div>
<asp:UpdatePanel ID="UpDVAtencionOCAnticipo" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div style="z-index: 5; position: relative;">
<div class="alert alert-danger alert-dismissable" runat="server" id="DVAtencionOCAnticipo" visible="false" style="padding: 5px; margin-bottom: 5px; padding-right: 25px;">
<button type="button" class="close" data-dismiss="alert" style="margin-top: 5px;" aria-hidden="true"></button>
<strong style="font-size: 20px; margin-right: 25px;">Atención! </strong>
El Proveedor tiene Saldo a favor pendiente por aplicar
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-md-6 ">

View File

@@ -714,6 +714,18 @@ Partial Class Compras_Compras
ViewState("CveMetodoPago") = value
End Set
End Property
Private Property MetodoPagoOC As Integer
Get
If ViewState("MetodoPagoOC") Is Nothing Then
ViewState("MetodoPagoOC") = -1
End If
Return ViewState("MetodoPagoOC").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("MetodoPagoOC") = value
End Set
End Property
Private Property TipoCambio As Decimal
Get
Return ViewState("TipoCambio").ToString.ToDecimal
@@ -1018,6 +1030,20 @@ Partial Class Compras_Compras
End Set
End Property
Private Property CveIEAnticipo As Integer
Get
If ViewState("CveIEAnticipo") Is Nothing Then
ViewState("CveIEAnticipo") = -1
End If
Return ViewState("CveIEAnticipo").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveIEAnticipo") = value
End Set
End Property
Public Property FechaCompraOriginal As Date
Get
Return ViewState("FechaCompraOriginal").ToString.ToDate
@@ -3967,6 +3993,11 @@ Partial Class Compras_Compras
'------------------ INICIA VALIDACIONES ------------------
If MetodoPagoOC = 0 AndAlso RBLPago.SelectedValue.ToEntero <> 2 Then
Alert("La orden de compra se definió de contado, favor de especificar la compra de contado.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim CveSubProyectoPrincipal As Integer = AsignarSubProyectoPrincipal()
If Not CveSubProyectoPrincipal > 0 Then
@@ -13656,6 +13687,7 @@ Partial Class Compras_Compras
CargaOC()
End Sub
Private Sub CargaOC()
MetodoPagoOC = -1
Dim EntregaDirecta As Integer = 0
DivOCSolicitudAnticipo.Visible = False
DivOCSolicitudAnticipoModal.Visible = False
@@ -13694,6 +13726,7 @@ Partial Class Compras_Compras
HdnVCveOC.Value += String.Format("{0}{1}", If(HdnVCveOC.Value <> "", ",", ""), OC.DtResultados.Rows(0)("CveOrdenCompra").ToString)
HdnCveEstatusOC.Value += String.Format("{0}{1}", If(HdnCveEstatusOC.Value <> "", ",", ""), OC.DtResultados.Rows(0)("CveEstatusSiguiente").ToString)
EntregaDirecta += If(OC.DtResultados.Rows(0)("EntregaDirecta").ToString = "True", 1, 0)
MetodoPagoOC = OC.DtResultados.Rows(0)("EntregaDirecta").ToString.ToEntero
End If
End If
Next
@@ -13709,6 +13742,7 @@ Partial Class Compras_Compras
HdnVCveOC.Value += String.Format("{0}{1}", If(HdnVCveOC.Value <> "", ",", ""), OC.DtResultados.Rows(0)("CveOrdenCompra").ToString)
HdnCveEstatusOC.Value += String.Format("{0}{1}", If(HdnCveEstatusOC.Value <> "", ",", ""), OC.DtResultados.Rows(0)("CveEstatusSiguiente").ToString)
EntregaDirecta += If(OC.DtResultados.Rows(0)("EntregaDirecta").ToString = "True", 1, 0)
MetodoPagoOC = OC.DtResultados.Rows(0)("EntregaDirecta").ToString.ToEntero
End If
End If
Next
@@ -13751,7 +13785,9 @@ Partial Class Compras_Compras
Protected Sub BtnVOC_Click(sender As Object, e As EventArgs)
VinculaOC()
End Sub
Private Sub VinculaOC()
CveIEAnticipo = -1
If TxtOC.Text <> "" Then
'VARIABLES
@@ -13798,6 +13834,7 @@ Partial Class Compras_Compras
If ObjOC.DtResultados.Rows(0)("CveIEAnticipo").ToString.ToEntero > 0 Then
FoliosOCAnticipo += $"{ObjOC.DtResultados.Rows(0)("FolioOC").ToString},"
FoliosOCAnticipoIE += $"{ObjOC.DtResultados.Rows(0)("FolioIEAnticipo").ToString},"
CveIEAnticipo = ObjOC.DtResultados.Rows(0)("CveIEAnticipo").ToString.ToEntero
DivOCSolicitudAnticipo.Visible = True
DivOCSolicitudAnticipoModal.Visible = True
End If
@@ -13889,6 +13926,9 @@ Partial Class Compras_Compras
If DivOCSolicitudAnticipo.Visible And FoliosOCAnticipo.Length > 0 Then
LtSolicitudAnticipoFoliosOC.Text = $"La(s) siguiente(s) OC: {FoliosOCAnticipo.Substring(0, FoliosOCAnticipo.Length - 1)}. tienen vinculado un anticipo"
LtSolicitudAnticipoFoliosIE.Text = $" {FoliosOCAnticipoIE.Substring(0, FoliosOCAnticipoIE.Length - 1)}"
DVAtencionOCAnticipo.Visible = True
UpDVAtencionOCAnticipo.Update()
End If
'PROMOCIONES
@@ -14436,13 +14476,39 @@ Partial Class Compras_Compras
'ANTICIPO OC
If DivOCSolicitudAnticipo.Visible Then
If CveIEAnticipo > 0 Then
DVAtencionOCAnticipo.Visible = True
UpDVAtencionOCAnticipo.Update()
End If
Dim scripsSeccion As String = ""
For Each gvRow As GridViewRow In GVAnticipos.Rows
If gvRow.DataKey("CveIE").ToEntero = CveIEAnticipo Then
Dim Chk As CheckBox = gvRow.FCCheckBox("Chk")
scripsSeccion = scripsSeccion & $"$('#{Chk.ClientID}').click();"
'RegistraScript($"$('#{Chk.ClientID}').click();", "100")
End If
Next
RegistraScript("MuestraAnticipos();", "MuestaAnticiposOC")
RegistraScript("
setTimeout(function() {
" & scripsSeccion & "
}, 200)
")
UpAnticipos.Update()
End If
CalculaTotales()
CompraEstaVinculadaOC = True
If MetodoPagoOC = 0 AndAlso RBLPago.SelectedValue.ToEntero <> 2 Then
Alert("La orden de compra se definió de contado, favor de especificar la compra de contado.", TipoMensaje.MsgAdvertencia)
End If
End Sub
Private Sub VinculacionAsync(Optional VinculacionCompleta As Boolean = False)

View File

@@ -455,7 +455,7 @@
<tr id="TrMetodoPago" runat="server" visible="false">
<td><b>Método de pago:</b></td>
<td>
<asp:DropDownList ID="DdlMetodoPago" CssClass="form-control select2me" runat="server" Width="100%" CausesValidation="true">
<asp:DropDownList ID="DdlMetodoPago" CssClass="form-control select2me" runat="server" Width="100%" CausesValidation="true" AutoPostBack="true" OnSelectedIndexChanged="DdlMetodoPago_SelectedIndexChanged">
<asp:ListItem Text="-" Value="-1"></asp:ListItem>
<asp:ListItem Text="Contado" Value="0"></asp:ListItem>
<asp:ListItem Text="Crédito" Value="1"></asp:ListItem>
@@ -1563,6 +1563,89 @@
<br />
<div class="row">
<asp:UpdatePanel runat="server" ID="UpPanelDVAnticiposContado" class="portlet-body form" UpdateMode="Conditional">
<ContentTemplate>
<div class="col-md-3" runat="server" id="DVAnticposContado" visible="false">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Anticipos </span>
</div>
<div class="tools">
<a href="javascript;" class="expand" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body">
<div class="row ">
<label class="col-md-3">Porcentaje:</label>
<div class="col-md-4 form-group">
<div class="input-group">
<asp:TextBox ID="TxtSAImPorcentajeContado" min="0" max="100" CssClass="form-control input-sm" runat="server" onkeyup="SAImPorcentajeContadokeyup()" ClientIDMode="Static"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVSAImPorcentajeContado" runat="server" ControlToValidate="TxtSAImPorcentajeContado" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Porcentaje''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCESAImPorcentajeContado" runat="server" Enabled="True" HighlightCssClass="vco" TargetControlID="RFVSAImPorcentajeContado" Width="300px"></ajax:ValidatorCalloutExtender>
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtSAImPorcentajeContado" ValidChars="1234567890." />
<span class="input-group-addon">
<i style="font-weight: 700;">%</i>
</span>
</div>
</div>
</div>
<div class="row ">
<label class="col-md-3">Importe:</label>
<div class="col-md-4 form-group">
<div class="input-group">
<asp:TextBox ID="TxtSAImporteContado" min="0" max='<%=LblTotal.Text.ToString()%>' CssClass="form-control input-sm" runat="server" onkeyup="SAImporteContadokeyup()" ClientIDMode="Static"></asp:TextBox>
<asp:RangeValidator ID="RVSAImporteContado" CssClass="form-control" runat="server" ControlToValidate="TxtSAImporteContado" Display="None" Type="Double" MinimumValue="1.00" MaximumValue="2147483647" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Importe''</b> debe ser mayor a cero." ValidationGroup="GrpGuardar"></asp:RangeValidator>
<ajax:ValidatorCalloutExtender ID="VCESAImporteContado" runat="server" HighlightCssClass="vco" TargetControlID="RVSAImporteContado" Width="300px"></ajax:ValidatorCalloutExtender>
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtSAImporteContado" ValidChars="1234567890." />
<span class="input-group-addon">
<i style="font-weight: 700;">$</i>
</span>
<div class="input-group" style="text-align: right!important">
<asp:Label runat="server" ID="LblSaldoOCAnticipoContado"></asp:Label>
</div>
</div>
</div>
</div>
<hr />
<div class="row">
<label class="col-md-3">Solicitar a:</label>
<div class="col-md-9">
<asp:DropDownList ID="DdlSAUsuarioContado" CssClass="form-control input-sm select2me" DataTextField="Nombre" DataValueField="CveUsuario" runat="server" Width="100%"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVSAUsuarioContado" runat="server" InitialValue="-1" ControlToValidate="DdlSAUsuarioContado" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Usuario''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCESAUsuarioContado" runat="server" HighlightCssClass="vco" TargetControlID="RFVSAUsuarioContado" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row">
<label class="col-md-3">Observaciones:</label>
<div class="col-md-9">
<asp:TextBox ID="TxtSAObservacionesContado" CssClass="form-control input-sm" runat="server" Style="width: 100%; height: 40px;" ValidationGroup="GrpGuardar" TextMode="MultiLine" Rows="5" />
</div>
</div>
</div>
<div class="portlet-footer">
<%--<button id="CancelarSolicitarAnticipoContado" type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
<asp:Button Text="Guardar" ID="BtnSolicitarAnticipoContado" CssClass="btn btn-primary" ValidationGroup="GrpGuardar" runat="server" />--%>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="col-md-3">
<div class="portlet light xspadding bordered">
@@ -2912,10 +2995,34 @@
$('#<%= TxtSAImPorcentaje.ClientID%>').val(FormatoNumero(importe, 2).replace(/,/g, ""));
});
<%--$('#<%= TxtSAImPorcentajeContado.ClientID%>').keyup(function () {
console.log($(this).val());
var importe = (ToDouble($(this).val()) / 100) * ToDouble($get("LblTotal").value.replace(/,/g, ''));
$('#<%= TxtSAImporteContado.ClientID%>').val( FormatoNumero(importe, 2).replace(/,/g, "") );
});
$('#<%= TxtSAImporteContado.ClientID%>').keyup(function () {
var importe = (100 * ToDouble($(this).val())) / ToDouble($get("LblTotal").value.replace(/,/g, ""));
$('#<%= TxtSAImPorcentajeContado.ClientID%>').val(FormatoNumero(importe, 2).replace(/,/g, ""));
});--%>
$get('HdnWidth').value = $("#DivConceptosContenido").width();
});
function SAImPorcentajeContadokeyup() {
var importe = (ToDouble($('#TxtSAImPorcentajeContado').val()) / 100) * ToDouble($get("LblTotal").value.replace(/,/g, ''));
$('#TxtSAImporteContado').val(FormatoNumero(importe, 2).replace(/,/g, ""));
}
function SAImporteContadokeyup() {
var importe = (100 * ToDouble($('#TxtSAImporteContado').val())) / ToDouble($get("LblTotal").value.replace(/,/g, ""));
$('#TxtSAImPorcentajeContado%>').val(FormatoNumero(importe, 2).replace(/,/g, ""));
}
function showDivEC(CveCotizacion) {
$('#<%=TxtMotivoEliminacion.ClientID%>').val("");
$('#divEliminarCotizacion').modal();

View File

@@ -2,6 +2,7 @@
Option Strict On
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Imports Extensiones
Imports GemBox.Spreadsheet
@@ -2820,6 +2821,15 @@ Partial Class OC_OC
End If
If Not TieneError AndAlso DdlMetodoPago.SelectedValue.ToEntero = 0 AndAlso TipoOC = "OC" Then
If Not GeneraAnticpoContado(CveOrdenCompra, OC.IniciaTransacSQL()) Then
TieneError = True
End If
End If
If Not TieneError Then
If Conta IsNot Nothing Then Conta.Commit()
OC.Commit()
@@ -3207,6 +3217,15 @@ Partial Class OC_OC
'If Not TieneError AndAlso DdlMetodoPago.SelectedValue.ToEntero = 0 AndAlso TipoOC = "OC" Then
' If Not GeneraAnticpoContado(CveOrdenCompra, OC.IniciaTransacSQL()) Then
' TieneError = True
' End If
'End If
'COMMIT
If Not TieneError Then
'If MonedaTexto <> DdlMoneda.SelectedItem.Text Then
@@ -3258,6 +3277,9 @@ Partial Class OC_OC
End If
End If
'TERMINA TODO POR SI OCURRIÓ ALGO RARO
If TieneError Then
If OC IsNot Nothing Then OC.RollBack()
@@ -5379,7 +5401,12 @@ Partial Class OC_OC
End Sub
Private Sub EnviaCorreoSolicitudAnticipo(CveEvento As Integer)
Dim Param As New List(Of String)
Dim DtPara As DataTable = GlobalDTUsuarios(DdlSAUsuario.SelectedValue.ToString.ToEntero, CveEmpresaActual)
If DdlMetodoPago.SelectedValue.ToEntero = 0 Then
DtPara = GlobalDTUsuarios(DdlSAUsuarioContado.SelectedValue.ToString.ToEntero, CveEmpresaActual)
End If
Param.Add(DtPara.Rows(0)("Correo").ToString()) 'Para
Param.Add("Solicitud de anticipo de Orden de Compra") 'Asunto
Param.Add(GeneraCorreoAnticipo(lblFolio.Text, DtPara.Rows(0)("Nombre").ToString(), String.Format("http://sig.adssistemas.mx/OI/EventoDetalle.aspx?CveTipoEvento=1&CveEvento={0}", CveEvento), TxtSAImporte.Text, DdlProveedores.SelectedText))
@@ -8846,4 +8873,80 @@ Partial Class OC_OC
End Sub
Protected Sub DdlMetodoPago_SelectedIndexChanged(sender As Object, e As EventArgs)
DVAnticposContado.Visible = False
If DdlMetodoPago.SelectedValue.ToEntero = 0 Then
DVAnticposContado.Visible = True
DdlSAUsuarioContado.DataSource = GlobalDTUsuarios(-1, CveEmpresaActual).FiltraParametros("CvePlataforma = 1", "Nombre")
DdlSAUsuarioContado.DataBind()
DdlSAUsuarioContado.Items.Insert(0, New ListItem("Seleccione", "-1"))
'CargaAnticiposSolicitudesContado()
End If
UpPanelDVAnticiposContado.Update()
End Sub
Protected Function GeneraAnticpoContado(CveOrdenCompraContado As Integer, ByRef transaccionSql As SqlTransaction) As Boolean
Dim respuesta As Boolean = False
If TxtSAImporteContado.Text.ToDecimal > LblTotal.Text.ToDecimal Then
Alert("El importe solicitado supera el saldo de la orden de compra", TipoMensaje.MsgAdvertencia)
Return False
End If
Dim Descripcion As New StringBuilder
Descripcion.AppendFormat("Importe anticipo : ${0} ({1}%) - <a target=""_blank"" href=""/Bancos/IE.aspx?Opcion=EGSSINFACT&CveOC={2}"">Pagar anticipo</a> - <b>Observacion:</b> {2} ", TxtSAImporteContado.Text.FormatoNumero, TxtSAImPorcentajeContado.Text, CveOrdenCompraContado, TxtSAObservacionesContado.Text)
Descripcion.AppendFormat("Orden de compra : {0} - <a target=""_blank"" href=""/OC/OC.aspx?OC={1}"">Ir a la orden de compra</a> - <a target=""_blank"" href=""/Compras/PopUpVerFactura.aspx?P={2}"">Imprimir OC</a>", Folio, CveOrdenCompraContado, Encripta(String.Format("OP=OC&CVEOC={0}", CveOrdenCompraContado)))
Dim Asunto As String = $"{lblFolio.Text} - Solicitud de anticipo "
Dim ObjOC As New ClsOC(transaccionSql)
Dim ObjOI As New ClsOIEventos(ObjOC.IniciaTransacSQL)
Dim TieneError As Boolean = False
If ObjOI.AddEventoTarea(Asunto, Descripcion.ToString, 1, UsuarioActual.CveUsuario, DdlSAUsuarioContado.SelectedValue.ToString.ToEntero, NowADS(), NowADS().AddMinutes(15), -1, 1, -1, "-1", -1, -1, -1, -1, -1, CveOrdenCompraContado.ToEntero, -1, -1, UsuarioActual.CveUsuario, -1, CveEmpresaActual) Then
If Not ObjOC.AddSolicitudAnticipo(CveOrdenCompraContado, TxtSAImporteContado.Text.ToDecimal, CveEmpresaActual) Then
TieneError = True
End If
Else
TieneError = True
End If
If Not ObjOI.AddEventoBitacora($"Solicitud de anticipo de orden de compra por ${TxtSAImporteContado.Text.FormatoNumero}", "-1", UsuarioActual.CveUsuario, CveEmpresaActual, CveOC:=CveOrdenCompraContado) Then
TieneError = True
End If
If Not TieneError Then
EnviaCorreoSolicitudAnticipo(ObjOI.CveEvento)
'LIMPIA
DdlSAUsuarioContado.SelectedValue = "-1"
TxtSAImporteContado.Text = ""
TxtSAObservacionesContado.Text = ""
TxtSAImPorcentajeContado.Text = ""
Alert("La solicitud de anticipo ha sido enviada correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al hacer la solicitud de anticipo.", TipoMensaje.MsgError)
End If
If TieneError Then
respuesta = False
Else
respuesta = True
End If
Return respuesta
End Function
End Class