Cancelacion de RNC de bonificacion automaticamente, descarga de PDF de stimulsoft
This commit is contained in:
@@ -1079,7 +1079,9 @@ Partial Class PopUpVerFactura
|
|||||||
Dim AplicaPagare As String = If(UrlParametros("PAG") IsNot Nothing AndAlso UrlParametros("PAG").ToString <> "", UrlParametros("PAG").ToString, "0")
|
Dim AplicaPagare As String = If(UrlParametros("PAG") IsNot Nothing AndAlso UrlParametros("PAG").ToString <> "", UrlParametros("PAG").ToString, "0")
|
||||||
Dim Guardar As Boolean = UrlParametros("GUARDAR") IsNot Nothing AndAlso UrlParametros("GUARDAR").ToString() = "1"
|
Dim Guardar As Boolean = UrlParametros("GUARDAR") IsNot Nothing AndAlso UrlParametros("GUARDAR").ToString() = "1"
|
||||||
Dim RegenerarPDF As Boolean = UrlParametros("REGENERAR") IsNot Nothing AndAlso UrlParametros("REGENERAR").ToString() = "1"
|
Dim RegenerarPDF As Boolean = UrlParametros("REGENERAR") IsNot Nothing AndAlso UrlParametros("REGENERAR").ToString() = "1"
|
||||||
imprimirFacturaVenta(UrlParametros("CVEVENTA").ToString.ToEntero, AplicaPagare, GuardarPDF:=Guardar, RegenerarPDF:=RegenerarPDF)
|
Dim STIMULSOFT As Boolean = UrlParametros("STIMULSOFT") IsNot Nothing AndAlso UrlParametros("STIMULSOFT").ToString() = "1"
|
||||||
|
|
||||||
|
imprimirFacturaVenta(UrlParametros("CVEVENTA").ToString.ToEntero, AplicaPagare, GuardarPDF:=Guardar, RegenerarPDF:=RegenerarPDF, UsarStimulsoft:=STIMULSOFT)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -2694,7 +2696,7 @@ Partial Class PopUpVerFactura
|
|||||||
Archivo = Nothing
|
Archivo = Nothing
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Public Sub imprimirFacturaVenta(CveVenta As Integer, AplicaPagare As String, Optional GuardarPDF As Boolean = False, Optional RegenerarPDF As Boolean = False)
|
Public Sub imprimirFacturaVenta(CveVenta As Integer, AplicaPagare As String, Optional GuardarPDF As Boolean = False, Optional RegenerarPDF As Boolean = False, Optional UsarStimulsoft As Boolean = False)
|
||||||
Dim ObjVentas As New ClsVentas
|
Dim ObjVentas As New ClsVentas
|
||||||
Dim Vta As Modelos.Factura = Nothing
|
Dim Vta As Modelos.Factura = Nothing
|
||||||
|
|
||||||
@@ -2723,7 +2725,7 @@ Partial Class PopUpVerFactura
|
|||||||
Dim Archivo As New System.IO.FileInfo(PathArchivo)
|
Dim Archivo As New System.IO.FileInfo(PathArchivo)
|
||||||
|
|
||||||
'SI EL ARCHIVO NO EXISTE O SE VA REGENERA EL PDF, SE DEBEN LLENAR LOS DATOS
|
'SI EL ARCHIVO NO EXISTE O SE VA REGENERA EL PDF, SE DEBEN LLENAR LOS DATOS
|
||||||
If Not Archivo.Exists OrElse RegenerarPDF Then
|
If Not Archivo.Exists OrElse RegenerarPDF OrElse UsarStimulsoft Then
|
||||||
Vta.MonedaAbreviatura = dtVentas(0)("Abreviatura").ToString
|
Vta.MonedaAbreviatura = dtVentas(0)("Abreviatura").ToString
|
||||||
'se rellena la sucursal
|
'se rellena la sucursal
|
||||||
'Vta.Subproyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SucursalModel)
|
'Vta.Subproyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SucursalModel)
|
||||||
@@ -3028,7 +3030,7 @@ Partial Class PopUpVerFactura
|
|||||||
Dim CveTimbreCartaPorteVenta As Integer = -1
|
Dim CveTimbreCartaPorteVenta As Integer = -1
|
||||||
Dim CartaPorte As Modelos.MSubReportData = Nothing
|
Dim CartaPorte As Modelos.MSubReportData = Nothing
|
||||||
'SI EL ARCHIVO NO EXISTE O SE VA REGENERA EL PDF, SE DEBEN LLENAR LOS DATOS
|
'SI EL ARCHIVO NO EXISTE O SE VA REGENERA EL PDF, SE DEBEN LLENAR LOS DATOS
|
||||||
If Not Archivo.Exists OrElse RegenerarPDF Then
|
If Not Archivo.Exists OrElse RegenerarPDF OrElse UsarStimulsoft Then
|
||||||
If UsuarioActual.CveEmpresa = 13 AndAlso Vta.TipoDocto = "Ing" Then
|
If UsuarioActual.CveEmpresa = 13 AndAlso Vta.TipoDocto = "Ing" Then
|
||||||
Using ObjGral As New ClsGenerales
|
Using ObjGral As New ClsGenerales
|
||||||
If ObjGral.GetGralTimbre(-1, "Ing", MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa, -1, CveVenta:=CveVenta) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then
|
If ObjGral.GetGralTimbre(-1, "Ing", MinFecha, MaxFecha, 0, UsuarioActual.CveEmpresa, -1, CveVenta:=CveVenta) AndAlso ObjGral.DtResultados.Rows.Count > 0 Then
|
||||||
@@ -3046,37 +3048,42 @@ Partial Class PopUpVerFactura
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Archivo.Exists Then
|
If UsarStimulsoft Then
|
||||||
If RegenerarPDF Then
|
ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=True, SubReportData:=CartaPorte, UsarStimulsoft:=UsarStimulsoft), Vta.SerieFolio, "PDF")
|
||||||
Archivo.Delete()
|
Else
|
||||||
|
If Archivo.Exists Then
|
||||||
|
If RegenerarPDF Then
|
||||||
|
Archivo.Delete()
|
||||||
|
If UsuarioActual.Empresa.CvePlataforma = 2 Then
|
||||||
|
GeneraPDFVtaPyMe(Vta, "PDF")
|
||||||
|
Else
|
||||||
|
ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=True, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF")
|
||||||
|
Vta = Nothing
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
HttpContext.Current.Response.Clear()
|
||||||
|
HttpContext.Current.Response.ClearContent()
|
||||||
|
HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = ".txt", "text/plain", "application/pdf")
|
||||||
|
HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & Archivo.Name)
|
||||||
|
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||||
|
HttpContext.Current.Response.TransmitFile(PathArchivo)
|
||||||
|
'HttpContext.Current.Response.Flush()
|
||||||
|
HttpContext.Current.Response.End()
|
||||||
|
Archivo = Nothing
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
|
||||||
|
'04/05/2018 - Se agrega seccion pruebas para generar factura venta .mrt para PyME
|
||||||
If UsuarioActual.Empresa.CvePlataforma = 2 Then
|
If UsuarioActual.Empresa.CvePlataforma = 2 Then
|
||||||
GeneraPDFVtaPyMe(Vta, "PDF")
|
GeneraPDFVtaPyMe(Vta, "PDF")
|
||||||
Else
|
Else
|
||||||
ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=True, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF")
|
ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=Guardar, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF")
|
||||||
Vta = Nothing
|
Vta = Nothing
|
||||||
End If
|
End If
|
||||||
Else
|
|
||||||
HttpContext.Current.Response.Clear()
|
|
||||||
HttpContext.Current.Response.ClearContent()
|
|
||||||
HttpContext.Current.Response.ContentType = If(IO.Path.GetExtension(Archivo.Name) = ".txt", "text/plain", "application/pdf")
|
|
||||||
HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & Archivo.Name)
|
|
||||||
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
|
||||||
HttpContext.Current.Response.TransmitFile(PathArchivo)
|
|
||||||
'HttpContext.Current.Response.Flush()
|
|
||||||
HttpContext.Current.Response.End()
|
|
||||||
Archivo = Nothing
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
|
|
||||||
'04/05/2018 - Se agrega seccion pruebas para generar factura venta .mrt para PyME
|
|
||||||
If UsuarioActual.Empresa.CvePlataforma = 2 Then
|
|
||||||
GeneraPDFVtaPyMe(Vta, "PDF")
|
|
||||||
Else
|
|
||||||
ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=Guardar, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF")
|
|
||||||
Vta = Nothing
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
@@ -200,6 +200,12 @@
|
|||||||
<li>
|
<li>
|
||||||
<asp:HyperLink ID="HplDownPDF" Target="_blank" runat="server" Visible="false"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Imprimir PDF</asp:HyperLink>
|
<asp:HyperLink ID="HplDownPDF" Target="_blank" runat="server" Visible="false"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Imprimir PDF</asp:HyperLink>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<asp:HyperLink ID="HplRenerarPDF" Target="_blank" runat="server" Visible="false"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Regenerar PDF</asp:HyperLink>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<asp:HyperLink ID="HplImprimirPDFStimulsoft" Target="_blank" runat="server" Visible="false"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Imprimir PDF Stimulsoft</asp:HyperLink>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<asp:HyperLink ID="ImgDownCancelacion" Target="_blank" ToolTip="Descarga Acuse Cancelación" Visible="false" runat="server"><i class="fa fa-ad-pdf"></i> Imprimir Acuse Cancelación</asp:HyperLink>
|
<asp:HyperLink ID="ImgDownCancelacion" Target="_blank" ToolTip="Descarga Acuse Cancelación" Visible="false" runat="server"><i class="fa fa-ad-pdf"></i> Imprimir Acuse Cancelación</asp:HyperLink>
|
||||||
</li>
|
</li>
|
||||||
@@ -282,8 +288,8 @@
|
|||||||
<asp:LinkButton ID="LkbRetiro" runat="server" OnClick="LkbRetiro_Click" Visible="false"> <i class="fa fa-ad-excel"></i> Retiro de Efectivo</asp:LinkButton>
|
<asp:LinkButton ID="LkbRetiro" runat="server" OnClick="LkbRetiro_Click" Visible="false"> <i class="fa fa-ad-excel"></i> Retiro de Efectivo</asp:LinkButton>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="LnkUUIDRelacionados" runat="server" CausesValidation="False" Text="<i class='fa fa-pencil'></i> UUID Relacionados" OnClick="LnkUUIDRelacionados_Click" Visible="false" />
|
<asp:LinkButton ID="LnkUUIDRelacionados" runat="server" CausesValidation="False" Text="<i class='fa fa-pencil'></i> UUID Relacionados" OnClick="LnkUUIDRelacionados_Click" Visible="false" />
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<asp:LinkButton ID="LBCancelarPedido" runat="server" CausesValidation="False" CommandName="Delete" Text="<i class='fa fa-ban'></i> Cancelar Pedido" OnClick="LBCancelarPedido_Click" data-toggle="confirmation" data-popout="true" data-original-title="¿Estás seguro que deseas cancelar el Pedido?" data-btn-ok-label="si" Visible="false" />
|
<asp:LinkButton ID="LBCancelarPedido" runat="server" CausesValidation="False" CommandName="Delete" Text="<i class='fa fa-ban'></i> Cancelar Pedido" OnClick="LBCancelarPedido_Click" data-toggle="confirmation" data-popout="true" data-original-title="¿Estás seguro que deseas cancelar el Pedido?" data-btn-ok-label="si" Visible="false" />
|
||||||
@@ -7788,17 +7794,20 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
<div class="row" style="margin-left: 0px; text-align: right" align="left">
|
||||||
|
<div style="margin-right: 15px">
|
||||||
|
<input type="text" id="TxtBusquedaNCCargos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaNCCargos','{0}')", GvDescNCCargos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||||
|
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaNCCargos','{0}')", GvDescNCCargos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tools">
|
<div class="tools">
|
||||||
<a href="javascript:;" class="collapse"></a>
|
<%-- <a href="javascript:;" class="collapse"></a>--%>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="portlet-body form-horizontal form-row-sepe formnombottom">
|
<div class="portlet-body form-horizontal form-row-sepe formnombottom">
|
||||||
<div class="row" style="margin-right: 10px;" align="right">
|
|
||||||
<input type="text" id="TxtBusquedaNCCargos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaNCCargos','{0}')", GvDescNCCargos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
|
||||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaNCCargos','{0}')", GvDescNCCargos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12" style="max-height: 440px; overflow: auto">
|
<div class="col-md-12" style="max-height: 440px; overflow: auto">
|
||||||
<asp:GridView ID="GvDescNCCargos" runat="server" AutoGenerateColumns="False"
|
<asp:GridView ID="GvDescNCCargos" runat="server" AutoGenerateColumns="False"
|
||||||
@@ -9439,19 +9448,19 @@
|
|||||||
|
|
||||||
$('#<%= TxtTotal.ClientID %>').prop('readonly', DisabledTxtTotal);
|
$('#<%= TxtTotal.ClientID %>').prop('readonly', DisabledTxtTotal);
|
||||||
|
|
||||||
$('#C_Tab_TabComplementos_TxtFechaLlegadaCP').datetimepicker({
|
$('#C_Tab_TabComplementos_TxtFechaLlegadaCP').datetimepicker({
|
||||||
dayOfWeekStart: 1,
|
dayOfWeekStart: 1,
|
||||||
lang: 'es',
|
lang: 'es',
|
||||||
format: 'd/m/Y H:i',
|
format: 'd/m/Y H:i',
|
||||||
formatDate: 'd/m/Y H:i',
|
formatDate: 'd/m/Y H:i',
|
||||||
step: 30
|
step: 30
|
||||||
});
|
});
|
||||||
$('#C_Tab_TabComplementos_TxtFechaEntregaCP').datetimepicker({
|
$('#C_Tab_TabComplementos_TxtFechaEntregaCP').datetimepicker({
|
||||||
dayOfWeekStart: 1,
|
dayOfWeekStart: 1,
|
||||||
lang: 'es',
|
lang: 'es',
|
||||||
format: 'd/m/Y H:i',
|
format: 'd/m/Y H:i',
|
||||||
formatDate: 'd/m/Y H:i',
|
formatDate: 'd/m/Y H:i',
|
||||||
step: 30
|
step: 30
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8905,6 +8905,13 @@ Partial Class Ventas
|
|||||||
If (Archivo.Exists Or Archivo2.Exists) And IfNull(CveVenta, 0).ToString().ToEntero() > 0 Then
|
If (Archivo.Exists Or Archivo2.Exists) And IfNull(CveVenta, 0).ToString().ToEntero() > 0 Then
|
||||||
HplDownPDF.Visible = True
|
HplDownPDF.Visible = True
|
||||||
HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))
|
HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))
|
||||||
|
If UsuarioActual.CveRol = 1 Then
|
||||||
|
HplRenerarPDF.Visible = True
|
||||||
|
HplRenerarPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR=1", CveVenta)))
|
||||||
|
|
||||||
|
HplImprimirPDFStimulsoft.Visible = True
|
||||||
|
HplImprimirPDFStimulsoft.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=0&STIMULSOFT=1", CveVenta)))
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'NO DEBE IMPRIMIR PDF DE COTIZACION
|
'NO DEBE IMPRIMIR PDF DE COTIZACION
|
||||||
@@ -19242,22 +19249,28 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso ListaDescuentos IsNot Nothing AndAlso ListaDescuentos.Count > 0 Then
|
If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso ListaDescuentos IsNot Nothing AndAlso ListaDescuentos.Count > 0 Then
|
||||||
TxtObsFact.Text = ""
|
|
||||||
Dim Titulo As String = ListaDescuentos.FirstOrDefault().NombrePromo
|
Dim Titulo As String = ListaDescuentos.FirstOrDefault().NombrePromo
|
||||||
Dim strPromos As New StringBuilder
|
Dim strPromos As New StringBuilder
|
||||||
If Not String.IsNullOrEmpty(Titulo) Then
|
If Not String.IsNullOrEmpty(Titulo) Then
|
||||||
|
|
||||||
For Each Promo As Descuentos In ListaDescuentos
|
For Each Promo As Descuentos In ListaDescuentos
|
||||||
strPromos.AppendFormat("{0}, ", Promo.ObsDescuento)
|
If Not String.IsNullOrEmpty(Promo.ObsDescuento) Then
|
||||||
|
strPromos.AppendFormat("{0}, ", Promo.ObsDescuento)
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
If strPromos.Length > 2 Then
|
If strPromos.Length > 2 Then
|
||||||
strPromos.Remove(strPromos.Length - 2, 2)
|
strPromos.Remove(strPromos.Length - 2, 2)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If strPromos.Length > 0 Then
|
||||||
|
TxtObsFact.Text = ""
|
||||||
|
TxtObsFact.Text = String.Format("{0} {1}", Titulo, strPromos.ToString())
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
TxtObsFact.Text = String.Format("{0} {1}", Titulo, strPromos.ToString())
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
UPObservaciones.Update()
|
UPObservaciones.Update()
|
||||||
@@ -23793,7 +23806,36 @@ Partial Class Ventas
|
|||||||
', "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta
|
', "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta
|
||||||
End If
|
End If
|
||||||
ObjVentas.Dispose()
|
ObjVentas.Dispose()
|
||||||
|
ElseIf DdlTipoComprobante.SelectedValue.Contiene("RNC") Then
|
||||||
|
LblCancelarDocumento.Text = "¿Desea cancelar la remisión de nota de crédito?<br/>"
|
||||||
|
Dim sbExtra As New StringBuilder
|
||||||
|
|
||||||
|
Using ObjAcum As New ClsAcumuladores
|
||||||
|
If ObjAcum.DistribuidorMovtosGet(Me.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=Me.CveVenta, CveConcepto:=1) Then
|
||||||
|
Dim DtBon As DataTable = ObjAcum.DtResultados.FiltraParametros("CveVentaBonificacion > 0", DistinctColumns:={"SerieFolioBonificacion", "CveVentaBonificacion"})
|
||||||
|
If DtBon IsNot Nothing AndAlso DtBon.Rows.Count > 0 Then
|
||||||
|
sbExtra.Append("<b>*Se cancelaran las siguientes remisiones de nota de crédito de bonificación.</b><br/>")
|
||||||
|
For Each RowBon As DataRow In DtBon.Rows
|
||||||
|
sbExtra.AppendFormat("  <b><a class='Texto' target='_blank' href=""/Ventas/Ventas.aspx?CveVenta={0}"">{1}</a></b><br/>", RowBon("CveVentaBonificacion"), RowBon("SerieFolioBonificacion"))
|
||||||
|
Next
|
||||||
|
DtBon.Dispose()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
|
||||||
|
LbCancelarDescripcion.Text = sbExtra.ToString()
|
||||||
|
DivRelacionadasCancelacion.Visible = False
|
||||||
|
BtnCancelarDocumento.Visible = True
|
||||||
|
DivMotivoCancelacion.Visible = False
|
||||||
|
DivMotivoCancelacionTxt.Visible = False
|
||||||
|
DivCanRem.Visible = False
|
||||||
|
DivDevAlm.Visible = False
|
||||||
|
|
||||||
|
UpCancelarDocumento.Update()
|
||||||
|
|
||||||
|
RegistraScript("$('#ModalCancelarDocumento').modal();")
|
||||||
Else
|
Else
|
||||||
|
|
||||||
CancelarDocumento()
|
CancelarDocumento()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -23963,7 +24005,7 @@ Partial Class Ventas
|
|||||||
Dim ObjFacturaCancelacion As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=True)
|
Dim ObjFacturaCancelacion As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=True)
|
||||||
Try
|
Try
|
||||||
Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing
|
Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing
|
||||||
|
Dim strMensaje As New StringBuilder()
|
||||||
If ObjFacturaCancelacion IsNot Nothing AndAlso ObjFacturaCancelacion.CveVenta > 0 Then
|
If ObjFacturaCancelacion IsNot Nothing AndAlso ObjFacturaCancelacion.CveVenta > 0 Then
|
||||||
Dim SWatch As New Stopwatch
|
Dim SWatch As New Stopwatch
|
||||||
SWatch.Start()
|
SWatch.Start()
|
||||||
@@ -23976,6 +24018,7 @@ Partial Class Ventas
|
|||||||
'ObjE.Dispose()
|
'ObjE.Dispose()
|
||||||
|
|
||||||
resp = ObjFacturaCancelacion.CancelarPorRefacturacion(DdlMotivoRefacturacion.SelectedValue.ToEntero(), TxtMotivoRefac.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion)
|
resp = ObjFacturaCancelacion.CancelarPorRefacturacion(DdlMotivoRefacturacion.SelectedValue.ToEntero(), TxtMotivoRefac.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion)
|
||||||
|
strMensaje.Append(resp.Mensaje)
|
||||||
Else
|
Else
|
||||||
Dim ListaRemisionesCancelar As New List(Of Integer)
|
Dim ListaRemisionesCancelar As New List(Of Integer)
|
||||||
If ChkCanRem.Checked Then
|
If ChkCanRem.Checked Then
|
||||||
@@ -23993,6 +24036,41 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion)
|
resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion)
|
||||||
|
strMensaje.Append(resp.Mensaje)
|
||||||
|
Dim DtBonificaciones As DataTable = Nothing
|
||||||
|
|
||||||
|
'SI ES RNC DE CARGO DEBE CANCELAR LAS BON
|
||||||
|
If Not resp.HuboError AndAlso ObjFacturaCancelacion.TipoDocto.Contiene("RNC") AndAlso ObjFacturaCancelacion.Num1 = 1 Then
|
||||||
|
Using ObjAcum As New ClsAcumuladores
|
||||||
|
If ObjAcum.DistribuidorMovtosGet(ObjFacturaCancelacion.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=ObjFacturaCancelacion.CveVenta, CveConcepto:=1) Then
|
||||||
|
DtBonificaciones = ObjAcum.DtResultados.FiltraParametros("CveVentaBonificacion > 0", DistinctColumns:={"CveVentaBonificacion"})
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
|
||||||
|
|
||||||
|
If DtBonificaciones IsNot Nothing AndAlso DtBonificaciones.Rows.Count > 0 Then
|
||||||
|
For Each RowBon As DataRow In DtBonificaciones.Rows
|
||||||
|
Try
|
||||||
|
'VERIFICA SI TIENE RNC DE BONIFICACION
|
||||||
|
Dim Bon = New Modelos.Factura(UsuarioActual, RowBon("CveVentaBonificacion").ToString().ToEntero(), UsuarioActual.CveEmpresa, VerificaAlmacen:=False)
|
||||||
|
Dim respBon = Bon.CancelarFactura(False, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion)
|
||||||
|
If respBon.HuboError Then
|
||||||
|
strMensaje.AppendFormat("<br/>Ocurrió un error al cancelar la remisión de NC de bonificación <b> {0} </b>.", Bon.SerieFolio)
|
||||||
|
Else
|
||||||
|
strMensaje.AppendFormat("<br/> La remisión de nota de credito de bonificación <b> {0}</b> fue cancelada correctamente.", Bon.SerieFolio)
|
||||||
|
End If
|
||||||
|
strMensaje.AppendFormat("<br/> {0}", resp.Mensaje)
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al cancelar la bonificación", ex)
|
||||||
|
strMensaje.Append("<br/> Ocurrió un error al cancelar la bonificación")
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Next
|
||||||
|
DtBonificaciones.Dispose()
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
SWatch.Stop()
|
SWatch.Stop()
|
||||||
@@ -24005,10 +24083,10 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If resp.HuboError Then
|
If resp.HuboError Then
|
||||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
Alert(strMensaje.ToString(), resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
||||||
Else
|
Else
|
||||||
If resp.CveEstatus = 5 AndAlso Not EsRefacturacion Then
|
If resp.CveEstatus = 5 AndAlso Not EsRefacturacion Then
|
||||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:=$"BtnEnviarMailCancelacion({CveVenta});", TextoConfirmacion:=" Si ", TextoCancelacion:=" <a onclick='Recargar()'>No</> ")
|
Alert(strMensaje.ToString(), resp.TipoMensaje, JSBtnAceptar:=$"BtnEnviarMailCancelacion({CveVenta});", TextoConfirmacion:=" Si ", TextoCancelacion:=" <a onclick='Recargar()'>No</> ")
|
||||||
Else
|
Else
|
||||||
If EsRefacturacion Then
|
If EsRefacturacion Then
|
||||||
If resp.CveEstatus = 20 Then
|
If resp.CveEstatus = 20 Then
|
||||||
@@ -24016,10 +24094,10 @@ Partial Class Ventas
|
|||||||
ElseIf resp.CveEstatus.Contiene(4, 5, 23) Then
|
ElseIf resp.CveEstatus.Contiene(4, 5, 23) Then
|
||||||
LigaRedirigir = $"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1"
|
LigaRedirigir = $"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1"
|
||||||
Else
|
Else
|
||||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
Alert(strMensaje.ToString(), resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
Alert(strMensaje.ToString(), resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -26891,14 +26969,15 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
GvDescNCCargos.DataBind()
|
GvDescNCCargos.DataBind()
|
||||||
|
|
||||||
Dim SaldoMaximoUtilizable As Decimal = 0
|
Dim SaldoMaximoCliente As Decimal = 0
|
||||||
|
Dim SaldoEntregado As Decimal = 0
|
||||||
|
|
||||||
If CargarSoloGarantias Then
|
If CargarSoloGarantias Then
|
||||||
Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True")
|
Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True")
|
||||||
If SaldoMaximo > 0 Then
|
If SaldoMaximo > 0 Then
|
||||||
SaldoMaximoUtilizable = SaldoMaximo
|
SaldoMaximoCliente = SaldoMaximo
|
||||||
Else
|
Else
|
||||||
SaldoMaximoUtilizable = 0
|
SaldoMaximoCliente = 0
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Dim ObjAcum As New ClsAcumuladores
|
Dim ObjAcum As New ClsAcumuladores
|
||||||
@@ -26908,25 +26987,32 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
||||||
If SaldoMaximo > 0 Then
|
If SaldoMaximo > 0 Then
|
||||||
SaldoMaximoUtilizable = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
SaldoMaximoCliente = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
||||||
Else
|
Else
|
||||||
SaldoMaximoUtilizable = 0
|
SaldoMaximoCliente = 0
|
||||||
End If
|
End If
|
||||||
|
Dim RowEntregado As DataRow = ObjAcum.DtResultados.Rows(1)
|
||||||
|
SaldoEntregado = RowEntregado("ValorConImpuestos").ToString().ToDecimal()
|
||||||
Else
|
Else
|
||||||
SaldoMaximoUtilizable = 0
|
SaldoMaximoCliente = 0
|
||||||
End If
|
End If
|
||||||
ObjAcum.Dispose()
|
ObjAcum.Dispose()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim SaldoMaximoUsadosFactura As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
|
Dim SaldoMaximoUsadosFactura As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
|
||||||
|
|
||||||
If SaldoMaximoUtilizable < SaldoMaximoUsadosFactura Then
|
If SaldoMaximoCliente > 0 AndAlso SaldoMaximoCliente < SaldoMaximoUsadosFactura Then
|
||||||
|
SaldoMaximoUsadosFactura = SaldoMaximoCliente
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim SaldoMaximoUtilizable = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado)
|
||||||
|
|
||||||
|
If SaldoMaximoUtilizable > 0 Then
|
||||||
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
|
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
|
||||||
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
|
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
|
||||||
Else
|
Else
|
||||||
HdnSaldoMaximoUsados.Value = SaldoMaximoUsadosFactura.ToString()
|
HdnSaldoMaximoUsados.Value = "0"
|
||||||
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsadosFactura)
|
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", 0)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
@@ -27042,14 +27128,14 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
GvDescNCCargosDetalle.DataBind()
|
GvDescNCCargosDetalle.DataBind()
|
||||||
|
|
||||||
Dim SaldoMaximoUtilizable As Decimal = 0
|
Dim SaldoMaximoCliente As Decimal = 0
|
||||||
|
Dim SaldoEntregado As Decimal = 0
|
||||||
If CargarSoloGarantias Then
|
If CargarSoloGarantias Then
|
||||||
Dim SaldoMaximo As Decimal = TmpDTRNCDetalle.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True")
|
Dim SaldoMaximo As Decimal = TmpDTRNCDetalle.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True")
|
||||||
If SaldoMaximo > 0 Then
|
If SaldoMaximo > 0 Then
|
||||||
SaldoMaximoUtilizable = SaldoMaximo
|
SaldoMaximoCliente = SaldoMaximo
|
||||||
Else
|
Else
|
||||||
SaldoMaximoUtilizable = 0
|
SaldoMaximoCliente = 0
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Dim ObjAcum As New ClsAcumuladores
|
Dim ObjAcum As New ClsAcumuladores
|
||||||
@@ -27059,27 +27145,36 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
||||||
If SaldoMaximo > 0 Then
|
If SaldoMaximo > 0 Then
|
||||||
SaldoMaximoUtilizable = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
SaldoMaximoCliente = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
||||||
Else
|
Else
|
||||||
SaldoMaximoUtilizable = 0
|
SaldoMaximoCliente = 0
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Dim RowEntregado As DataRow = ObjAcum.DtResultados.Rows(1)
|
||||||
|
SaldoEntregado = RowEntregado("ValorConImpuestos").ToString().ToDecimal()
|
||||||
Else
|
Else
|
||||||
SaldoMaximoUtilizable = 0
|
SaldoMaximoCliente = 0
|
||||||
End If
|
End If
|
||||||
ObjAcum.Dispose()
|
ObjAcum.Dispose()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim SaldoMaximoUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
|
Dim SaldoMaximoUsadosFactura As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
|
||||||
|
|
||||||
If SaldoMaximoUtilizable < SaldoMaximoUsados Then
|
If SaldoMaximoCliente > 0 AndAlso SaldoMaximoCliente < SaldoMaximoUsadosFactura Then
|
||||||
|
SaldoMaximoUsadosFactura = SaldoMaximoCliente
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim SaldoMaximoUtilizable = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado)
|
||||||
|
|
||||||
|
If SaldoMaximoUtilizable > 0 Then
|
||||||
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
|
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
|
||||||
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
|
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
|
||||||
Else
|
Else
|
||||||
HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
|
HdnSaldoMaximoUsados.Value = "0"
|
||||||
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsados)
|
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", 0)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
UpDescNC.Update()
|
UpDescNC.Update()
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CargaRNCDetalleBonificacion(Optional CveVentaUsado As Integer = -1)
|
Private Sub CargaRNCDetalleBonificacion(Optional CveVentaUsado As Integer = -1)
|
||||||
@@ -27827,8 +27922,17 @@ Partial Class Ventas
|
|||||||
DtImpuestos = query.QueryToDataTable(False)
|
DtImpuestos = query.QueryToDataTable(False)
|
||||||
DtImpuestosBonificacion = queryBonificacion.QueryToDataTable(False)
|
DtImpuestosBonificacion = queryBonificacion.QueryToDataTable(False)
|
||||||
|
|
||||||
|
Dim TieneMultiplesSubProyectos As Boolean = False
|
||||||
|
'VERIFICA SI EN LA FACTURA ACTUAL TUVO MULTIPLES SUBPROYECTOS, PARA CUADRAR AL FINAL EL IMPORTE ACUMULADO
|
||||||
|
If Not AplicaNCMasiva AndAlso AplicoNCFacturaActual Then
|
||||||
|
TieneMultiplesSubProyectos = TmpDT.FiltraParametros("", "", {"CveSubProyecto"}).COUNT("CveSubProyecto", "CveSubProyecto > 0") > 1
|
||||||
|
If TieneMultiplesSubProyectos Then
|
||||||
|
AcumuladoNC = TxtNCImporte.Text.Trim.ToDecimal
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
'ASUSTO LA DIFERENCIA EN EL ÚLTIMO CONCEPTO
|
'ASUSTO LA DIFERENCIA EN EL ÚLTIMO CONCEPTO
|
||||||
If TipoDoctoNC = "Egs" AndAlso (Not AplicaNuevoDocumento) AndAlso AplicaNCMasiva AndAlso (Not NCDescuento) AndAlso AcumuladoNC > 0 Then
|
If TipoDoctoNC = "Egs" AndAlso (Not AplicaNuevoDocumento) AndAlso (AplicaNCMasiva OrElse TieneMultiplesSubProyectos) AndAlso (Not NCDescuento) AndAlso AcumuladoNC > 0 Then
|
||||||
'CODIGO PARA AJUSTE DE CENTAVO, SI EL IMPORTE TOTAL NO CUADRA CON LOS TOTALES
|
'CODIGO PARA AJUSTE DE CENTAVO, SI EL IMPORTE TOTAL NO CUADRA CON LOS TOTALES
|
||||||
Dim ImporteNC As Decimal = DtImpuestos.SUMD("ImporteTotal") + DtImpuestos.SUMD("ImporteIVA") + DtImpuestos.SUMD("ImporteIEPS") - DtImpuestos.SUMD("ImporteRetIVA") - DtImpuestos.SUMD("ImporteRetISR")
|
Dim ImporteNC As Decimal = DtImpuestos.SUMD("ImporteTotal") + DtImpuestos.SUMD("ImporteIVA") + DtImpuestos.SUMD("ImporteIEPS") - DtImpuestos.SUMD("ImporteRetIVA") - DtImpuestos.SUMD("ImporteRetISR")
|
||||||
|
|
||||||
@@ -28608,8 +28712,9 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Dim AplicaRedondeo As Boolean = True
|
Dim AplicaRedondeo As Boolean = True
|
||||||
|
Dim TieneMultiplesSubProyectos As Boolean = TmpDT.FiltraParametros("", "", {"CveSubProyecto"}).COUNT("CveSubProyecto", "CveSubProyecto > 0") > 1
|
||||||
|
|
||||||
If AplicaNCMasiva AndAlso Not NCDescuento Then
|
If AplicaNCMasiva AndAlso Not NCDescuento OrElse TieneMultiplesSubProyectos Then
|
||||||
AplicaRedondeo = False
|
AplicaRedondeo = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user