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 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
|
||||
For i = objInv.DtResultados.Columns.Count - 1 To 1 Step -1
|
||||
|
||||
@@ -119,7 +119,7 @@ Partial Class Inventarios_KardexAlmacen
|
||||
'End If
|
||||
|
||||
End Sub
|
||||
Private Function CargarKardex(CvePS As Integer) As DataTable
|
||||
Private Sub CargarKardex(CvePS As Integer)
|
||||
Dim dt As DataTable = Nothing
|
||||
Dim ObjMovimientos As New ClsInventarios
|
||||
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
|
||||
dt = ObjMovimientos.DtResultados
|
||||
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
|
||||
For Each Dr As DataRow In dt.Rows
|
||||
TotColumna += Dr.Item(index).ToString.ToDouble
|
||||
@@ -150,24 +150,21 @@ Partial Class Inventarios_KardexAlmacen
|
||||
Alert("La búsqueda no contiene resultados.", TipoMensaje.MsgAdvertencia)
|
||||
GvDatos.Columns.Clear()
|
||||
dt = Nothing
|
||||
Return dt
|
||||
Exit Function
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
ObjMovimientos.Dispose()
|
||||
Alert("Ocurrió un error al consultar el Kardex.", TipoMensaje.MsgError)
|
||||
Exit Function
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
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)
|
||||
Next
|
||||
|
||||
Return dt
|
||||
End Function
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
|
||||
@@ -180,6 +177,7 @@ Partial Class Inventarios_KardexAlmacen
|
||||
End If
|
||||
|
||||
e.Row.HorizontalAlign = HorizontalAlign.Right
|
||||
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
||||
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
|
||||
Dim Index As Integer = 0
|
||||
|
||||
@@ -187,7 +185,7 @@ Partial Class Inventarios_KardexAlmacen
|
||||
Dim Celda As String = Cells.Text
|
||||
If IsNumeric(Celda) Then
|
||||
Dim CveAlmacen2 As Integer = -1
|
||||
If Index >= 4 Then
|
||||
If Index >= 5 Then
|
||||
Dim Array = GvDatos.HeaderRow.Cells(Index).Text.Split("|")
|
||||
If Array.Length > 1 Then
|
||||
CveAlmacen2 = Array(1)
|
||||
@@ -224,10 +222,10 @@ Partial Class Inventarios_KardexAlmacen
|
||||
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).
|
||||
' e.Row.Cells(0).Width = New Unit("200px")
|
||||
e.Row.Cells(1).Visible = False
|
||||
e.Row.Cells(2).Visible = False
|
||||
e.Row.Cells(3).Visible = False
|
||||
If e.Row.RowType = DataControlRowType.Header Then
|
||||
e.Row.Cells(5).ToolTip = "Costo Promedio"
|
||||
e.Row.Cells(6).ToolTip = "Costo Promedio"
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -120,6 +120,8 @@ Partial Class Inventarios_ReporteEntradasSalidas
|
||||
Dim Almacen As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Almacen", $"CveAlmacen = {Request("CveAlmacen").ToString}")
|
||||
DdlAlmacen.Items.Insert(0, New ListItem(Almacen, CveAlmacen))
|
||||
End If
|
||||
Else
|
||||
DdlAlmacen.SelectedValuesIfExistM("-1")
|
||||
End If
|
||||
|
||||
'Llenar dropdownlist de monedas
|
||||
@@ -345,7 +347,7 @@ Partial Class Inventarios_ReporteEntradasSalidas
|
||||
Dim FechaI As String = FechaInicial
|
||||
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 Moneda = If(DdlMoneda.SelectedValue = "-1", "", $" <b>Moneda:</b> {DdlMoneda.SelectedItem.Text}")
|
||||
Dim SoloConMov = If(DdlMovs.SelectedValue = "-1", "", $" <b>Solo Movimientos:</b> {DdlMovs.SelectedItem.Text}")
|
||||
|
||||
@@ -78,7 +78,6 @@
|
||||
<!-- BEGIN LOGO -->
|
||||
<div class="page-logo">
|
||||
<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">
|
||||
<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>
|
||||
@@ -368,13 +367,16 @@
|
||||
<div class='page-content <%=If(EsPopup, "mpoup", "") %>' style=''>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-9">
|
||||
<div class="col-sm-7">
|
||||
<h3 class="page-title" runat="server" id="headertitleh3">
|
||||
<asp:ContentPlaceHolder ID="E" runat="server">
|
||||
</asp:ContentPlaceHolder>
|
||||
</h3>
|
||||
</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>
|
||||
<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>
|
||||
|
||||
@@ -63,9 +63,7 @@ Partial Class Site
|
||||
If Not Page.IsPostBack Then
|
||||
lblFecha.Text = DateTime.Now.ToString("dd.MMMyyyy HH:mm tt")
|
||||
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 UsuarioActual IsNot Nothing Then
|
||||
HdnCveE.Value = UsuarioActual.CveEmpresa.ToString
|
||||
@@ -73,6 +71,7 @@ Partial Class Site
|
||||
LitTit.Text = UsuarioActual.Empresa.EmpresaEncabezado
|
||||
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)
|
||||
TxtTit.Visible = True
|
||||
End If
|
||||
|
||||
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:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
|
||||
<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>
|
||||
</asp:TemplateField>
|
||||
<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();
|
||||
}
|
||||
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)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
@@ -132,7 +151,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
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);
|
||||
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||
@@ -170,10 +189,19 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
|
||||
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 retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse);
|
||||
if (EsRefacturacion)
|
||||
{
|
||||
retorno = factura.CancelarPorRefacturacion();
|
||||
}
|
||||
else
|
||||
{
|
||||
retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse);
|
||||
}
|
||||
|
||||
return retorno;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user