This commit is contained in:
2022-02-02 21:59:40 -07:00
39 changed files with 40985 additions and 33669 deletions

View File

@@ -100,7 +100,7 @@
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveAutorizacion,CveCliente,CveVendedor,Importe"
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveAutorizacion,CveCliente,CveVendedor,Importe,TipoAutorizacion,Saldo,LimiteCredito,DiasVencidos,DiasVencidosAutorizacion"
EmptyDataText="No se encontraron autorizaciones" ToolTip=""
CssClass="table table-striped table-advance table-hover ScrollAD mysmallbtn" data-sort="true" Width="100%" GridLines="None">
<Columns>

View File

@@ -183,12 +183,57 @@ Partial Class Ventas_CatAutorizacionLimites
' e.Row.Cells(1).Font.Bold = True
' e.Row.Cells(1).Text = "Activo"
'Else
' e.Row.Cells(1).Text = "Inactivo"
' e.Row.Cells(1).ForeColor = Drawing.Color.Red
' e.Row.Cells(1).Font.Bold = True
'End If
'End If
End If
End Sub
#End Region
Protected Sub LnkAutorizar_Click(sender As Object, e As EventArgs)
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
Dim TipoAutorizacion = gvRow.DataKey("TipoAutorizacion").ToEntero()
Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero()
Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero()
Dim CveVendedor = gvRow.DataKey("CveVendedor").ToEntero()
Dim CveEstatusAutorizacion As Integer = 1
Dim Importe = gvRow.DataKey("Importe").ToDecimal().RoundSQL(2)
'AUTORIZACION DE IMPORTE,
'el cliente limite de 500, y saldo de 501. autorización que puede autorizar no puede ser mayor a 49 ( limite * 1.% - Saldo)
If TipoAutorizacion = 1 Then
Dim SaldoCliente = gvRow.DataKey("Saldo").ToDecimal()
Dim LimiteCredito = gvRow.DataKey("LimiteCredito").ToDecimal()
Dim PorcentajeMaximoAutorizar As Decimal = 0.1
If UsuarioActual.PorcentajeMaximoAutorizacion > 0 Then
PorcentajeMaximoAutorizar = (UsuarioActual.PorcentajeMaximoAutorizacion / 100)
End If
Dim ImporteMaximoAutorizar As Decimal = ((LimiteCredito * (1D + PorcentajeMaximoAutorizar)) - SaldoCliente).RoundSQL(2)
If Importe > ImporteMaximoAutorizar Then
Alert($"No se puede autorizar, el importe máximo a autorizar es de {ImporteMaximoAutorizar:N2}", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'AUTORIZACION POR DIAS VENCIDOS
ElseIf TipoAutorizacion = 2 Then
Dim DiasVencidos = gvRow.DataKey("DiasVencidos").ToEntero()
If DiasVencidos > 0 Then
Dim DiasVencidosPermitidos As Integer = 5
Dim DiasVencidosAutorizacion = gvRow.DataKey("DiasVencidosAutorizacion").ToEntero()
If DiasVencidos > DiasVencidosAutorizacion Then
Alert($"No se puede autorizar, los días vencidos del cliente son mayores a la autorización. Dias Vencidos: {DiasVencidos:N0}", TipoMensaje.MsgAdvertencia)
Exit Sub
End If

View File

@@ -3076,7 +3076,7 @@
</div>
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtConsecutivoAjuste" CssClass="form-control" runat="server" MaxLength="25" Enabled="false"></asp:TextBox>
<asp:TextBox ID="TxtConsecutivoAjuste" CssClass="form-control" runat="server" MaxLength="25" OnTextChanged="TxtConsecutivoAjuste_TextChanged"></asp:TextBox>
<%--<asp:RequiredFieldValidator ID="RFVConsecutivoAjuste" runat="server" ControlToValidate="TxtConsecutivoAjuste" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Consec.''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%>
<%--<ajax:ValidatorCalloutExtender ID="VCEConsecutivoAjuste" runat="server" HighlightCssClass="vco" TargetControlID="RFVConsecutivoAjuste"></ajax:ValidatorCalloutExtender>--%>
<label for="<%= TxtConsecutivoAjuste.ClientID.ToString()%>">Consec.:</label>

View File

@@ -5319,6 +5319,12 @@ Partial Class PV
Alert($"El folio de garantía no es valido.<br/> Clasificacion del Producto:{FolioGarantia.ClasificacionPS}.<br/>Tipo Folio:{FolioGarantia.TipoFolio}", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If Not ValidaConsecutivo() Then
Alert("Ya existe un consecutivo vigente en este folio", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
If AgregarPS() Then
@@ -7091,6 +7097,7 @@ Partial Class PV
If Not CalculaMesesUso() Then
Exit Sub
End If
Try
TxtImporteAjuste.Text = "0.00"
If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" AndAlso DdlPS.SelectedValue.ToEntero > 0 Then
@@ -8180,4 +8187,26 @@ Partial Class PV
End If
Next
End Sub
Protected Sub TxtConsecutivoAjuste_TextChanged(sender As Object, e As EventArgs)
If Not ValidaConsecutivo() Then
Alert("Ya existe un consecutivo vigente en este folio", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End Sub
Private Function ValidaConsecutivo() As Boolean
Dim Retorno As Boolean = True
If DdlFolioGarantia.SelectedValue.ToEntero() > 0 Then
Using ObjAcum As New ClsAcumuladores
If ObjAcum.GetFoliosGarantiasDetalle(DdlFolioGarantia.SelectedValue.ToEntero(), CveEstatusConsecutivo:=1, Consec:=TxtConsecutivoAjuste.Text.ToEntero()) Then
If ObjAcum.DtResultados.Rows.Count > 0 Then
Retorno = False
End If
End If
End Using
End If
Return Retorno
End Function
End Class

View File

@@ -126,6 +126,7 @@
<asp:LinkButton ID="LnkCancelar" Visible="false" runat="server" OnClick="BtnCancelarDocumento_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea cancelar el documento?" data-btn-ok-label="si"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField HeaderText="Refacturar" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" />
</Columns>
<RowStyle CssClass="Texto" />
<HeaderStyle CssClass="Titulos" />
@@ -134,7 +135,7 @@
</div>
</div>
</div>
<asp:HiddenField ID="HdnLigaRefacturar" runat="server" Value="" ClientIDMode="Static" />
<%--<asp:HiddenField ID="HdnLigaRefacturar" runat="server" Value="" ClientIDMode="Static" />--%>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="BtnEnviarMailCancelacion" runat="server" ClientIDMode="Static" Text="Enviar Mail Cliente" Style="display: none;" OnClick="BtnEnviarMailCancelacion_Click" />
@@ -143,7 +144,7 @@
<script src="/Metronic/assets/global/plugins/jquery.pulsate.min.js"></script>
<script type="text/javascript">
function RefacturarDocumento() {
window.location.replace(HdnLigaRefacturar.value);
//window.location.replace(HdnLigaRefacturar.value);
}
function BtnEnviarMailCancelacion() {

View File

@@ -34,7 +34,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
}
private void CargaDatos()
{
HdnLigaRefacturar.Value = "";
//HdnLigaRefacturar.Value = "";
if (Request["CveVenta"] != null)
{
@@ -68,9 +68,9 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
}
ObjVentas.Dispose();
GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0");
GvDatos.DataSource = DtVentas.FiltraParametros("(CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0)");
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)");
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3) OR (CveEstatusFactura = 20 AND CveEstatusRefacturacion > 0) OR CveEstatusFactura = 23");
if (DtRefacturar != null && DtRefacturar.Rows.Count > 0)
{
DivRefacturar.Visible = true;
@@ -83,7 +83,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
}
protected void BtnValidar_Click(object sender, EventArgs e)
{
this.HdnLigaRefacturar.Value = "";
//this.HdnLigaRefacturar.Value = "";
this.CveVenta = -1;
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
@@ -114,7 +114,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
}
protected void BtnValidarRefacturacion_Click(object sender, EventArgs e)
{
this.HdnLigaRefacturar.Value = "";
//this.HdnLigaRefacturar.Value = "";
this.CveVenta = -1;
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
@@ -136,7 +136,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
CargaDatos();
if (respuesta.CveEstatus.Contiene(4, 5))
{
HdnLigaRefacturar.Value = respuesta.LigaRefacturacion;
//HdnLigaRefacturar.Value = respuesta.LigaRefacturacion;
Alert(respuesta.Mensaje, JSBtnAceptar: $"RefacturarDocumento();");
}
else
@@ -160,7 +160,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
protected void BtnCancelarDocumento_Click(object sender, EventArgs e)
{
this.HdnLigaRefacturar.Value = "";
//this.HdnLigaRefacturar.Value = "";
this.CveVenta = -1;
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
@@ -228,7 +228,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
}
private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false, string FolioSustitucion = "")
{
HdnLigaRefacturar.Value = "";
//HdnLigaRefacturar.Value = "";
var retorno = new MRespuestaSAT()
{
@@ -431,7 +431,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
protected void LnkValidar_Click(object sender, EventArgs e)
{
this.HdnLigaRefacturar.Value = "";
//this.HdnLigaRefacturar.Value = "";
this.CveVenta = -1;
if (DtVentas != null)
@@ -462,10 +462,10 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0)
//{
// e.Row.Cells[14].Text = "";
//}
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0 || !string.IsNullOrEmpty(e.Row.DBCampo("FolioFiscalSustitucion").ToString()))
{
e.Row.Cells[12].Text = "";
}
//if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 1 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23)
//{

View File

@@ -1905,6 +1905,14 @@ Partial Class Ventas
ViewState("CveVendedorVenta") = value
End Set
End Property
Private Property CveVendedorCliente As Integer
Get
Return If(IsNothing(ViewState("CveVendedorCliente")), -1, ViewState("CveVendedorCliente")).ToString().ToEntero
End Get
Set(value As Integer)
ViewState("CveVendedorCliente") = value
End Set
End Property
Private Property DiasCredito As Integer
Get
Return ViewState("DiasCredito").ToString().ToEntero()
@@ -2177,6 +2185,7 @@ Partial Class Ventas
ViewState("CvePrecioLista") = 0
ViewState("CvePrecioListaCliente") = 0
Me.CveVendedorVenta = -1
Me.CveVendedorCliente = -1
Me.EsGarantia = False
idCuentaContabilizacion = 1
CveEmpresaCRM = 0
@@ -4245,13 +4254,13 @@ Partial Class Ventas
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
Dim CveCliente As Integer = DbRowVenta("CveCliente").ToString().ToEntero()
HdnCveVenta.Value = CveVenta.ToString()
Dim DtUsados As DataTable = Nothing
Dim DtUsadosPendientes As DataTable = Nothing
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim ObjUsados As New ClsVentas
If ObjUsados.GetVentasUsados(CveVenta, -1, DbRowVenta("Fecha").ToString().ToDateTime, UsuarioActual.CveEmpresa) Then
DtUsados = ObjUsados.DtResultados
DtUsadosPendientes = ObjUsados.DtResultados
End If
ObjUsados.Dispose()
End If
@@ -5191,7 +5200,7 @@ Partial Class Ventas
'Si es Empresa de Acumuladores
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
'Si ya se surtió y recibió
If (DbRowVenta("SaldoAlmacen").ToString().ToDecimal > 0 And (DtUsados Is Nothing Or DtUsados.Rows.Count = 0)) OrElse (TmpDT.MAX("CveTipoPS") = "1") Then
If (DbRowVenta("SaldoAlmacen").ToString().ToDecimal > 0 And (DtUsadosPendientes Is Nothing Or DtUsadosPendientes.Rows.Count = 0)) OrElse (TmpDT.MAX("CveTipoPS") = "1") Then
BtnsFacturar.Visible = True
Else
BtnsFacturar.Visible = False
@@ -6050,6 +6059,7 @@ Partial Class Ventas
If ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero() > 0 Then
DdlVendedor.SelectedValueExist(ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero())
CveVendedorCliente = ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero()
End If
'SI EL CLIENTE NO TIENE VENDEDOR SELECCIONAMOS EL DEL USUARIO
@@ -17011,7 +17021,12 @@ Partial Class Ventas
End Sub
Private Sub CargaVendedores()
Dim CveVendedorActual = DdlVendedor.SelectedValue
Dim CveVendedorActual = DdlVendedor.SelectedValue.ToEntero()
If Not CveVendedorActual > 0 AndAlso Me.CveVendedorCliente > 0 Then
DdlVendedor.SelectedValueExist(Me.CveVendedorCliente)
CveVendedorActual = Me.CveVendedorCliente
End If
DdlVendedor.Items.Clear()
If UsuarioActual.Empresa.Funcionalidad(302) = "1" AndAlso DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then
@@ -17038,6 +17053,10 @@ Partial Class Ventas
DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString())
End If
If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
DdlVendedor.Enabled = False
End If
'TxtCorreoNotificaciones.Text = GlobalDTUsuarios(UsuarioActual.CveUsuario).FiltroPrimeroValor("Correo")
End Sub
#End Region
@@ -27518,7 +27537,7 @@ Partial Class Ventas
UltimoRenglonRNC += 1
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
If Cantidad.RoundSQL(6) > 0D AndAlso ImportePU.RoundSQL(6) > 0 Then
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowUsado("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
@@ -27611,7 +27630,7 @@ Partial Class Ventas
UltimoRenglonRNC += 1
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
If Cantidad.RoundSQL(6) > 0D AndAlso ImportePU.RoundSQL(6) > 0 Then
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA,
@@ -27703,7 +27722,7 @@ Partial Class Ventas
UltimoRenglonRNC += 1
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
If Cantidad.RoundSQL(6) > 0D AndAlso ImportePU.RoundSQL(6) > 0 Then
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
@@ -27797,7 +27816,7 @@ Partial Class Ventas
UltimoRenglonRNC += 1
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
If Cantidad.RoundSQL(6) > 0D AndAlso ImportePU.RoundSQL(6) > 0 Then
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
@@ -27885,7 +27904,7 @@ Partial Class Ventas
UltimoRenglonRNC += 1
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
If Cantidad.RoundSQL(6) > 0D AndAlso ImportePU.RoundSQL(6) > 0 Then
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA,
@@ -27972,7 +27991,7 @@ Partial Class Ventas
UltimoRenglonRNC += 1
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
If Cantidad.RoundSQL(6) > 0D Then
If Cantidad.RoundSQL(6) > 0D AndAlso ImportePU.RoundSQL(6) > 0 Then
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowRNC("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowRNC("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,