Validacion de cancelacion por refacturacion
This commit is contained in:
@@ -219,7 +219,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
|||||||
|
|
||||||
Dim CvePS = IfNull(context.Request("cveps"), "0").ToString.ToEntero
|
Dim CvePS = IfNull(context.Request("cveps"), "0").ToString.ToEntero
|
||||||
Dim objInv As New ClsInventarios
|
Dim objInv As New ClsInventarios
|
||||||
If objInv.GetExistenciasProducto(CvePS, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then
|
If objInv.GetExistenciasPS(CvePS, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then
|
||||||
|
|
||||||
' limpio los almacenes donde no tiene ningun producto existencia
|
' limpio los almacenes donde no tiene ningun producto existencia
|
||||||
For i = objInv.DtResultados.Columns.Count - 1 To 1 Step -1
|
For i = objInv.DtResultados.Columns.Count - 1 To 1 Step -1
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ Partial Class Inventarios_KardexAlmacen
|
|||||||
'End If
|
'End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Private Function CargarKardex(CvePS As Integer) As DataTable
|
Private Sub CargarKardex(CvePS As Integer)
|
||||||
Dim dt As DataTable = Nothing
|
Dim dt As DataTable = Nothing
|
||||||
Dim ObjMovimientos As New ClsInventarios
|
Dim ObjMovimientos As New ClsInventarios
|
||||||
Dim FechaI As String = "-1" ' If(TxtFechaI.Text <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text, "-1")
|
Dim FechaI As String = "-1" ' If(TxtFechaI.Text <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text, "-1")
|
||||||
@@ -132,7 +132,7 @@ Partial Class Inventarios_KardexAlmacen
|
|||||||
If ObjMovimientos.DtResultados IsNot Nothing AndAlso ObjMovimientos.DtResultados.Rows.Count > 0 Then
|
If ObjMovimientos.DtResultados IsNot Nothing AndAlso ObjMovimientos.DtResultados.Rows.Count > 0 Then
|
||||||
dt = ObjMovimientos.DtResultados
|
dt = ObjMovimientos.DtResultados
|
||||||
Dim ListaBorrar As New List(Of DataColumn)
|
Dim ListaBorrar As New List(Of DataColumn)
|
||||||
For index = 2 To dt.Columns.Count - 1
|
For index = 3 To dt.Columns.Count - 1
|
||||||
Dim TotColumna As Double = 0
|
Dim TotColumna As Double = 0
|
||||||
For Each Dr As DataRow In dt.Rows
|
For Each Dr As DataRow In dt.Rows
|
||||||
TotColumna += Dr.Item(index).ToString.ToDouble
|
TotColumna += Dr.Item(index).ToString.ToDouble
|
||||||
@@ -150,24 +150,21 @@ Partial Class Inventarios_KardexAlmacen
|
|||||||
Alert("La búsqueda no contiene resultados.", TipoMensaje.MsgAdvertencia)
|
Alert("La búsqueda no contiene resultados.", TipoMensaje.MsgAdvertencia)
|
||||||
GvDatos.Columns.Clear()
|
GvDatos.Columns.Clear()
|
||||||
dt = Nothing
|
dt = Nothing
|
||||||
Return dt
|
Exit Sub
|
||||||
Exit Function
|
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
ObjMovimientos.Dispose()
|
ObjMovimientos.Dispose()
|
||||||
Alert("Ocurrió un error al consultar el Kardex.", TipoMensaje.MsgError)
|
Alert("Ocurrió un error al consultar el Kardex.", TipoMensaje.MsgError)
|
||||||
Exit Function
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
GvDatos.DataBind()
|
GvDatos.DataBind()
|
||||||
|
|
||||||
For index = 3 To GvDatos.Rows(0).Cells.Count - 1
|
For index = 4 To GvDatos.Rows(0).Cells.Count - 1
|
||||||
GvDatos.HeaderRow.Cells(index).Text = GvDatos.HeaderRow.Cells(index).Text.Split("|")(0)
|
GvDatos.HeaderRow.Cells(index).Text = GvDatos.HeaderRow.Cells(index).Text.Split("|")(0)
|
||||||
Next
|
Next
|
||||||
|
End Sub
|
||||||
Return dt
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||||
|
|
||||||
@@ -180,6 +177,7 @@ Partial Class Inventarios_KardexAlmacen
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
e.Row.HorizontalAlign = HorizontalAlign.Right
|
e.Row.HorizontalAlign = HorizontalAlign.Right
|
||||||
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
||||||
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
|
||||||
Dim Index As Integer = 0
|
Dim Index As Integer = 0
|
||||||
|
|
||||||
@@ -187,7 +185,7 @@ Partial Class Inventarios_KardexAlmacen
|
|||||||
Dim Celda As String = Cells.Text
|
Dim Celda As String = Cells.Text
|
||||||
If IsNumeric(Celda) Then
|
If IsNumeric(Celda) Then
|
||||||
Dim CveAlmacen2 As Integer = -1
|
Dim CveAlmacen2 As Integer = -1
|
||||||
If Index >= 4 Then
|
If Index >= 5 Then
|
||||||
Dim Array = GvDatos.HeaderRow.Cells(Index).Text.Split("|")
|
Dim Array = GvDatos.HeaderRow.Cells(Index).Text.Split("|")
|
||||||
If Array.Length > 1 Then
|
If Array.Length > 1 Then
|
||||||
CveAlmacen2 = Array(1)
|
CveAlmacen2 = Array(1)
|
||||||
@@ -224,10 +222,10 @@ Partial Class Inventarios_KardexAlmacen
|
|||||||
Private Sub GvDatos_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowCreated
|
Private Sub GvDatos_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowCreated
|
||||||
'Escondo CvePS y CveAlmacén (Se generan por autogeneratecolumns por eso se borran por aqui).
|
'Escondo CvePS y CveAlmacén (Se generan por autogeneratecolumns por eso se borran por aqui).
|
||||||
' e.Row.Cells(0).Width = New Unit("200px")
|
' e.Row.Cells(0).Width = New Unit("200px")
|
||||||
e.Row.Cells(1).Visible = False
|
|
||||||
e.Row.Cells(2).Visible = False
|
e.Row.Cells(2).Visible = False
|
||||||
|
e.Row.Cells(3).Visible = False
|
||||||
If e.Row.RowType = DataControlRowType.Header Then
|
If e.Row.RowType = DataControlRowType.Header Then
|
||||||
e.Row.Cells(5).ToolTip = "Costo Promedio"
|
e.Row.Cells(6).ToolTip = "Costo Promedio"
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,8 @@ Partial Class Inventarios_ReporteEntradasSalidas
|
|||||||
Dim Almacen As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Almacen", $"CveAlmacen = {Request("CveAlmacen").ToString}")
|
Dim Almacen As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Almacen", $"CveAlmacen = {Request("CveAlmacen").ToString}")
|
||||||
DdlAlmacen.Items.Insert(0, New ListItem(Almacen, CveAlmacen))
|
DdlAlmacen.Items.Insert(0, New ListItem(Almacen, CveAlmacen))
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
DdlAlmacen.SelectedValuesIfExistM("-1")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Llenar dropdownlist de monedas
|
'Llenar dropdownlist de monedas
|
||||||
@@ -345,7 +347,7 @@ Partial Class Inventarios_ReporteEntradasSalidas
|
|||||||
Dim FechaI As String = FechaInicial
|
Dim FechaI As String = FechaInicial
|
||||||
Dim FechaF As String = FechaFinal
|
Dim FechaF As String = FechaFinal
|
||||||
|
|
||||||
Dim Almacen = If(DdlAlmacen.SelectedValue = "-1", "", $" <b>Almacén:</b> {DdlAlmacen.SelectedItem.Text}")
|
Dim Almacen = If(DdlAlmacen.GetSelectedValuesM = "", "", $" <b>Almacenes:</b> {DdlAlmacen.GetSelectedText()}")
|
||||||
Dim TipoMov = If(DdlTipoMovimiento.SelectedValue = "-1", "", $" <b>Tipo Movimiento:</b> {DdlTipoMovimiento.SelectedItem.Text}")
|
Dim TipoMov = If(DdlTipoMovimiento.SelectedValue = "-1", "", $" <b>Tipo Movimiento:</b> {DdlTipoMovimiento.SelectedItem.Text}")
|
||||||
Dim Moneda = If(DdlMoneda.SelectedValue = "-1", "", $" <b>Moneda:</b> {DdlMoneda.SelectedItem.Text}")
|
Dim Moneda = If(DdlMoneda.SelectedValue = "-1", "", $" <b>Moneda:</b> {DdlMoneda.SelectedItem.Text}")
|
||||||
Dim SoloConMov = If(DdlMovs.SelectedValue = "-1", "", $" <b>Solo Movimientos:</b> {DdlMovs.SelectedItem.Text}")
|
Dim SoloConMov = If(DdlMovs.SelectedValue = "-1", "", $" <b>Solo Movimientos:</b> {DdlMovs.SelectedItem.Text}")
|
||||||
|
|||||||
@@ -78,7 +78,6 @@
|
|||||||
<!-- BEGIN LOGO -->
|
<!-- BEGIN LOGO -->
|
||||||
<div class="page-logo">
|
<div class="page-logo">
|
||||||
<asp:Literal ID="LitTit" runat="server"></asp:Literal>
|
<asp:Literal ID="LitTit" runat="server"></asp:Literal>
|
||||||
<asp:TextBox ID="TxtTit" BorderStyle="None" runat="server" Visible="false" Width="500px"></asp:TextBox>
|
|
||||||
<%--<a href="/Inicio.aspx">
|
<%--<a href="/Inicio.aspx">
|
||||||
<asp:Image ID="IMGLogo" runat="server" alt="logo" class="logo-default" style="height:40px; margin: 3px 0 0 0;"/>
|
<asp:Image ID="IMGLogo" runat="server" alt="logo" class="logo-default" style="height:40px; margin: 3px 0 0 0;"/>
|
||||||
<asp:Label ID="LblEmpresa" runat="server" CssClass="EmpresaName"></asp:Label>
|
<asp:Label ID="LblEmpresa" runat="server" CssClass="EmpresaName"></asp:Label>
|
||||||
@@ -368,13 +367,16 @@
|
|||||||
<div class='page-content <%=If(EsPopup, "mpoup", "") %>' style=''>
|
<div class='page-content <%=If(EsPopup, "mpoup", "") %>' style=''>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-7">
|
||||||
<h3 class="page-title" runat="server" id="headertitleh3">
|
<h3 class="page-title" runat="server" id="headertitleh3">
|
||||||
<asp:ContentPlaceHolder ID="E" runat="server">
|
<asp:ContentPlaceHolder ID="E" runat="server">
|
||||||
</asp:ContentPlaceHolder>
|
</asp:ContentPlaceHolder>
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-3 text-right" style="padding-top: 8px; white-space: nowrap;">
|
<div class="col-sm-3">
|
||||||
|
<asp:TextBox ID="TxtTit" BorderStyle="None" CssClass="form-control input-sm" runat="server" Visible="false" Width="100%"></asp:TextBox>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2 text-right" style="padding-top: 8px; white-space: nowrap;">
|
||||||
<i class="icon-calendar"></i>
|
<i class="icon-calendar"></i>
|
||||||
<asp:Label ID="lblFecha" CssClass="thin uppercase hidden-xs" runat="server"></asp:Label>
|
<asp:Label ID="lblFecha" CssClass="thin uppercase hidden-xs" runat="server"></asp:Label>
|
||||||
<asp:Label ID="lblTipoCambio" CssClass="thin uppercase hidden-xs" runat="server"></asp:Label>
|
<asp:Label ID="lblTipoCambio" CssClass="thin uppercase hidden-xs" runat="server"></asp:Label>
|
||||||
|
|||||||
@@ -63,9 +63,7 @@ Partial Class Site
|
|||||||
If Not Page.IsPostBack Then
|
If Not Page.IsPostBack Then
|
||||||
lblFecha.Text = DateTime.Now.ToString("dd.MMMyyyy HH:mm tt")
|
lblFecha.Text = DateTime.Now.ToString("dd.MMMyyyy HH:mm tt")
|
||||||
MasterChat.Visible = False
|
MasterChat.Visible = False
|
||||||
If UsuarioActual.CveUsuario = 100 Then
|
|
||||||
TxtTit.Visible = True
|
|
||||||
End If
|
|
||||||
If Request("Masterimpoup") IsNot Nothing AndAlso Request("Masterimpoup").ToString = "true" Then EsPopup = True
|
If Request("Masterimpoup") IsNot Nothing AndAlso Request("Masterimpoup").ToString = "true" Then EsPopup = True
|
||||||
If UsuarioActual IsNot Nothing Then
|
If UsuarioActual IsNot Nothing Then
|
||||||
HdnCveE.Value = UsuarioActual.CveEmpresa.ToString
|
HdnCveE.Value = UsuarioActual.CveEmpresa.ToString
|
||||||
@@ -73,6 +71,7 @@ Partial Class Site
|
|||||||
LitTit.Text = UsuarioActual.Empresa.EmpresaEncabezado
|
LitTit.Text = UsuarioActual.Empresa.EmpresaEncabezado
|
||||||
If UsuarioActual.CveUsuario = 100 Then
|
If UsuarioActual.CveUsuario = 100 Then
|
||||||
LitTit.Text = String.Format("<span style='color:white; font-size:x-large'></span> <span style='color: #32A1CF; font-size:x-large'>Mi Empresa de Ventas ({0})</span> ", UsuarioActual.CveEmpresa)
|
LitTit.Text = String.Format("<span style='color:white; font-size:x-large'></span> <span style='color: #32A1CF; font-size:x-large'>Mi Empresa de Ventas ({0})</span> ", UsuarioActual.CveEmpresa)
|
||||||
|
TxtTit.Visible = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim thisURL As String = Request.Url.Segments(Request.Url.Segments.Count - 1)
|
Dim thisURL As String = Request.Url.Segments(Request.Url.Segments.Count - 1)
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
<asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" />
|
<asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" />
|
||||||
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
|
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:LinkButton runat="server" OnClick="BtnValidar_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
|
<asp:LinkButton runat="server" OnClick="BtnValidarRefacturacion_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:HyperLinkField HeaderText="Refacturación" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" />
|
<asp:HyperLinkField HeaderText="Refacturación" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" />
|
||||||
|
|||||||
@@ -79,6 +79,25 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
}
|
}
|
||||||
CargaDatos();
|
CargaDatos();
|
||||||
}
|
}
|
||||||
|
protected void BtnValidarRefacturacion_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||||
|
int CveVenta = GvRow.DataKey("CveVenta").ToEntero();
|
||||||
|
int CveCliente = GvRow.DataKey("CveCliente").ToEntero();
|
||||||
|
string Total = GvRow.DataKey("Total");
|
||||||
|
string SubTotal = GvRow.DataKey("SubTotal");
|
||||||
|
string Uuid = GvRow.DataKey("FolioFiscal");
|
||||||
|
string RFCCliente = GvRow.DataKey("RFCCliente");
|
||||||
|
string Folio = GvRow.DataKey("Folio");
|
||||||
|
string TipoDocto = GvRow.DataKey("TipoDocto");
|
||||||
|
string Nombre = GvRow.DataKey("Nombre");
|
||||||
|
if (CveVenta > 0)
|
||||||
|
{
|
||||||
|
Alert(VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total, true));
|
||||||
|
}
|
||||||
|
CargaDatos();
|
||||||
|
}
|
||||||
private string VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false)
|
private string VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
@@ -132,7 +151,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
|
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
|
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion).Mensaje;
|
||||||
|
|
||||||
sb.AppendFormat("{0} <br/>", FueCancelado);
|
sb.AppendFormat("{0} <br/>", FueCancelado);
|
||||||
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||||
@@ -170,10 +189,19 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
|||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion)
|
private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false)
|
||||||
{
|
{
|
||||||
|
Modelos.Factura.MCancelacionVentaMensaje retorno = null;
|
||||||
var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa);
|
var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa);
|
||||||
var retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse);
|
if (EsRefacturacion)
|
||||||
|
{
|
||||||
|
retorno = factura.CancelarPorRefacturacion();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse);
|
||||||
|
}
|
||||||
|
|
||||||
return retorno;
|
return retorno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user