This commit is contained in:
Antonio Gonzalez
2020-09-17 15:10:46 -07:00
parent 2d53fdb089
commit 6fde7b5c45
3 changed files with 178 additions and 156 deletions

View File

@@ -41,6 +41,16 @@ public partial class Compras_CatTipoGasto : ClsPaginas
ObjCompras.Dispose();
}
private void RecargarGlobal()
{
ClsCompras ObjCompras = new ClsCompras();
if (ObjCompras.GetTipoGasto(-1, -1))
{
set_GlobalDTTiposGastos(UsuarioActual.CveEmpresa, ObjCompras.DtResultados);
}
ObjCompras.Dispose();
}
protected void BtnAgregarTipoGastoD_Click(object sender, EventArgs e)
{
BtnAgregarTipoGasto.Text = "Agregar";
@@ -74,6 +84,7 @@ public partial class Compras_CatTipoGasto : ClsPaginas
Alert("Se eliminó el Tipo de Gasto correctamente");
}
ObjCompras.Dispose();
RecargarGlobal();
}
protected void BtnAgregarTipoGasto_Click(object sender, EventArgs e)
@@ -82,22 +93,20 @@ public partial class Compras_CatTipoGasto : ClsPaginas
if (BtnAgregarTipoGasto.Text == "Agregar")
{
if (ObjCompras.AddTipoGasto(TxtTipoGasto.Text,ChkEstatus.Checked,DateTime.Now.ToString(),UsuarioActual.CveUsuario,UsuarioActual.CveEmpresa))
{
CargaDatos();
UpDatos.Update();
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD"));
{
Alert("Se agregó el Tipo de Gasto correctamente");
}
}else
{
if (ObjCompras.UpdateTipoGasto(CveTipoGasto,TxtTipoGasto.Text,ChkEstatus.Checked,-1,-1))
{
CargaDatos();
UpDatos.Update();
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD"));
Alert("Se actualizó el Tipo de Gasto correctamente");
}
}
ObjCompras.Dispose();
CargaDatos();
RecargarGlobal();
UpDatos.Update();
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD"));
}
}

View File

@@ -6,28 +6,28 @@
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>1.86091cm</Width>
<Width>2.28424cm</Width>
</TablixColumn>
<TablixColumn>
<Width>1.28292cm</Width>
</TablixColumn>
<TablixColumn>
<Width>1.49458cm</Width>
<Width>1.5475cm</Width>
</TablixColumn>
<TablixColumn>
<Width>7.13431cm</Width>
<Width>5.78365cm</Width>
</TablixColumn>
<TablixColumn>
<Width>1.99729cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.10313cm</Width>
<Width>2.10377cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.1825cm</Width>
<Width>2.10378cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.31479cm</Width>
<Width>3.26728cm</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
@@ -149,11 +149,84 @@
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<ColSpan>3</ColSpan>
</CellContents>
</TablixCell>
<TablixCell />
<TablixCell />
<TablixCell>
<CellContents>
<Textbox Name="Textbox16">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value />
<Style>
<FontFamily>Verdana</FontFamily>
<FontSize>8pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox16</rd:DefaultName>
<Style>
<Border>
<Style>None</Style>
</Border>
<TopBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</TopBorder>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox18">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value />
<Style>
<FontFamily>Verdana</FontFamily>
<FontSize>8pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox18</rd:DefaultName>
<Style>
<Border>
<Style>None</Style>
</Border>
<TopBorder>
<Color>Black</Color>
<Style>Solid</Style>
<Width>1pt</Width>
</TopBorder>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox22">
@@ -605,10 +678,40 @@
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<ColSpan>2</ColSpan>
</CellContents>
</TablixCell>
<TablixCell />
<TablixCell>
<CellContents>
<Textbox Name="Textbox15">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value />
<Style>
<FontFamily>Verdana</FontFamily>
<FontSize>7pt</FontSize>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox15</rd:DefaultName>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox21">
@@ -1221,9 +1324,8 @@
<Source>External</Source>
<Value>=Parameters!pImg.Value</Value>
<Sizing>FitProportional</Sizing>
<Left>0.09633cm</Left>
<Height>1.5cm</Height>
<Width>1.5cm</Width>
<Height>2.07257cm</Height>
<Width>3.56716cm</Width>
<ZIndex>1</ZIndex>
<Style>
<Border>
@@ -1251,9 +1353,8 @@
</Paragraphs>
<rd:DefaultName>Textbox1</rd:DefaultName>
<Top>0.25646cm</Top>
<Left>2.87447cm</Left>
<Height>0.81167cm</Height>
<Width>12.68053cm</Width>
<Width>20.37043cm</Width>
<ZIndex>2</ZIndex>
<Style>
<Border>
@@ -1285,9 +1386,8 @@
</Paragraphs>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Top>1.12429cm</Top>
<Left>2.87447cm</Left>
<Height>0.94828cm</Height>
<Width>12.68053cm</Width>
<Width>20.37043cm</Width>
<ZIndex>3</ZIndex>
<ToolTip>="Moviemtos, Auxiliares del Catalogo" &amp; System.Environment.NewLine &amp; "al " &amp;Parameters!pFechaFin.Value</ToolTip>
<Style>
@@ -1321,9 +1421,9 @@
</Paragraphs>
<rd:DefaultName>Textbox8</rd:DefaultName>
<Top>0.25646cm</Top>
<Left>16.87794cm</Left>
<Left>14.99937cm</Left>
<Height>0.81167cm</Height>
<Width>3.49249cm</Width>
<Width>5.37106cm</Width>
<ZIndex>4</ZIndex>
<Style>
<Border>
@@ -1336,7 +1436,7 @@
</Style>
</Textbox>
</ReportItems>
<Height>2.0944in</Height>
<Height>2.2819in</Height>
<Style />
</Body>
<Width>8.01986in</Width>
@@ -1346,6 +1446,41 @@
<PrintOnFirstPage>true</PrintOnFirstPage>
<PrintOnLastPage>true</PrintOnLastPage>
<ReportItems>
<Textbox Name="Textbox8">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>="Libro Mayor" &amp; System.Environment.NewLine &amp; "al " &amp;Parameters!pFechaFin.Value</Value>
<Style>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Height>0.89958cm</Height>
<Width>20.37043cm</Width>
<Visibility>
<Hidden>= (Globals.PageNumber=1)</Hidden>
</Visibility>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="Textbox12">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
@@ -1367,43 +1502,9 @@
</Paragraphs>
<rd:DefaultName>Textbox8</rd:DefaultName>
<Top>0.02088cm</Top>
<Left>16.87794cm</Left>
<Height>0.57912cm</Height>
<Width>3.49249cm</Width>
<Visibility>
<Hidden>= (Globals.PageNumber=1)</Hidden>
</Visibility>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
</Style>
</Textbox>
<Textbox Name="Textbox8">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>="Libro Mayor" &amp; System.Environment.NewLine &amp; "al " &amp;Parameters!pFechaFin.Value</Value>
<Style>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Left>2.87447cm</Left>
<Height>0.89958cm</Height>
<Width>12.68053cm</Width>
<Left>14.99937cm</Left>
<Height>0.8787cm</Height>
<Width>5.37106cm</Width>
<ZIndex>1</ZIndex>
<Visibility>
<Hidden>= (Globals.PageNumber=1)</Hidden>
@@ -1414,8 +1515,6 @@
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</ReportItems>
@@ -1451,9 +1550,9 @@
</Paragraphs>
<rd:DefaultName>Textbox3</rd:DefaultName>
<Top>0.0703cm</Top>
<Left>14.85419cm</Left>
<Left>14.99937cm</Left>
<Height>0.6cm</Height>
<Width>5.51625cm</Width>
<Width>5.37107cm</Width>
<Style>
<Border>
<Style>None</Style>

View File

@@ -100,93 +100,7 @@ Partial Class Ventas_AuxiliarCliente
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
End Sub
Public Sub ExportToExcelGTest(Gv As GridView, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing)
Dim sw As New StringWriter()
Dim htw As New HtmlTextWriter(sw)
Gv.RenderControl(htw)
GemBox.Spreadsheet.SpreadsheetInfo.SetLicense("ESWN-4QFD-26JF-1SZ8")
Dim excel As GemBox.Spreadsheet.ExcelFile
Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault
Using htmlStream = New MemoryStream(options.Encoding.GetBytes(sw.ToString()))
excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream, options)
If Usuario IsNot Nothing Then
Dim worksheet = excel.Worksheets(0)
Dim num As Integer = worksheet.Rows.Count
If num > 128 Then num = 128
Dim columnCount = worksheet.CalculateMaxUsedColumns()
'If columnCount > 1 Then
' For i As Integer = 1 To columnCount - 1
' worksheet.Columns(i).AutoFit(1, worksheet.Rows(1), worksheet.Rows(num - 1))
' Next
'End If
worksheet.Rows.InsertEmpty(0, 7)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Usuario.CveEmpresa)
If Imagen.Exists Then
worksheet.Pictures.Add(logouri.ToString(), "A1", "B4")
End If
Dim celdasConTexto = worksheet.GetUsedCellRange(True)
celdasConTexto.Style.Font.Name = "Calibri Light"
Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex)
RangoNombreEmpresa.Merged = True
RangoNombreEmpresa.Value = Usuario.Empresa.Empresa
RangoNombreEmpresa.Style.Font.Size = 18 * 20
RangoNombreEmpresa.Style.Font.Name = "Calibri Light"
RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex)
RangoTitulo.Merged = True
RangoTitulo.Value = Titulo
RangoTitulo.Style.Font.Size = 20 * 20
RangoTitulo.Style.Font.Name = "Calibri Light"
RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
Dim FiltroCliente = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex)
FiltroCliente.Merged = True
FiltroCliente.Value = String.Format("Cliente: {0} Fecha Inicio: {1} Fecha Fin: {2} Opción: {3}", DdlClientes.SelectedText, txtFechaI.Text, txtFechaF.Text, DdlOpcion.SelectedItem.Text)
FiltroCliente.Style.Font.Size = 12 * 20
FiltroCliente.Style.Font.Name = "Calibri Light"
FiltroCliente.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Left
FiltroCliente.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
worksheet.Rows(7).Cells(i).Style.Font.Size = 12 * 20
worksheet.Rows(7).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
worksheet.Rows(7).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
worksheet.Rows(7).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
worksheet.Rows(7).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
'If i > 0 Then
' Try
' worksheet.Columns(i).AutoFit(1)
' Catch ex As Exception
' End Try
'End If
Next
Dim IndexEndTable As Integer = Gv.Rows.Count + 9
worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió:"
worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre
worksheet.Rows(IndexEndTable).Cells(4).Value = "Fecha Impresión: "
worksheet.Rows(IndexEndTable + 1).Cells(4).Value = DateTime.Now.ToString()
worksheet.Rows(IndexEndTable).Cells(8).Value = "Impreso en SIG"
End If
End Using
htw.Dispose()
excel.Save(HttpContext.Current.Response, NombreArchivoXLSx)
ExportToExcelGembox(Gv, NombreArchivoXLSx, Usuario, txtFechaI.Text, txtFechaF.Text, Titulo, "", 1)
End Sub
Protected Sub GvAuxCliente_RowDataBound(sender As Object, e As GridViewRowEventArgs)