--Cambios RepIVA
This commit is contained in:
@@ -231,6 +231,14 @@
|
||||
<asp:Label runat="server" Text='<%# Eval("ActosImp16", "{0:N2}") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
|
||||
<HeaderTemplate>
|
||||
<asp:Label data-toggle="tooltip" data-placement="top" ToolTip="IVA SubTotal Importación No Tangibles 16%." runat="server">SubTotal <br/> Imp. No Tan.16%</asp:Label>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label runat="server" Text='<%# Eval("ActosImpNotan16", "{0:N2}") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%-- <asp:BoundField HeaderText="SubTotal 8%" DataField="valorActosImp8" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />--%>
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
|
||||
<HeaderTemplate>
|
||||
@@ -318,14 +326,6 @@
|
||||
<asp:Label runat="server" Text='<%# Eval("ValorIvaNoDeducible08", "{0:N2}") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
|
||||
<HeaderTemplate>
|
||||
<asp:Label data-toggle="tooltip" data-placement="top" ToolTip="IVA SubTotal Importación No Tangibles 16%." runat="server">SubTotal <br/> Imp. No Tan.16%</asp:Label>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label runat="server" Text='<%# Eval("ActosImpNotan16", "{0:N2}") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
|
||||
@@ -7,8 +7,16 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using static Extensiones.ModExtensiones;
|
||||
using Microsoft.VisualBasic.CompilerServices;
|
||||
using System.IO;
|
||||
using GemBox.Spreadsheet;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Drawing;
|
||||
|
||||
using static Extensiones.ModExtensiones;
|
||||
using ADSNetLibrary.SIGAPI.Models.Agropecuaria.Embarques;
|
||||
//using DocumentFormat.OpenXml.Spreadsheet;
|
||||
public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
{
|
||||
#region PROPIEDADES
|
||||
@@ -30,9 +38,21 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
}
|
||||
private DataTable DtIVAA
|
||||
{
|
||||
get { return DtIVAAcreditable = (DataTable)ViewState["DtIVAA"]; }
|
||||
get { return DtIVAA = (DataTable)ViewState["DtIVAA"]; }
|
||||
set { ViewState["DtIVAA"] = value; }
|
||||
}
|
||||
private DataTable DtIVA2
|
||||
{
|
||||
get { return DtIVA2 = (DataTable)ViewState["DtIVA2"]; }
|
||||
set { ViewState["DtIVA2"] = value; }
|
||||
}
|
||||
|
||||
private DataTable DtRetIVA
|
||||
{
|
||||
get { return DtRetIVA = (DataTable)ViewState["DtRetIVA"]; }
|
||||
set { ViewState["DtRetIVA"] = value; }
|
||||
}
|
||||
|
||||
private double TCEspecifico
|
||||
{
|
||||
get { return TCEspecifico = (double)ViewState["TCEspecifico"]; }
|
||||
@@ -120,7 +140,8 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
|
||||
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvIVA2.DataSource = ObjCont.DtResultados;
|
||||
DtIVA2 = ObjCont.DtResultados.Copy();
|
||||
GvIVA2.DataSource = DtIVA2;
|
||||
}
|
||||
|
||||
if (UsuarioActual.CveEmpresa == 119)
|
||||
@@ -128,7 +149,8 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
divRetIVA.Visible = true;
|
||||
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 4, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvRetIVA.DataSource = ObjCont.DtResultados;
|
||||
DtRetIVA = ObjCont.DtResultados.Copy();
|
||||
GvRetIVA.DataSource = DtRetIVA;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,19 +214,21 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
|
||||
protected void LnkPdf_Click(object sender, EventArgs e)
|
||||
{
|
||||
ImprimirCrystal("PDF");
|
||||
//ImprimirCrystal("PDF");
|
||||
ImprimirStimulsoft();
|
||||
//ImprimirGembox("PDF");
|
||||
}
|
||||
|
||||
protected void LnkExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
ImprimirGembox();
|
||||
ImprimirGembox("EXCEL");
|
||||
}
|
||||
protected void LnkExcel2_Click(object sender, EventArgs e)
|
||||
{
|
||||
ImprimirCrystal("EXCEL2");
|
||||
}
|
||||
|
||||
private void ImprimirGembox()
|
||||
private void ImprimirGembox(string Formato)
|
||||
{
|
||||
String FechaF;
|
||||
if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $"Fecha Final: {txtFechaF.Text}"; }
|
||||
@@ -215,21 +239,323 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
|
||||
var filtros = $"Filtros: {FechaI} {FechaF} {TipoMov}";
|
||||
|
||||
GvA.ExportToExcelGembox("ReporteIVA", UsuarioActual, "Reporte de IVA", DatosFiltros: filtros);
|
||||
var Gv = TT.ActiveTabIndex == 0 ? GvT : GvA;
|
||||
|
||||
var GvExtra1 = TT.ActiveTabIndex == 0 ? GvIEPSA : GvIVA2;
|
||||
var GvExtra2 = TT.ActiveTabIndex == 0 ? GvIVAA : UsuarioActual.CveEmpresa == 119 ? GvRetIVA : null;
|
||||
|
||||
var NombreHoja = TT.ActiveTabIndex == 0 ? "IVA Trasladado" : "IVA Acreditable";
|
||||
|
||||
var NombreHojaExtra1 = TT.ActiveTabIndex == 0 ? "IEPS por Porcentaje" : "IVA por Porcentaje";
|
||||
var NombreHojaExtra2 = TT.ActiveTabIndex == 0 ? "IVA por Porcentaje" : "Ret IVA";
|
||||
|
||||
ExportarGembox(Formato, Gv, "ReporteIVA", UsuarioActual, "Reporte de IVA", NombreHoja: NombreHoja, DatosFiltros: filtros, GvExtra1: GvExtra1, NombreHojaExtra1: NombreHojaExtra1, GvExtra2: GvExtra2, NombreHojaExtra2: NombreHojaExtra2);
|
||||
}
|
||||
public override void VerifyRenderingInServerForm(Control control)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ExportarGembox(String Formato,GridView GridView, string NombreArchivoXLSx, Usuario Usuario, string Titulo, string NombreHoja = "Hoja1", string DatoTituloExtra = "", string DatosFiltros = "", int AnchoImagen = 100, int AlturaImagen = 100, GridView GvExtra1 = null, string NombreHojaExtra1 = "Hoja2", GridView GvExtra2 = null, string NombreHojaExtra2 = "Hoja3")
|
||||
{
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
HtmlTextWriter writer = new HtmlTextWriter(stringWriter);
|
||||
GridView.RenderControl(writer);
|
||||
HtmlLoadOptions htmlDefault = GemBox.Spreadsheet.LoadOptions.HtmlDefault;
|
||||
MemoryStream memoryStream = new MemoryStream(htmlDefault.Encoding.GetBytes(stringWriter.ToString()));
|
||||
memoryStream.Position = 0L;
|
||||
StreamReader streamReader = new StreamReader(memoryStream);
|
||||
string text = streamReader.ReadToEnd();
|
||||
streamReader.Dispose();
|
||||
memoryStream.Dispose();
|
||||
stringWriter.Dispose();
|
||||
string input = text;
|
||||
input = Regex.Replace(input, "\\<[\\/]*a[^\\>]*\\>", "");
|
||||
MemoryStream stream = new MemoryStream(htmlDefault.Encoding.GetBytes(input));
|
||||
SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet());
|
||||
ExcelFile excelFile = ExcelFile.Load(stream, htmlDefault);
|
||||
checked
|
||||
{
|
||||
if (Usuario != null)
|
||||
{
|
||||
int num = 6;
|
||||
int num2 = 2;
|
||||
ExcelWorksheet excelWorksheet = excelFile.Worksheets[0];
|
||||
excelWorksheet.Rows.InsertEmpty(0, num);
|
||||
foreach (ExcelRow row in excelWorksheet.Rows)
|
||||
{
|
||||
foreach (ExcelCell allocatedCell in row.AllocatedCells)
|
||||
{
|
||||
if (allocatedCell.Value != null)
|
||||
{
|
||||
string s = allocatedCell.Value.ToString().Trim();
|
||||
if (decimal.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
|
||||
{
|
||||
allocatedCell.Value = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CellRange usedCellRange = excelWorksheet.GetUsedCellRange(ignoreCellsWithoutValue: true);
|
||||
if ((object)usedCellRange == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
usedCellRange.Style.Font.Name = "Calibri Light";
|
||||
CellRange subrangeAbsolute = excelWorksheet.Cells.GetSubrangeAbsolute(1, usedCellRange.FirstColumnIndex, 1, usedCellRange.LastColumnIndex);
|
||||
subrangeAbsolute.Merged = true;
|
||||
subrangeAbsolute.Value = Usuario.Empresa.Empresa;
|
||||
subrangeAbsolute.Style.Font.Size = 360;
|
||||
subrangeAbsolute.Style.Font.Name = "Calibri Light";
|
||||
subrangeAbsolute.Style.HorizontalAlignment = HorizontalAlignmentStyle.Center;
|
||||
subrangeAbsolute.Style.VerticalAlignment = VerticalAlignmentStyle.Center;
|
||||
CellRange subrangeAbsolute2 = excelWorksheet.Cells.GetSubrangeAbsolute(3, usedCellRange.FirstColumnIndex, 3, usedCellRange.LastColumnIndex);
|
||||
subrangeAbsolute2.Merged = true;
|
||||
subrangeAbsolute2.Value = Titulo;
|
||||
subrangeAbsolute2.Style.Font.Size = 400;
|
||||
subrangeAbsolute2.Style.Font.Name = "Calibri Light";
|
||||
subrangeAbsolute2.Style.HorizontalAlignment = HorizontalAlignmentStyle.Center;
|
||||
subrangeAbsolute2.Style.VerticalAlignment = VerticalAlignmentStyle.Center;
|
||||
if (DatoTituloExtra.Length > 0)
|
||||
{
|
||||
CellRange subrangeAbsolute3 = excelWorksheet.Cells.GetSubrangeAbsolute(num, usedCellRange.FirstColumnIndex, num, usedCellRange.LastColumnIndex);
|
||||
subrangeAbsolute3.Merged = true;
|
||||
subrangeAbsolute3.Value = DatoTituloExtra;
|
||||
subrangeAbsolute3.Style.Font.Size = 400;
|
||||
subrangeAbsolute3.Style.Font.Name = "Calibri Light";
|
||||
subrangeAbsolute3.Style.HorizontalAlignment = HorizontalAlignmentStyle.Left;
|
||||
subrangeAbsolute3.Style.VerticalAlignment = VerticalAlignmentStyle.Center;
|
||||
}
|
||||
|
||||
if (DatosFiltros.Length > 0)
|
||||
{
|
||||
string[] array = DatosFiltros.Split('|');
|
||||
excelWorksheet.Rows.InsertEmpty(num, array.Count());
|
||||
string[] array2 = array;
|
||||
foreach (string value in array2)
|
||||
{
|
||||
CellRange subrangeAbsolute4 = excelWorksheet.Cells.GetSubrangeAbsolute(num, usedCellRange.FirstColumnIndex, num, usedCellRange.LastColumnIndex);
|
||||
subrangeAbsolute4.Merged = true;
|
||||
subrangeAbsolute4.Value = value;
|
||||
subrangeAbsolute4.Style.Font.Size = 240;
|
||||
subrangeAbsolute4.Style.Font.Name = "Calibri Light";
|
||||
subrangeAbsolute4.Style.HorizontalAlignment = HorizontalAlignmentStyle.Left;
|
||||
subrangeAbsolute4.Style.VerticalAlignment = VerticalAlignmentStyle.Center;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
int firstColumnIndex = usedCellRange.FirstColumnIndex;
|
||||
int lastColumnIndex = usedCellRange.LastColumnIndex;
|
||||
for (int j = firstColumnIndex; j <= lastColumnIndex; j++)
|
||||
{
|
||||
excelWorksheet.Rows[num].Cells[j].Style.Font.Size = 240;
|
||||
excelWorksheet.Rows[num].Cells[j].Style.HorizontalAlignment = HorizontalAlignmentStyle.Center;
|
||||
excelWorksheet.Rows[num].Cells[j].Style.VerticalAlignment = VerticalAlignmentStyle.Center;
|
||||
excelWorksheet.Rows[num].Cells[j].Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255));
|
||||
excelWorksheet.Rows[num].Cells[j].Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255);
|
||||
if (j > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
excelWorksheet.Columns[j].AutoFit(1.0);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectData.SetProjectError(ex);
|
||||
Exception ex2 = ex;
|
||||
ProjectData.ClearProjectError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int num3 = GridView.Rows.Count + num + num2;
|
||||
excelWorksheet.Rows[num3].Cells[1].Value = "Usuario Imprimió";
|
||||
excelWorksheet.Rows[num3 + 1].Cells[1].Value = Usuario.Nombre;
|
||||
excelWorksheet.Rows[num3].Cells[3].Value = "Fecha Impresión";
|
||||
excelWorksheet.Rows[num3 + 1].Cells[3].Value = ClsPaginas.NowADS().ToString("dd/MM/yyyy");
|
||||
FileInfo fileInfo = new FileInfo($"{Usuario.Empresa.Ruta}/Logo.png");
|
||||
if (fileInfo.Exists)
|
||||
{
|
||||
string path = $"{Usuario.Empresa.Ruta}/Logo.png";
|
||||
using StreamReader streamReader2 = new StreamReader(path);
|
||||
MemoryStream memoryStream2 = new MemoryStream();
|
||||
streamReader2.BaseStream.CopyTo(memoryStream2);
|
||||
excelWorksheet.Pictures.Add(memoryStream2, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel);
|
||||
}
|
||||
|
||||
int firstColumnIndex2 = usedCellRange.FirstColumnIndex;
|
||||
int lastColumnIndex2 = usedCellRange.LastColumnIndex;
|
||||
for (int k = firstColumnIndex2; k <= lastColumnIndex2; k++)
|
||||
{
|
||||
if (k > 0)
|
||||
{
|
||||
bool flag = true;
|
||||
excelWorksheet.Columns[k + 1].Style.NumberFormat = "#,##0.00";
|
||||
try
|
||||
{
|
||||
excelWorksheet.Columns[k].AutoFit(1.0);
|
||||
}
|
||||
catch (Exception ex3)
|
||||
{
|
||||
ProjectData.SetProjectError(ex3);
|
||||
Exception ex4 = ex3;
|
||||
ProjectData.ClearProjectError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
excelFile.Worksheets[0].Name = NombreHoja;
|
||||
|
||||
if (GvExtra1 != null)
|
||||
{
|
||||
StringWriter stringWriter1 = new StringWriter();
|
||||
HtmlTextWriter writer1 = new HtmlTextWriter(stringWriter1);
|
||||
GvExtra1.RenderControl(writer1);
|
||||
|
||||
MemoryStream memoryStream1 = new MemoryStream(htmlDefault.Encoding.GetBytes(stringWriter1.ToString()));
|
||||
memoryStream1.Position = 0L;
|
||||
StreamReader streamReader1 = new StreamReader(memoryStream1);
|
||||
string input1 = streamReader1.ReadToEnd();
|
||||
|
||||
streamReader1.Dispose();
|
||||
memoryStream1.Dispose();
|
||||
stringWriter1.Dispose();
|
||||
|
||||
input1 = Regex.Replace(input1, "\\<[\\/]*a[^\\>]*\\>", "");
|
||||
MemoryStream stream1 = new MemoryStream(htmlDefault.Encoding.GetBytes(input1));
|
||||
SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet());
|
||||
|
||||
ExcelFile excelFile2 = ExcelFile.Load(stream1, htmlDefault);
|
||||
|
||||
ExcelWorksheet excelWorksheet2 = excelFile2.Worksheets[0];
|
||||
int num4 = excelWorksheet2.CalculateMaxUsedColumns();
|
||||
int num5 = num4 - 1;
|
||||
for (int l = 0; l <= num5; l++)
|
||||
{
|
||||
excelWorksheet2.Columns[l].AutoFit(1.0, excelWorksheet2.Rows[1], excelWorksheet2.Rows[excelWorksheet2.Rows.Count - 1]);
|
||||
|
||||
excelWorksheet2.Cells[0, l].Style.FillPattern.SetSolid(ColorTranslator.FromHtml("#4b77be"));
|
||||
excelWorksheet2.Cells[0, l].Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255);
|
||||
}
|
||||
|
||||
excelFile.Worksheets.AddCopy(NombreHojaExtra1, excelWorksheet2);
|
||||
}
|
||||
|
||||
if (GvExtra2 != null)
|
||||
{
|
||||
StringWriter stringWriter2 = new StringWriter();
|
||||
HtmlTextWriter writer2 = new HtmlTextWriter(stringWriter2);
|
||||
GvExtra2.RenderControl(writer2);
|
||||
|
||||
MemoryStream memoryStream2 = new MemoryStream(htmlDefault.Encoding.GetBytes(stringWriter2.ToString()));
|
||||
memoryStream2.Position = 0L;
|
||||
StreamReader streamReader2 = new StreamReader(memoryStream2);
|
||||
string input2 = streamReader2.ReadToEnd();
|
||||
|
||||
streamReader2.Dispose();
|
||||
memoryStream2.Dispose();
|
||||
stringWriter2.Dispose();
|
||||
|
||||
input2 = Regex.Replace(input2, "\\<[\\/]*a[^\\>]*\\>", "");
|
||||
MemoryStream stream2 = new MemoryStream(htmlDefault.Encoding.GetBytes(input2));
|
||||
SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet());
|
||||
|
||||
ExcelFile excelFile3 = ExcelFile.Load(stream2, htmlDefault);
|
||||
|
||||
ExcelWorksheet excelWorksheet3 = excelFile3.Worksheets[0];
|
||||
int num4 = excelWorksheet3.CalculateMaxUsedColumns();
|
||||
int num5 = num4 - 1;
|
||||
|
||||
for (int l = 0; l <= num5; l++)
|
||||
{
|
||||
excelWorksheet3.Columns[l].AutoFit(1.0, excelWorksheet3.Rows[1], excelWorksheet3.Rows[excelWorksheet3.Rows.Count - 1]);
|
||||
excelWorksheet3.Cells[0, l].Style.FillPattern.SetSolid(ColorTranslator.FromHtml("#4b77be"));
|
||||
excelWorksheet3.Cells[0, l].Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255);
|
||||
}
|
||||
|
||||
excelFile.Worksheets.AddCopy(NombreHojaExtra2, excelWorksheet3);
|
||||
}
|
||||
|
||||
int num6 = 8;
|
||||
int num7 = 0;
|
||||
int num8 = -1;
|
||||
if (DatosFiltros.Trim().Length > 0)
|
||||
{
|
||||
num8 = 0;
|
||||
}
|
||||
|
||||
int num9 = excelWorksheet.Rows.Count - 4;
|
||||
for (num6 = 8; num6 <= num9; num6++)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (GridView.Rows[num7].CssClass.Trim())
|
||||
{
|
||||
case "Totales":
|
||||
excelWorksheet.Cells.GetSubrangeRelative(num6 + num8, 0, usedCellRange.LastColumnIndex + 1, 1).Style.FillPattern.SetSolid(ColorTranslator.FromHtml("#67809f"));
|
||||
excelWorksheet.Cells.GetSubrangeRelative(num6 + num8, 0, usedCellRange.LastColumnIndex + 1, 1).Style.Font.Weight = 1000;
|
||||
excelWorksheet.Cells.GetSubrangeRelative(num6 + num8, 0, usedCellRange.LastColumnIndex + 1, 1).Style.Font.Color = ColorTranslator.FromHtml("#ddd");
|
||||
break;
|
||||
case "SubTotales2":
|
||||
excelWorksheet.Cells.GetSubrangeRelative(num6 + num8, 0, usedCellRange.LastColumnIndex + 1, 1).Style.FillPattern.SetSolid(ColorTranslator.FromHtml("#c0c0c0"));
|
||||
excelWorksheet.Cells.GetSubrangeRelative(num6 + num8, 0, usedCellRange.LastColumnIndex + 1, 1).Style.Font.Weight = 1000;
|
||||
excelWorksheet.Cells.GetSubrangeRelative(num6 + num8, 0, usedCellRange.LastColumnIndex + 1, 1).Style.Font.Color = ColorTranslator.FromHtml("#000077");
|
||||
break;
|
||||
case "SubTotales":
|
||||
excelWorksheet.Cells.GetSubrangeRelative(num6 + num8, 0, usedCellRange.LastColumnIndex + 1, 1).Style.FillPattern.SetSolid(ColorTranslator.FromHtml("#dddddd"));
|
||||
excelWorksheet.Cells.GetSubrangeRelative(num6 + num8, 0, usedCellRange.LastColumnIndex + 1, 1).Style.Font.Weight = 1000;
|
||||
excelWorksheet.Cells.GetSubrangeRelative(num6 + num8, 0, usedCellRange.LastColumnIndex + 1, 1).Style.Font.Color = ColorTranslator.FromHtml("#67809F");
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex5)
|
||||
{
|
||||
ProjectData.SetProjectError(ex5);
|
||||
Exception ex6 = ex5;
|
||||
ProjectData.ClearProjectError();
|
||||
}
|
||||
|
||||
num7++;
|
||||
}
|
||||
}
|
||||
|
||||
if (Formato == "EXCEL")
|
||||
{
|
||||
excelFile.Save(System.Web.HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var worksheet in excelFile.Worksheets)
|
||||
{
|
||||
var printOptions = worksheet.PrintOptions;
|
||||
printOptions.LeftMargin =
|
||||
printOptions.RightMargin =
|
||||
printOptions.TopMargin =
|
||||
printOptions.BottomMargin = 0;
|
||||
|
||||
printOptions.AutomaticPageBreakScalingFactor = 93;
|
||||
printOptions.Portrait = false;
|
||||
}
|
||||
|
||||
var saveOptions = new PdfSaveOptions();
|
||||
saveOptions.SelectionType = SelectionType.EntireFile;
|
||||
|
||||
excelFile.Save(System.Web.HttpContext.Current.Response, $"{NombreArchivoXLSx}.pdf", saveOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ImprimirStimulsoft()
|
||||
{
|
||||
String FechaF;
|
||||
if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $" <b>Fecha Final:</b> {txtFechaF.Text}"; }
|
||||
if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $"Fecha Final:{txtFechaF.Text}"; }
|
||||
String FechaI;
|
||||
if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $" <b>Fecha Inicial:</b> {txtFechaI.Text}"; }
|
||||
if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $"Fecha Inicial: {txtFechaI.Text} "; }
|
||||
String TipoMov;
|
||||
if (DdlTipoMovto.SelectedItem.Text == "Todos") { TipoMov = ""; } else { TipoMov = $" <b>Tipo Movimiento:</b> {DdlTipoMovto.SelectedItem.Text}"; }
|
||||
if (DdlTipoMovto.SelectedItem.Text == "Todos") { TipoMov = ""; } else { TipoMov = $"Tipo Movimiento: {DdlTipoMovto.SelectedItem.Text} "; }
|
||||
|
||||
if (GvT.Rows.Count > 0 || GvA.Rows.Count > 0)
|
||||
{
|
||||
@@ -247,7 +573,7 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
List<ReportParameter> para = new List<ReportParameter>();
|
||||
para.Add(new ReportParameter("Empresa", UsuarioActual.Empresa.Empresa));
|
||||
para.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre));
|
||||
para.Add(new ReportParameter("Filtros", $"<b>Filtros:</b> {FechaI}{FechaF}{TipoMov}"));
|
||||
para.Add(new ReportParameter("Filtros", $"Filtros: {FechaI}{FechaF}{TipoMov}"));
|
||||
|
||||
if (Imagen.Exists)
|
||||
{
|
||||
@@ -258,8 +584,9 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
para.Add(new ReportParameter("LogoPath", ""));
|
||||
}
|
||||
|
||||
DataTable Dt = DtIVAAcreditable.Copy();
|
||||
string Formato = "RepIVAAcreditable.mrt";
|
||||
DataTable Dt = TT.ActiveTabIndex == 0 ? DtIVATrasladado.Copy() : DtIVAAcreditable.Copy();
|
||||
|
||||
string Formato = TT.ActiveTabIndex == 0 ? "RepIVA.mrt" : "RepIVAAcreditable.mrt";
|
||||
|
||||
|
||||
para.Add(new ReportParameter("Formato", "PDF"));
|
||||
@@ -270,10 +597,13 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
List<ReportDataSource> lrds = new List<ReportDataSource>();
|
||||
|
||||
ReportDataSource rds = new ReportDataSource();
|
||||
rds.Name = "RepIVAAcreditable";
|
||||
rds.Name = TT.ActiveTabIndex == 0 ? "RepIVA" : "RepIVAAcreditable";
|
||||
rds.Value = Dt;
|
||||
lrds.Add(rds);
|
||||
|
||||
//RepIVA
|
||||
if (TT.ActiveTabIndex == 0)
|
||||
{
|
||||
if (DtIEPSA != null)
|
||||
{
|
||||
ReportDataSource rds2 = new ReportDataSource();
|
||||
@@ -289,6 +619,27 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
rds3.Value = DtIVAA;
|
||||
lrds.Add(rds3);
|
||||
}
|
||||
}
|
||||
|
||||
//RepIVAAcreditable
|
||||
if (TT.ActiveTabIndex == 1)
|
||||
{
|
||||
if (DtIVA2 != null)
|
||||
{
|
||||
ReportDataSource rds4 = new ReportDataSource();
|
||||
rds4.Name = "IVAPorcentaje";
|
||||
rds4.Value = DtIVA2;
|
||||
lrds.Add(rds4);
|
||||
}
|
||||
|
||||
if (DtRetIVA != null)
|
||||
{
|
||||
ReportDataSource rds5 = new ReportDataSource();
|
||||
rds5.Name = "RetIVAPorcentaje";
|
||||
rds5.Value = DtRetIVA;
|
||||
lrds.Add(rds5);
|
||||
}
|
||||
}
|
||||
|
||||
string Extension = "pdf";
|
||||
|
||||
@@ -424,7 +775,6 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
|
||||
protected void LnkTxtDIOT_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
StringBuilder SBDIOT = new StringBuilder();
|
||||
int Conciliado = DdlTipoMovto.SelectedValue.ToEntero();
|
||||
|
||||
@@ -568,28 +918,6 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//MemoryStream ms = new MemoryStream();
|
||||
//TextWriter tw = new StreamWriter(ms, System.Text.Encoding.UTF8);
|
||||
|
||||
//tw.Write(SBDIOT.ToString());
|
||||
|
||||
//tw.Flush();
|
||||
|
||||
//byte[] bytes = ms.ToArray();
|
||||
//ms.Close();
|
||||
|
||||
//Response.Clear();
|
||||
//Response.AppendHeader("Content-Length", text.Length.ToString());
|
||||
//Response.ContentType = "text/plain";
|
||||
//Response.AddHeader("content-disposition", $"attachment; filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt");
|
||||
//Response.BinaryWrite(bytes);
|
||||
//Response.End();
|
||||
|
||||
|
||||
}
|
||||
|
||||
static DataTable AcumularYReemplazar(DataTable dt)
|
||||
@@ -704,136 +1032,6 @@ public partial class Contabilidad_RepIVA : ClsPaginas
|
||||
}
|
||||
}
|
||||
|
||||
//public void IImprimirbytesPDF(byte[] bytes, string NombreArchivo = "Reporte", string Formato = "PDF", bool Descarga = false, string Content_Disposition = "attachment", string Extension = "")
|
||||
//{
|
||||
// // limpio ReportViwer
|
||||
// string mimeType = null;
|
||||
// // If Descarga Then
|
||||
// // Try
|
||||
// // bytes = bytes
|
||||
// // File.WriteAllBytes(String.Format("{0}PDF/whatever.gif", UsuarioActual.Empresa.Ruta), img)
|
||||
// // Catch ex As Exception
|
||||
// // If UsuarioActual.CveRol = 1 Then
|
||||
// // Alert(ex.Message, TipoMensaje.MsgAdvertencia)
|
||||
// // Else
|
||||
// // Alert("Ocurrió un error al generar la descarga. Favor de contactar a soporte tecnico cod'IMPDFclspag'", TipoMensaje.MsgAdvertencia)
|
||||
// // End If
|
||||
// // End Try
|
||||
// // End If
|
||||
// try
|
||||
// {
|
||||
// bytes = bytes;
|
||||
// //Response.Buffer = true;
|
||||
// //Response.Clear();
|
||||
// //if (Formato == "PDF")
|
||||
// // Response.ContentType = "application/pdf";
|
||||
// //else
|
||||
// // Response.ContentType = mimeType;
|
||||
// //Response.ClearHeaders();
|
||||
// //string fileExtension = "";
|
||||
// //if (!string.IsNullOrEmpty(Extension))
|
||||
// // fileExtension = Extension;
|
||||
// //else
|
||||
// // fileExtension = Formato == "PDF" ? "pdf" : "xls";
|
||||
// //Response.AddHeader("content-disposition", string.Format("{0}; filename=\"{1}.{2}\"", Content_Disposition, NombreArchivo, fileExtension));
|
||||
// //Response.BinaryWrite(bytes); // create the file
|
||||
// //Response.Flush(); // send it to the client to download
|
||||
// //bytes = null;
|
||||
// //HttpContext.Current.Response.SuppressContent = true;
|
||||
// //HttpContext.Current.ApplicationInstance.CompleteRequest();
|
||||
// Alert("ok");
|
||||
// }
|
||||
// // HttpContext.Current.Response.End()
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// if (UsuarioActual.CveRol == 1) {
|
||||
|
||||
// }
|
||||
// else
|
||||
// Alert("Ocurrió un error al generar la descarga. Favor de contactar a soporte tecnico cod:'IMPDFclspag'", TipoMensaje.MsgAdvertencia);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
//public byte[] IImprimirSubRepPDFCrystal(string RutaReporte, DataTable DataSource, List<CrystalParametro> Parametros, DataTable DataSource1, DataTable DataSource2, string SubRep1, string SubRep2, string NombreArchivo = "Reporte", string Formato = "PDF", ReportDocument MR = null/* TODO Change to default(_) if this is not a reference type */)
|
||||
//{
|
||||
// // limpio ReportViwer
|
||||
// Stopwatch sw = Stopwatch.StartNew();
|
||||
|
||||
// if (MR == null)
|
||||
// MR = new ReportDocument();
|
||||
// ReportDocument SR1 = new ReportDocument();
|
||||
// ReportDocument SR2 = new ReportDocument();
|
||||
// byte[] Bytes = null;
|
||||
// ExportFormatType formatType = ExportFormatType.NoFormat;
|
||||
// try
|
||||
// {
|
||||
// MR.Load(RutaReporte);
|
||||
// SR1 = MR.OpenSubreport(SubRep1);
|
||||
// SR2 = MR.OpenSubreport(SubRep2);
|
||||
// MR.SetDataSource(DataSource);
|
||||
// SR1.SetDataSource(DataSource1);
|
||||
// SR2.SetDataSource(DataSource2);
|
||||
// foreach (CrystalParametro item in Parametros)
|
||||
// MR.SetParameterValue(item.Nombre, item.Valor);
|
||||
// switch (Formato)
|
||||
// {
|
||||
// case "PDF":
|
||||
// {
|
||||
// formatType = ExportFormatType.PortableDocFormat;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// case "EXCEL":
|
||||
// {
|
||||
// formatType = ExportFormatType.Excel;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// System.IO.Stream Stream = MR.ExportToStream(formatType);
|
||||
// BinaryReader BD = new BinaryReader(MR.ExportToStream(formatType));
|
||||
// Bytes = BD.ReadBytes(System.Convert.ToInt32(MR.ExportToStream(formatType).Length));
|
||||
// BD.Dispose();
|
||||
// Stream.Dispose();
|
||||
// }
|
||||
// // Dim Buffer(CInt(Stream.Length)) As Byte
|
||||
// // Bytes = Buffer
|
||||
// // MR.ExportToHttpResponse(formatType, Response, True, NombreArchivo)
|
||||
// catch (CrystalReportsException ex)
|
||||
// {
|
||||
// if(ex.Message != null)
|
||||
// {
|
||||
// Alert(ex.Message);
|
||||
// }
|
||||
// if (ex.InnerException != null)
|
||||
// {
|
||||
// Alert(ex.InnerException.Message);
|
||||
// }
|
||||
|
||||
// }
|
||||
// // HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
|
||||
// // GuardaLog($"Error: {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// //GuardaLog(ex.InnerException != null && ex.Message != null ? $"Error: {ex.InnerException.Message ?? ex.Message} | Descripcion: {ex.InnerException != null && ex.InnerException.InnerException != null && ex.InnerException.InnerException.Message != null ? ex.InnerException.InnerException.Message : ex.InnerException != null && ex.InnerException.Message != null ? ex.InnerException.Message : "Sin descripcion"} Ruta {RutaReporte}" : $"Sin descripción - Ruta {RutaReporte}");
|
||||
// if (ex.Message != null)
|
||||
// {
|
||||
// Alert(ex.Message);
|
||||
// }
|
||||
// if (ex.InnerException != null)
|
||||
// {
|
||||
// Alert(ex.InnerException.Message);
|
||||
// }
|
||||
// }
|
||||
// sw.Stop();
|
||||
// if (sw.Elapsed.TotalSeconds > 10)
|
||||
// // GuardaLog($"Reporte:{RutaReporte} | Tiempo Renderizado Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds} ");
|
||||
// if (MR != null)
|
||||
// MR.Dispose();
|
||||
// return Bytes;
|
||||
//}
|
||||
|
||||
|
||||
protected void GvIEPSA_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow && e.Row.DataKey("PorcentajeIEPS").Trim() == "")
|
||||
|
||||
Reference in New Issue
Block a user