OC Es Temporal, PS Actualziar Utimo Costo
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<asp:HyperLink ID="ImgDownPDF" runat="server" Visible="false" Target="_blank"><i class="fa fa-ad-pdf"></i> Imprimir PDF</asp:HyperLink>
|
||||
<asp:LinkButton ID="LnkGenrarPDF" runat="server" OnClick="LnkGenrarPDF_Click" Visible="false"><i class="fa fa-ad-pdf"></i>Generar PDF PDF</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:HyperLink ID="ImgImprimirAlmacen" Target="_blank" Visible="False" CssClass="Texto" runat="server"><i class="fa fa-truck"></i> Ver Almacen</asp:HyperLink>
|
||||
|
||||
@@ -13,6 +13,7 @@ Imports MoreLinq
|
||||
Imports System.Data.SqlClient
|
||||
Imports ClsPaginas
|
||||
Imports Microsoft.Owin.Security.Provider
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Compras_Compras
|
||||
Inherits ClsPaginas
|
||||
@@ -794,6 +795,35 @@ Partial Class Compras_Compras
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
Private Property ProveedorDireccion As String
|
||||
Get
|
||||
Return IfNull(ViewState("ProveedorDireccion"), "").ToString
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("ProveedorDireccion") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Private Property ProveedorCodigoRegimenFiscal As String
|
||||
Get
|
||||
Return IfNull(ViewState("ProveedorCodigoRegimenFiscal"), "").ToString
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("ProveedorCodigoRegimenFiscal") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property ProveedorCP As String
|
||||
Get
|
||||
Return IfNull(ViewState("ProveedorCP"), "").ToString
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("ProveedorCP") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property CveRegimenFiscalProveedor As Integer
|
||||
Get
|
||||
Return IfNull(ViewState("CveRegimenFiscalProveedor"), -1).ToString.ToEntero
|
||||
@@ -2860,6 +2890,8 @@ Partial Class Compras_Compras
|
||||
If dr("CveFactura").ToString.ToEntero > 0 Then
|
||||
ImgDownXML.Visible = True : ImgDownXML.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=Fact&EXT=xml&CveFactura={0}&RFC={1}", dr("CveFactura"), dr("RFC").ToString.Replace("&", "%26%"))))
|
||||
ImgDownPDF.Visible = True : ImgDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=Fact&EXT=pdf&CveFactura={0}&RFC={1}", dr("CveFactura"), dr("RFC").ToString.Replace("&", "%26%"))))
|
||||
Else
|
||||
LnkGenrarPDF.Visible = True
|
||||
End If
|
||||
|
||||
TxtRembolsoNumero.Enabled = If(IdPoliza > 0, False, True)
|
||||
@@ -3503,6 +3535,10 @@ Partial Class Compras_Compras
|
||||
|
||||
If RecargaCombo Then DdlProveedor.DataSource = ObjProveedor.DtResultados : DdlProveedor.DataBind()
|
||||
|
||||
ProveedorDireccion = ObjProveedor.Direccion
|
||||
ProveedorCP = ObjProveedor.CP.ToString
|
||||
ProveedorCodigoRegimenFiscal = ObjProveedor.DtResultados.Rows(0)("CodigoRegimenFiscal").ToString
|
||||
|
||||
ChkConsignacion.Enabled = True
|
||||
|
||||
'MONEDA PREFERENTE
|
||||
@@ -17412,6 +17448,7 @@ Partial Class Compras_Compras
|
||||
TxtRetIVAModal.Enabled = True
|
||||
TxtRetISRModal.Enabled = True
|
||||
TxtIEPSModal.Enabled = True
|
||||
UpPSS.Update()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -17432,6 +17469,12 @@ Partial Class Compras_Compras
|
||||
divImporteImportacion.Visible = False
|
||||
|
||||
End If
|
||||
|
||||
If TxtRetISR.Text.ToDecimal > 0 And CveCompra <= 0 And CveFactura > 0 Then
|
||||
TxtRetISRModal.Enabled = True
|
||||
UpPSS.Update()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Private Sub LimpiaAgregar()
|
||||
|
||||
@@ -17492,10 +17535,9 @@ Partial Class Compras_Compras
|
||||
End Sub
|
||||
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
|
||||
|
||||
Con = GvRow.DataKey("Consec").ToEntero
|
||||
Index = Con
|
||||
|
||||
@@ -21940,6 +21982,139 @@ Partial Class Compras_Compras
|
||||
|
||||
|
||||
|
||||
Protected Sub LnkGenrarPDF_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim tmpFolio As String = If(TxtSerie.Text.Trim.Length > 0, $"{TxtSerie.Text}-{TxtFolio.Text}", TxtFolio.Text)
|
||||
|
||||
GeneraPDFNew($"{CveCompra.ToString}.pdf", "", TxtSubTotal.Text, TxtDescuento.Text, TxtTotal.Text, TxtIVA.Text, DdlMoneda.SelectedItem.Text, "", "", MinFecha, "", New DataTable, "",
|
||||
"", "", tmpFolio, TipoComprobante, "", UsuarioActual.Empresa.RFC, UsuarioActual.Empresa.Empresa, ProveedorDireccion, "", "", "", ProveedorCP, "", "", ProveedorCodigoRegimenFiscal, "", LblMetodoPago.Text,
|
||||
"", TxtFecha.Text.ToDate, "", "", "", "", "", "", "", HplProveedor.Text, RFCProveedor)
|
||||
End Sub
|
||||
|
||||
Private Sub GeneraPDFNew(NombreArchivo As String, FolioFiscal As String, SubTotal As String, Descuento As String, Total As String, IVA As String,
|
||||
Moneda As String, FormaDePago As String, NoSerieCertificado As String, FechaCertificacion As DateTime, NoSerieCertificadoContribuyente As String, DTConceptos As DataTable,
|
||||
SelloCFDi As String, SelloSAT As String, CBB As String, Folio As String, TipodeComprobante As String, CadenaOriginalCFD As String,
|
||||
RFC As String, Cliente As String, Direccion As String, Colonia As String, NoExt As String, NoInt As String,
|
||||
CP As String, Ciudad As String, Estado As String, Regimen As String, CondicionPago As String, MetodoPago As String,
|
||||
NumCtaPago As String, fecha As System.DateTime, DomFisCalle As String, DomFisNoExt As String, DomFisCol As String, DomFisCP As String, DomFisMun As String,
|
||||
DomFisEst As String, DomFisPais As String, EmiNombre As String, EmiRFC As String)
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
Dim CadenaOriginal As String = (Convert.ToString((Convert.ToString((Convert.ToString("||1.0|") & FolioFiscal) + "|" + FechaCertificacion.ToString("yyyy-MM-dd") + "T" + FechaCertificacion.ToString("HH:mm:ss") + "|") & SelloCFDi) + "|") & NoSerieCertificado) + "||"
|
||||
Dim RutaFormato As String = String.Format("{0}Empresas\Grales\Formatos\CFDI.rdlc", ModExtensiones.DirectorioBaseEmpresas)
|
||||
'Dim ArchivoTempXLS As String = String.Format("{0}\GenSis{1}-{2}", Path.GetDirectoryName(ArchivoBaseXLS), NowADS().Ticks, Path.GetFileName(ArchivoBaseXLS))
|
||||
|
||||
Dim Fiscal As String = String.Format("Domicilio Fiscal {0}{1} {2}{0}Col.{3}{0}CP. {4} {5},{6},{7}", vbCr, DomFisCalle, DomFisNoExt, DomFisCol, DomFisCP,
|
||||
DomFisMun, DomFisEst, DomFisPais)
|
||||
Try
|
||||
Dim parametros As New List(Of ReportParameter)()
|
||||
'params.Add(New ReportParameter("ArchivoBaseXLS", ArchivoBaseXLS))
|
||||
'params.Add(New ReportParameter("TmpArchivoPDF", TmpArchivoPDF))
|
||||
parametros.Add(New ReportParameter("FolioFiscal", FolioFiscal))
|
||||
parametros.Add(New ReportParameter("SubTotal", SubTotal.FormatoNumero()))
|
||||
parametros.Add(New ReportParameter("Descuento", Descuento.FormatoNumero()))
|
||||
parametros.Add(New ReportParameter("Total", Total.FormatoNumero()))
|
||||
parametros.Add(New ReportParameter("IVA", IVA.FormatoNumero()))
|
||||
parametros.Add(New ReportParameter("Moneda", Moneda))
|
||||
parametros.Add(New ReportParameter("FormaDePago", FormaDePago))
|
||||
parametros.Add(New ReportParameter("NoSerieCertificado", NoSerieCertificado))
|
||||
parametros.Add(New ReportParameter("FechaCertificacion", FechaCertificacion.ToString("yyyy-MM-dd") + "T" + FechaCertificacion.ToString("HH:mm:ss")))
|
||||
parametros.Add(New ReportParameter("NoSerieCertificadoContribuyente", NoSerieCertificadoContribuyente))
|
||||
parametros.Add(New ReportParameter("SelloCFDi", SelloCFDi))
|
||||
parametros.Add(New ReportParameter("SelloSAT", SelloSAT))
|
||||
parametros.Add(New ReportParameter("CBB", String.Format("file:///{0}", CBB)))
|
||||
parametros.Add(New ReportParameter("Folio", Folio))
|
||||
parametros.Add(New ReportParameter("TipodeComprobante", TipodeComprobante.ToUpper()))
|
||||
parametros.Add(New ReportParameter("CadenaOriginalCFD", CadenaOriginalCFD))
|
||||
parametros.Add(New ReportParameter("RFC", RFC))
|
||||
parametros.Add(New ReportParameter("Cliente", Cliente))
|
||||
parametros.Add(New ReportParameter("Direccion", Direccion))
|
||||
parametros.Add(New ReportParameter("Colonia", Colonia))
|
||||
parametros.Add(New ReportParameter("NoExt", NoExt))
|
||||
parametros.Add(New ReportParameter("NoInt", NoInt))
|
||||
parametros.Add(New ReportParameter("CP", CP))
|
||||
parametros.Add(New ReportParameter("Ciudad", Ciudad))
|
||||
parametros.Add(New ReportParameter("Estado", Estado))
|
||||
parametros.Add(New ReportParameter("Regimen", Regimen))
|
||||
parametros.Add(New ReportParameter("CondicionPago", CondicionPago))
|
||||
parametros.Add(New ReportParameter("MetodoPago", MetodoPago))
|
||||
parametros.Add(New ReportParameter("NumCtaPago", NumCtaPago))
|
||||
parametros.Add(New ReportParameter("fecha", fecha.ToString("yyyy-MM-dd") + "T" + fecha.ToString("HH:mm:ss")))
|
||||
parametros.Add(New ReportParameter("Fiscal", Fiscal))
|
||||
parametros.Add(New ReportParameter("EmiNombre", EmiNombre))
|
||||
parametros.Add(New ReportParameter("EmiRFC", EmiRFC))
|
||||
parametros.Add(New ReportParameter("NoSerieCertificado", NoSerieCertificado))
|
||||
parametros.Add(New ReportParameter("TotalLetra", Total.ToDecimal.Texto2Letras(CveMoneda:=If(Moneda = "MXN", 1, If(Moneda = "USD", 2, 3)))))
|
||||
parametros.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
|
||||
|
||||
'params.Add(New ReportParameter("DTConceptos", DTConceptos))
|
||||
|
||||
Dim rds As New ReportDataSource()
|
||||
rds.Name = "DsOC"
|
||||
rds.Value = DTConceptos
|
||||
Dim Archivo As New System.IO.FileInfo(RutaFormato)
|
||||
|
||||
If Archivo.Exists Then
|
||||
'Dim MR As New ReportViewer()
|
||||
'MR.LocalReport.DataSources.Add(rds)
|
||||
'MR.LocalReport.ReportPath = RutaFormato
|
||||
'MR.ProcessingMode = ProcessingMode.Local
|
||||
'MR.LocalReport.EnableExternalImages = True
|
||||
'MR.LocalReport.SetParameters(parametros)
|
||||
'MR.LocalReport.Refresh()
|
||||
|
||||
|
||||
'Dim warnings As Warning() = Nothing
|
||||
'Dim streamids As String() = Nothing
|
||||
'Dim mimeType As String = Nothing
|
||||
'Dim encoding As String = Nothing
|
||||
'Dim extension As String = Nothing
|
||||
'Dim bytes As Byte() = Nothing
|
||||
'bytes = MR.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids,
|
||||
'warnings)
|
||||
|
||||
'Using fs As New FileStream(NombreArchivo, FileMode.Create)
|
||||
' fs.Write(bytes, 0, bytes.Length)
|
||||
' fs.Close()
|
||||
'End Using
|
||||
|
||||
Dim MR As New ReportViewer()
|
||||
MR.LocalReport.DataSources.Add(rds)
|
||||
MR.LocalReport.ReportPath = RutaFormato
|
||||
MR.ProcessingMode = ProcessingMode.Local
|
||||
MR.LocalReport.EnableExternalImages = True
|
||||
MR.LocalReport.SetParameters(parametros)
|
||||
MR.LocalReport.Refresh()
|
||||
|
||||
Dim warnings As Warning() = Nothing
|
||||
Dim streamids As String() = Nothing
|
||||
Dim mimeType As String = Nothing
|
||||
Dim encoding As String = Nothing
|
||||
Dim extension As String = Nothing
|
||||
|
||||
Dim bytes As Byte() = MR.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)
|
||||
|
||||
' En lugar de guardarlo en el servidor, se envía directamente al navegador
|
||||
Response.Clear()
|
||||
Response.ContentType = "application/pdf"
|
||||
Response.AddHeader("content-disposition", "attachment; filename=" & NombreArchivo & ".pdf")
|
||||
Response.BinaryWrite(bytes)
|
||||
Response.End()
|
||||
|
||||
Retorno = True
|
||||
Else
|
||||
ModExtensiones.GuardaLog(String.Format("No existe formato Base"))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ModExtensiones.GuardaLog(String.Format("Ocurrio un Error al generar el reporte RLDC"))
|
||||
Retorno = False
|
||||
End Try
|
||||
|
||||
'Return Retorno
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user