Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -399,15 +399,43 @@ Public Class ClsGenerales
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(DSet)
|
||||
DSet.Tables(0).TableName = "Indicadores"
|
||||
DSet.Tables(1).TableName = "DetalleDia"
|
||||
DSet.Tables(2).TableName = "DetalleAnualesMes"
|
||||
DSet.Tables(3).TableName = "VentasPorVendedor"
|
||||
DSet.Tables(4).TableName = "VentasPorClasificacion"
|
||||
DSet.Tables(5).TableName = "VentasPorMarca"
|
||||
DSet.Tables(6).TableName = "VentasPorPS"
|
||||
DSet.Tables(7).TableName = "VentasPorCliente"
|
||||
DSet.Tables(8).TableName = "VentasPorProveedor"
|
||||
If DSet.Tables.Count > 0 Then
|
||||
Select Case Opcion
|
||||
Case 1 ' Cuentas por Cobrar
|
||||
DSet.Tables(0).TableName = "Indicadores"
|
||||
If DSet.Tables.Count > 1 Then DSet.Tables(1).TableName = "DetalleDia"
|
||||
If DSet.Tables.Count > 2 Then DSet.Tables(2).TableName = "DetalleAnualesMes"
|
||||
If DSet.Tables.Count > 3 Then DSet.Tables(3).TableName = "VentasPorVendedor"
|
||||
If DSet.Tables.Count > 4 Then DSet.Tables(4).TableName = "VentasPorClasificacion"
|
||||
If DSet.Tables.Count > 5 Then DSet.Tables(5).TableName = "VentasPorMarca"
|
||||
If DSet.Tables.Count > 6 Then DSet.Tables(6).TableName = "VentasPorPS"
|
||||
If DSet.Tables.Count > 7 Then DSet.Tables(7).TableName = "VentasPorCliente"
|
||||
If DSet.Tables.Count > 8 Then DSet.Tables(8).TableName = "VentasPorProveedor"
|
||||
|
||||
Case 2 ' Recuperación
|
||||
DSet.Tables(0).TableName = "CarteraPorSubproyecto"
|
||||
If DSet.Tables.Count > 1 Then DSet.Tables(1).TableName = "CarteraPorVendedor"
|
||||
If DSet.Tables.Count > 2 Then DSet.Tables(2).TableName = "RecuperacionPorSubproyecto"
|
||||
If DSet.Tables.Count > 3 Then DSet.Tables(3).TableName = "RecuperacionPorVendedor"
|
||||
If DSet.Tables.Count > 4 Then DSet.Tables(4).TableName = "RecuperacionPorCliente"
|
||||
If DSet.Tables.Count > 5 Then DSet.Tables(5).TableName = "CxCMensual"
|
||||
|
||||
|
||||
Case 3 'Compras
|
||||
If DSet.Tables.Count > 1 Then DSet.Tables(1).TableName = "ComprasPorClasificación"
|
||||
If DSet.Tables.Count > 2 Then DSet.Tables(2).TableName = "ComprasPorMarca"
|
||||
If DSet.Tables.Count > 3 Then DSet.Tables(3).TableName = "ComprasPorPS"
|
||||
If DSet.Tables.Count > 4 Then DSet.Tables(4).TableName = "ComprasPorProveedor"
|
||||
|
||||
Case 4 'Cuentas Por Pagar
|
||||
DSet.Tables(0).TableName = "CxPPorSubproyecto"
|
||||
If DSet.Tables.Count > 1 Then DSet.Tables(1).TableName = "CxPPorProveedor"
|
||||
If DSet.Tables.Count > 2 Then DSet.Tables(2).TableName = "PagosPorSubproyecto"
|
||||
If DSet.Tables.Count > 3 Then DSet.Tables(3).TableName = "PagosPorProveedor"
|
||||
If DSet.Tables.Count > 4 Then DSet.Tables(4).TableName = "CxPMensual"
|
||||
End Select
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
' Manejo de errores
|
||||
@@ -720,55 +748,55 @@ Public Class ClsGenerales
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
'#Region " E S T A D O S"
|
||||
' Public Function GetGralEstados() As Boolean
|
||||
' Dim Retorno As Boolean = False
|
||||
' DataAdapter("PA_Gral_EstadoGet")
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
' Retorno = True
|
||||
' Catch ex As Exception
|
||||
' OnError("Ocurrió un error al obtener el Catálogo de Estados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
' End Try
|
||||
|
||||
' Return Retorno
|
||||
' End Function
|
||||
'#End Region
|
||||
|
||||
'#Region " M U N I C I P I O S"
|
||||
' Public Function GetGralMunicipios() As Boolean
|
||||
' Dim Retorno As Boolean = False
|
||||
' DataAdapter("PA_Gral_MunicipioGet")
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
' Retorno = True
|
||||
' Catch ex As Exception
|
||||
' OnError("Ocurrió un error al obtener el Catálogo de Municipios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
' End Try
|
||||
|
||||
' Return Retorno
|
||||
' End Function
|
||||
'#End Region
|
||||
|
||||
'#Region " P A I S E S"
|
||||
' Public Function GetGralPaises() As Boolean
|
||||
' Dim Retorno As Boolean = False
|
||||
' DataAdapter("PA_Gral_PaisGet")
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
' Retorno = True
|
||||
' Catch ex As Exception
|
||||
' OnError("Ocurrió un error al obtener el Catálogo de Paises.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
' End Try
|
||||
|
||||
' Return Retorno
|
||||
' End Function
|
||||
'#End Region
|
||||
|
||||
|
||||
'#Region " E S T A D O S"
|
||||
' Public Function GetGralEstados() As Boolean
|
||||
' Dim Retorno As Boolean = False
|
||||
' DataAdapter("PA_Gral_EstadoGet")
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
' Retorno = True
|
||||
' Catch ex As Exception
|
||||
' OnError("Ocurrió un error al obtener el Catálogo de Estados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
' End Try
|
||||
|
||||
' Return Retorno
|
||||
' End Function
|
||||
'#End Region
|
||||
|
||||
'#Region " M U N I C I P I O S"
|
||||
' Public Function GetGralMunicipios() As Boolean
|
||||
' Dim Retorno As Boolean = False
|
||||
' DataAdapter("PA_Gral_MunicipioGet")
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
' Retorno = True
|
||||
' Catch ex As Exception
|
||||
' OnError("Ocurrió un error al obtener el Catálogo de Municipios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
' End Try
|
||||
|
||||
' Return Retorno
|
||||
' End Function
|
||||
'#End Region
|
||||
|
||||
'#Region " P A I S E S"
|
||||
' Public Function GetGralPaises() As Boolean
|
||||
' Dim Retorno As Boolean = False
|
||||
' DataAdapter("PA_Gral_PaisGet")
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
' Retorno = True
|
||||
' Catch ex As Exception
|
||||
' OnError("Ocurrió un error al obtener el Catálogo de Paises.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
' End Try
|
||||
|
||||
' Return Retorno
|
||||
' End Function
|
||||
'#End Region
|
||||
|
||||
#Region " P O B L A C I O N E S"
|
||||
Public Function GetGralPoblaciones() As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
@@ -7728,7 +7728,7 @@ Public Class ClsVentas
|
||||
End Function
|
||||
|
||||
|
||||
Public Function GetSMSIndicadores(Opcion As Integer, FechaInicio As Date, FechaFin As Date, CveUsuario As Integer, CveVendedor As Integer, CveGerenteVendedor As Integer, CveUsuarioTecnico As Integer, CveEmpresa As Integer) As Boolean
|
||||
Public Function GetSMSIndicadores(Opcion As Integer, FechaInicio As Date, FechaFin As Date, CveUsuario As Integer, CveVendedor As Integer, CveUsuarioTecnico As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_SMS_IndicadoresGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
@@ -7737,7 +7737,6 @@ Public Class ClsVentas
|
||||
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor
|
||||
.Add("@CveGerenteVendedor", SqlDbType.Int).Value = CveGerenteVendedor
|
||||
.Add("@CveUsuarioTecnico", SqlDbType.Int).Value = CveUsuarioTecnico
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
@@ -574,7 +574,7 @@
|
||||
</script>
|
||||
<script>
|
||||
function LimpiaCeros(Divisor) {
|
||||
$('.ceros').each(function (i, obj) {
|
||||
$('.ceros').each(function (i, obj) {
|
||||
|
||||
if ($(this).html() == '0.00' || $(this).html() == '0.00%') {
|
||||
$(this).html('-');
|
||||
|
||||
@@ -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,24 +597,48 @@ 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);
|
||||
|
||||
if (DtIEPSA != null)
|
||||
//RepIVA
|
||||
if (TT.ActiveTabIndex == 0)
|
||||
{
|
||||
ReportDataSource rds2 = new ReportDataSource();
|
||||
rds2.Name = "IEPSPorcentaje";
|
||||
rds2.Value = DtIEPSA;
|
||||
lrds.Add(rds2);
|
||||
if (DtIEPSA != null)
|
||||
{
|
||||
ReportDataSource rds2 = new ReportDataSource();
|
||||
rds2.Name = "IEPSPorcentaje";
|
||||
rds2.Value = DtIEPSA;
|
||||
lrds.Add(rds2);
|
||||
}
|
||||
|
||||
if (DtIVAA != null)
|
||||
{
|
||||
ReportDataSource rds3 = new ReportDataSource();
|
||||
rds3.Name = "IVAPorcentaje";
|
||||
rds3.Value = DtIVAA;
|
||||
lrds.Add(rds3);
|
||||
}
|
||||
}
|
||||
|
||||
if (DtIVAA != null)
|
||||
//RepIVAAcreditable
|
||||
if (TT.ActiveTabIndex == 1)
|
||||
{
|
||||
ReportDataSource rds3 = new ReportDataSource();
|
||||
rds3.Name = "IVAPorcentaje";
|
||||
rds3.Value = DtIVAA;
|
||||
lrds.Add(rds3);
|
||||
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() == "")
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1665,7 +1665,7 @@ Partial Class Inicio
|
||||
Dim FechaI As Date = txtFechaInicioSMS.Text.ToDate ' Now.FirstDayOfMonth
|
||||
Dim FechaF As Date = txtFechaFinSMS.Text.ToDate 'Now.LastDayOfMonth
|
||||
|
||||
If Gral.GetSMSIndicadores(Opcion, FechaI, FechaF, UsuarioActual.CveUsuario, CveVendedor, CveGerenteVendedor, CveUsuarioTecnico, UsuarioActual.CveEmpresa) Then
|
||||
If Gral.GetSMSIndicadores(Opcion, FechaI, FechaF, UsuarioActual.CveUsuario, CveVendedor, CveUsuarioTecnico, UsuarioActual.CveEmpresa) Then
|
||||
ds = Gral.DataSetResultados
|
||||
End If
|
||||
'0-ventas totales, 1-comisiones totales, 2-medicos sin consumo, 3-top10medicos, 4-top5marcas, 5-num pacientes
|
||||
|
||||
64
OP/OP.aspx
64
OP/OP.aspx
@@ -310,18 +310,16 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
/* Alinear celda y contenido a la derecha */
|
||||
.celda-derecha {
|
||||
text-align: right !important;
|
||||
|
||||
}
|
||||
|
||||
.txt-merma {
|
||||
/* Ancho reducido al 50% */
|
||||
margin-left: 30px !important; /* Mueve el TextBox a la derecha dentro de la celda */
|
||||
display: block !important; /* Permite que margin-left:auto funcione */
|
||||
/* Alinea el texto interno a la derecha */
|
||||
}
|
||||
.celda-derecha {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.txt-merma {
|
||||
/* Ancho reducido al 50% */
|
||||
margin-left: 30px !important; /* Mueve el TextBox a la derecha dentro de la celda */
|
||||
display: block !important; /* Permite que margin-left:auto funcione */
|
||||
/* Alinea el texto interno a la derecha */
|
||||
}
|
||||
</style>
|
||||
|
||||
</asp:Content>
|
||||
@@ -364,16 +362,16 @@
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label>Fecha</label>
|
||||
|
||||
|
||||
<div class="input-group input-sm input-small date date-picker" style="height: 30px;" data-date-format="dd/mm/yyyy">
|
||||
<asp:TextBox ID="Txtfecha" runat="server"
|
||||
CssClass="form-control"
|
||||
style="margin-top: -6px;"
|
||||
Style="margin-top: -6px;"
|
||||
Width="100%"
|
||||
CausesValidation="true"
|
||||
MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn">
|
||||
<asp:LinkButton ID="imgCalendarioF" class="btn default " style="margin-top: -11px; height: 29px;" Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
<asp:LinkButton ID="imgCalendarioF" class="btn default " Style="margin-top: -11px; height: 29px;" Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
</div>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="Txtfecha" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
@@ -428,7 +426,7 @@
|
||||
ControlToValidate="TxtDescripcion"
|
||||
ErrorMessage="Descripción requerida"
|
||||
Display="None"
|
||||
CssClass="text-danger"
|
||||
CssClass="text-danger"
|
||||
ValidationGroup="GrpGuardar" />
|
||||
<label for="<%= TxtDescripcion.ClientID.ToString()%>">Descripcion</label>
|
||||
</div>
|
||||
@@ -437,7 +435,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="portlet light xspadding bordered">
|
||||
<div class="portlet-title">
|
||||
@@ -471,13 +469,13 @@
|
||||
<div class="portlet-body">
|
||||
<div class="row">
|
||||
<div id="PanelProducto" runat="server">
|
||||
<asp:label ID="LblProducto" class="col-md-1" runat="server" style="max-width: 70px;" Text="Producto"></asp:label>
|
||||
<div class="col-md-3">
|
||||
<ADS:Dropdownlost ID="DdlPS" runat="server" Width="100%" CssStyle="width: 100%;"
|
||||
CssClass="select2me"
|
||||
CssClassDdl="form-control" DataTextField="PSCodigo"
|
||||
DataValueField="CvePS" Enabled="false" />
|
||||
</div>
|
||||
<asp:Label ID="LblProducto" class="col-md-1" runat="server" Style="max-width: 70px;" Text="Producto"></asp:Label>
|
||||
<div class="col-md-3">
|
||||
<ADS:Dropdownlost ID="DdlPS" runat="server" Width="100%" CssStyle="width: 100%;"
|
||||
CssClass="select2me"
|
||||
CssClassDdl="form-control" DataTextField="PSCodigo"
|
||||
DataValueField="CvePS" Enabled="false" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 d-flex align-items-center" style="gap: 10px;">
|
||||
<asp:LinkButton ID="BtnAgregarProducto" runat="server"
|
||||
@@ -852,13 +850,13 @@
|
||||
<asp:TextBox ID="TxtCantidadPT" runat="server"
|
||||
Text='<%# Bind("Cantidad") %>'
|
||||
CssClass="form-control"
|
||||
style="text-align: right;"
|
||||
Style="text-align: right;"
|
||||
TextMode="Number"
|
||||
min="0"
|
||||
step="1"
|
||||
data-original='<%# Eval("Cantidad") %>'
|
||||
onchange="validarCantidad(this)"
|
||||
ItemStyle-HorizontalAlign="Right"/>
|
||||
onchange="validarCantidad(this)"
|
||||
ItemStyle-HorizontalAlign="Right" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
@@ -872,18 +870,17 @@
|
||||
CssClass="table table-striped table-hover" GridLines="None" Width="100%">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="PSCodigo" HeaderText="Producto" />
|
||||
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right"/>
|
||||
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:TemplateField HeaderText="Devolución">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtDevolucionMP" runat="server"
|
||||
Text="0"
|
||||
style="width: 50%; text-align: right; margin-left: 38px; display: block;"
|
||||
Style="width: 50%; text-align: right; margin-left: 38px; display: block;"
|
||||
TextMode="Number"
|
||||
min="0"
|
||||
step="1"
|
||||
data-original='<%# Eval("Cantidad") %>'
|
||||
onchange="validarCantidad(this)"
|
||||
/>
|
||||
onchange="validarCantidad(this)" />
|
||||
</ItemTemplate>
|
||||
|
||||
</asp:TemplateField>
|
||||
@@ -947,15 +944,14 @@
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtMerma" runat="server" Text="0"
|
||||
CssClass="txt-merma" TextMode="Number" step="0.01" min="0"
|
||||
style="width: 50%; text-align: right;"
|
||||
Style="width: 50%; text-align: right;"
|
||||
onchange="calcularDevolucion(this);"
|
||||
data-original='<%# Eval("Cantidad")%>'
|
||||
/>
|
||||
data-original='<%# Eval("Cantidad")%>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Devolución" ItemStyle-CssClass="celda-derecha">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LblDevolucion" runat="server" Text='<%# Eval("Cantidad", "{0:N2}") %>' CssClass="devolucion-label" style="text-align: right;"/>
|
||||
<asp:Label ID="LblDevolucion" runat="server" Text='<%# Eval("Cantidad", "{0:N2}") %>' CssClass="devolucion-label" Style="text-align: right;" />
|
||||
<asp:HiddenField ID="HfDevolucion" runat="server" Value='<%# Eval("Cantidad", "{0:N2}") %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
@@ -125,6 +125,7 @@ Partial Class OP_OP
|
||||
BtnCancelarOP.Visible = (CveOP > 0 AndAlso TipoEstatus <> 3 AndAlso TipoEstatus <> 4)
|
||||
End Sub
|
||||
|
||||
#Region "Metodos"
|
||||
Private Sub CreaPS()
|
||||
DtPS = New DataTable()
|
||||
DtPS.Columns.Add("Tipo", GetType(String)) ' Producto, MP, MO, CI
|
||||
@@ -247,7 +248,9 @@ Partial Class OP_OP
|
||||
UpBtns.Update()
|
||||
UpModalCancelar.Update()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "Cargar"
|
||||
Private Sub CargaDatos()
|
||||
If CveOP > 0 Then
|
||||
Dim ObjOP As New ClsOP()
|
||||
@@ -367,7 +370,9 @@ Partial Class OP_OP
|
||||
DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1"))
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "Producto"
|
||||
Protected Sub BtnAgregarProducto_Click(sender As Object, e As EventArgs) Handles BtnAgregarProducto.Click
|
||||
If DdlPS.SelectedValue = "-1" Then Exit Sub
|
||||
|
||||
@@ -480,33 +485,16 @@ Partial Class OP_OP
|
||||
Next
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub GvProductos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvProductos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim btnEliminar As LinkButton = DirectCast(e.Row.FindControl("BtnEliminar"), LinkButton)
|
||||
btnEliminar.Visible = (TipoEstatus <> 3)
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Protected Sub LnkSolicitarMP_Click(sender As Object, e As EventArgs)
|
||||
' Cargar almacenes
|
||||
DdlAlmacenOrigenMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 1")
|
||||
DdlAlmacenOrigenMP.DataBind()
|
||||
DdlAlmacenDestinoMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 28")
|
||||
DdlAlmacenDestinoMP.DataBind()
|
||||
|
||||
GvMPAgregados.DataKeyNames = New String() {"CvePSMateriaPrima", "CveUMMateriaPrima"}
|
||||
|
||||
' Filtrar MP no surtida
|
||||
Dim DtMPFaltante As DataTable = DtMP.FiltraParametros("Surtido = 0").Copy()
|
||||
GvMPAgregados.DataSource = DtMPFaltante
|
||||
GvMPAgregados.DataBind()
|
||||
|
||||
|
||||
' Mostrar modal
|
||||
RegistraScript("$('#DVModalSolicitarMP').modal('show');")
|
||||
UpModalMP.Update()
|
||||
End Sub
|
||||
|
||||
#Region "Simular MP"
|
||||
Protected Sub BtnSimularMP_Click(sender As Object, e As EventArgs)
|
||||
If CveOP <> -1 Then Exit Sub
|
||||
If DdlPS.SelectedValue = "-1" Then Exit Sub
|
||||
@@ -664,7 +652,28 @@ Partial Class OP_OP
|
||||
|
||||
Return ObjOP.DtResultados.Copy()
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "Solicitar MP"
|
||||
Protected Sub LnkSolicitarMP_Click(sender As Object, e As EventArgs)
|
||||
' Cargar almacenes
|
||||
DdlAlmacenOrigenMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 1")
|
||||
DdlAlmacenOrigenMP.DataBind()
|
||||
DdlAlmacenDestinoMP.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen = 28")
|
||||
DdlAlmacenDestinoMP.DataBind()
|
||||
|
||||
GvMPAgregados.DataKeyNames = New String() {"CvePSMateriaPrima", "CveUMMateriaPrima"}
|
||||
|
||||
' Filtrar MP no surtida
|
||||
Dim DtMPFaltante As DataTable = DtMP.FiltraParametros("Surtido = 0").Copy()
|
||||
GvMPAgregados.DataSource = DtMPFaltante
|
||||
GvMPAgregados.DataBind()
|
||||
|
||||
|
||||
' Mostrar modal
|
||||
RegistraScript("$('#DVModalSolicitarMP').modal('show');")
|
||||
UpModalMP.Update()
|
||||
End Sub
|
||||
Protected Sub BtnGuardarSolicitudMP_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim CveTraspasoSolicitud As Integer = -1
|
||||
@@ -772,6 +781,9 @@ Partial Class OP_OP
|
||||
ObjInventario.Dispose()
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "Guardar OP"
|
||||
|
||||
Protected Sub BtnGuardarOP_Click(sender As Object, e As EventArgs)
|
||||
' Validaciones básicas
|
||||
@@ -930,6 +942,8 @@ Partial Class OP_OP
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Cancelar"
|
||||
Protected Sub BtnCancelarOP_Click(sender As Object, e As EventArgs)
|
||||
' Cargar almacenes
|
||||
|
||||
@@ -500,82 +500,99 @@ Partial Class Ventas_PVCobranza
|
||||
Dim GvRow As GridViewRow = DirectCast(ImgBtn.BindingContainer, GridViewRow)
|
||||
Dim TieneError As Boolean = False
|
||||
|
||||
Dim CveVenta As Integer = e.CommandArgument.ToString.ToEntero
|
||||
Dim CondicionesPagoContado As Boolean = GvRow.DataKey("CondicionesPago") = "0"
|
||||
Dim ObjVentas As New ClsVentas
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
|
||||
Try
|
||||
If Not ObjVentas.UpdateAsignaVentaCobranza(CveVenta, 1, UsuarioActual.CveUsuario, -1, "", Now) Then
|
||||
Dim CveVenta As Integer = e.CommandArgument.ToString.ToEntero
|
||||
|
||||
Dim RowVenta As DataRow = Nothing
|
||||
|
||||
Using ObjVta As New ClsVentas
|
||||
If ObjVta.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
RowVenta = ObjVta.DtResultados.Copy().Rows(0)
|
||||
End If
|
||||
End Using
|
||||
|
||||
If RowVenta IsNot Nothing Then
|
||||
Dim ObjVentas As New ClsVentas
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
|
||||
Try
|
||||
If Not ObjVentas.UpdateAsignaVentaCobranza(CveVenta, 1, UsuarioActual.CveUsuario, -1, "", Now) Then
|
||||
TieneError = True
|
||||
End If
|
||||
HdnCveVenta.Value = CveVenta.ToString
|
||||
|
||||
Dim Saldo As Decimal = RowVenta("Saldo").ToString().ToDecimal()
|
||||
Dim CveFormaPago33 As String = RowVenta("CveFormaPago33").ToString()
|
||||
|
||||
HdnCveCliente.Value = RowVenta("CveCliente").ToString()
|
||||
TxtImporteContado.Text = Saldo.FormatoNumero
|
||||
HdnTotal.Value = Saldo.ToString()
|
||||
TxtImporteEfectivo.Focus()
|
||||
LtlNombre.Text = RowVenta("AtencionA").ToString()
|
||||
LtlFolio.Text = RowVenta("SerieFolio").ToString()
|
||||
LtlSaldo.Text = Saldo.FormatoNumero
|
||||
LtlMoneda.Text = RowVenta("Moneda").ToString()
|
||||
|
||||
Dim CondicionesPagoContado As Boolean = RowVenta("CondicionesPago").ToString() = "0"
|
||||
Dim CveMoneda As Integer = RowVenta("CveMoneda").ToString().ToEntero()
|
||||
|
||||
HdnMoneda.Value = CveMoneda.ToString()
|
||||
If CveMoneda = 2 Then
|
||||
DivUSD.Visible = True
|
||||
TxtTC.Text = GlobalTipoCambio(Now).ToString()
|
||||
TxtTotalMXN.Text = (TxtImporteContado.Text.ToDecimal() * TxtTC.Text.ToDecimal()).FormatoNumero()
|
||||
End If
|
||||
|
||||
HdnVentaCondicionesPago.Value = RowVenta("CondicionesPago").ToString()
|
||||
HdnPlazoCobranza.Value = GvRow.DataKey("PlazoCobranza")
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197) AndAlso RowVenta("TipoDocto").ToString().Contiene("Rem", "Ant") Then
|
||||
DivAnticipo.Visible = True
|
||||
ImgAntiPend.Visible = True
|
||||
End If
|
||||
|
||||
If CondicionesPagoContado Then
|
||||
'según la forma de pago va a establecer el valor para pago.
|
||||
Select Case CveFormaPago33
|
||||
Case "1"
|
||||
TxtImporteEfectivo.Text = Saldo.FormatoNumero
|
||||
Case "2"
|
||||
TxtImporteCheque.Text = Saldo.FormatoNumero
|
||||
Case "3"
|
||||
TxtImporteTransferencia.Text = Saldo.FormatoNumero
|
||||
Case "4"
|
||||
TxtImporteCredito.Text = Saldo.FormatoNumero
|
||||
Case "18"
|
||||
TxtImporteDebito.Text = Saldo.FormatoNumero
|
||||
Case Else
|
||||
TxtImporteEfectivo.Text = Saldo.FormatoNumero
|
||||
End Select
|
||||
DivContadoBancos.Visible = True
|
||||
BtnPagar.Text = "Pagar"
|
||||
Else
|
||||
DivContadoBancos.Visible = False
|
||||
BtnPagar.Text = "Emitir a crédito"
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
End If
|
||||
HdnCveVenta.Value = CveVenta.ToString
|
||||
HdnCveCliente.Value = GvRow.DataKey("CveCliente")
|
||||
TxtImporteContado.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
HdnTotal.Value = GvRow.DataKey("Saldo")
|
||||
TxtImporteEfectivo.Focus()
|
||||
LtlNombre.Text = GvRow.DataKey("AtencionA")
|
||||
LtlFolio.Text = GvRow.DataKey("SerieFolio")
|
||||
LtlSaldo.Text = GvRow.DataKey("Saldo").ToDecimal.FormatoNumero
|
||||
LtlMoneda.Text = GvRow.DataKey("Moneda")
|
||||
End Try
|
||||
|
||||
Dim CveMoneda As Integer = GvRow.DataKey("CveMoneda").ToEntero()
|
||||
'carga información para cobranza
|
||||
|
||||
HdnMoneda.Value = CveMoneda.ToString()
|
||||
If CveMoneda = 2 Then
|
||||
DivUSD.Visible = True
|
||||
TxtTC.Text = GlobalTipoCambio(Now).ToString()
|
||||
TxtTotalMXN.Text = (TxtImporteContado.Text.ToDecimal() * TxtTC.Text.ToDecimal()).FormatoNumero()
|
||||
End If
|
||||
|
||||
HdnVentaCondicionesPago.Value = GvRow.DataKey("CondicionesPago")
|
||||
HdnPlazoCobranza.Value = GvRow.DataKey("PlazoCobranza")
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(189, 193, 195, 196, 197) AndAlso GvRow.DataKey("TipoDocto").Contiene("Rem", "Ant") Then
|
||||
DivAnticipo.Visible = True
|
||||
ImgAntiPend.Visible = True
|
||||
End If
|
||||
|
||||
If CondicionesPagoContado Then
|
||||
'según la forma de pago va a establecer el valor para pago.
|
||||
Select Case GvRow.DataKey("CveFormaPago33")
|
||||
Case "1"
|
||||
TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
Case "2"
|
||||
TxtImporteCheque.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
Case "3"
|
||||
TxtImporteTransferencia.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
Case "4"
|
||||
TxtImporteCredito.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
Case "18"
|
||||
TxtImporteDebito.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
Case Else
|
||||
TxtImporteEfectivo.Text = GvRow.DataKey("Saldo").FormatoNumero
|
||||
End Select
|
||||
DivContadoBancos.Visible = True
|
||||
BtnPagar.Text = "Pagar"
|
||||
If Not TieneError Then
|
||||
ObjVentas.Commit()
|
||||
PnlContado.Visible = True
|
||||
Else
|
||||
DivContadoBancos.Visible = False
|
||||
BtnPagar.Text = "Emitir a crédito"
|
||||
ObjVentas.RollBack()
|
||||
PnlContado.Visible = False
|
||||
Alert("Hubo un error al asignar datos de cobranza", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
End Try
|
||||
|
||||
'carga información para cobranza
|
||||
|
||||
If Not TieneError Then
|
||||
ObjVentas.Commit()
|
||||
PnlContado.Visible = True
|
||||
Else
|
||||
ObjVentas.RollBack()
|
||||
PnlContado.Visible = False
|
||||
Alert("Hubo un error al asignar datos de cobranza", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
'CargaDatos()
|
||||
ObjVentas.Dispose()
|
||||
End If
|
||||
|
||||
|
||||
'CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -906,6 +923,23 @@ Partial Class Ventas_PVCobranza
|
||||
SaldoPendientePagos -= PagoEfectivo
|
||||
End If
|
||||
|
||||
If SobranteFaltante <> 0 Then
|
||||
Dim Pago As New VentaPago
|
||||
Pago.ImportePagoVenta = Math.Abs(SobranteFaltante)
|
||||
Pago.ImportePago = Math.Abs(SobranteFaltante)
|
||||
Pago.CveIE = -1
|
||||
Pago.CveMonedaPago = VentaActual.CveMoneda
|
||||
Pago.Fecha = NowADS()
|
||||
Pago.Referencia = VentaActual.SerieFolio
|
||||
Pago.TipoPago = "XXX"
|
||||
Pago.OtroGastoIngreso = SobranteFaltante
|
||||
|
||||
Dim ErrorConta As Boolean = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
|
||||
If ErrorConta Then
|
||||
MsgError = "Error en aplicación de sobrante/faltante"
|
||||
End If
|
||||
End If
|
||||
|
||||
If SaldoPendienteVenta > 0 AndAlso Not ChkSobFaltante.Checked Then
|
||||
MsgError = "Tiene saldo pendiente por aplicar"
|
||||
End If
|
||||
|
||||
@@ -7699,7 +7699,7 @@
|
||||
<div class="row" id="DivRNCCargosDetalle" runat="server" visible="false">
|
||||
<div class="col-md-12" style="max-height: 440px; overflow: auto">
|
||||
<asp:GridView ID="GvRemisionesNCDetalle" runat="server" AutoGenerateColumns="False"
|
||||
DataKeyNames="CveVenta,CveVentaDetalleRNC,CvePS,PU,PorcentajeIVA" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
|
||||
DataKeyNames="CveVenta,CveVentaDetalleRNC,CvePS,PU,PorcentajeIVA,Saldo" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
|
||||
@@ -2866,6 +2866,8 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("PSAlterno", GetType(String))
|
||||
TmpDT.Columns.Add("Costo", GetType(Decimal))
|
||||
TmpDT.Columns("Costo").DefaultValue = 0D
|
||||
TmpDT.Columns.Add("UltimoCosto", GetType(Decimal))
|
||||
TmpDT.Columns("UltimoCosto").DefaultValue = 0D
|
||||
|
||||
GvPS.DataSource = ObjVentas.DtResultados
|
||||
GvPS.DataBind()
|
||||
@@ -2887,6 +2889,8 @@ Partial Class Ventas
|
||||
TmpDT = ObjCGame.DtResultados
|
||||
TmpDT.Columns.Add("Costo", GetType(Decimal))
|
||||
TmpDT.Columns("Costo").DefaultValue = 0D
|
||||
TmpDT.Columns.Add("UltimoCosto", GetType(Decimal))
|
||||
TmpDT.Columns("UltimoCosto").DefaultValue = 0D
|
||||
If Not TmpDT.Columns.Contains("NumeroParte") Then TmpDT.Columns.Add("NumeroParte", GetType(String))
|
||||
|
||||
GvPS.DataBind()
|
||||
@@ -2935,6 +2939,9 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("NumeroParte", GetType(String))
|
||||
TmpDT.Columns.Add("Costo", GetType(Decimal))
|
||||
TmpDT.Columns("Costo").DefaultValue = 0D
|
||||
TmpDT.Columns.Add("UltimoCosto", GetType(Decimal))
|
||||
TmpDT.Columns("UltimoCosto").DefaultValue = 0D
|
||||
|
||||
GvPS.DataSource = ObjVentas.DtResultados
|
||||
GvPS.DataBind()
|
||||
|
||||
@@ -8112,6 +8119,8 @@ Partial Class Ventas
|
||||
If CreditoDispo < 0 Then
|
||||
BtnsFacturar.Visible = False
|
||||
BtnGenerarRemision.Visible = False
|
||||
|
||||
TieneBloqueoPorCreditoVencimiento = 1
|
||||
Alert("El límite de crédito se ha excedido", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
@@ -8126,9 +8135,7 @@ Partial Class Ventas
|
||||
BtnGenerarRemision.Visible = False
|
||||
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ClienteEsDistribuidor AndAlso Opcion.Contiene(2, 3) Then
|
||||
TieneBloqueoPorCreditoVencimiento = 1
|
||||
End If
|
||||
TieneBloqueoPorCreditoVencimiento = 1
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
@@ -8432,6 +8439,12 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
'SI ES COTIZACION, PERMITIR CREAR UN DOCUMENTO NUEVO TIPO "PA"
|
||||
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(595) = "1" AndAlso TieneBloqueoPorCreditoVencimiento = 1 Then
|
||||
BtnGeneraAutorizacion.Visible = True
|
||||
UpFacturar.Update()
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -9283,6 +9296,9 @@ Partial Class Ventas
|
||||
If DrPS IsNot Nothing Then
|
||||
gvr.FCTextBox("TxtPrecio").Enabled = CBool(DrPS("PrecioLibre"))
|
||||
End If
|
||||
|
||||
'PONER LA CLASIFICACION EN TODAS, PARA NO FILTRAR POR CLASIFICACION
|
||||
gvr.FCDropDownList("DdlClasificacion").SelectedValueExist("-1")
|
||||
End If
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(253) Then gvr.FCTextBox("TxtPrecio").Enabled = True
|
||||
@@ -10381,7 +10397,6 @@ Partial Class Ventas
|
||||
PU = dr("PU").ToString().ToDecimal * If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.ToDecimal)
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(602) = "UC" Then 'validación sobre el último costo
|
||||
|
||||
If ObjInventarios.GetUltimoCosto(UsuarioActual.CveEmpresa, dr("CvePS").ToString().ToEntero()) Then
|
||||
Dim drps As DataRow = ObjInventarios.DtResultados.FiltroPrimero("")
|
||||
If drps IsNot Nothing Then
|
||||
@@ -10391,6 +10406,7 @@ Partial Class Ventas
|
||||
Else
|
||||
Costo = ObjInventarios.GetCostoPS(dr("CvePS").ToString().ToEntero(), dr("Cantidad").ToString().ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
|
||||
End If
|
||||
|
||||
Dim PrecioMinimo As Decimal = 0
|
||||
'RMF. condicion temporal, para reubicación, precio mínimo
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
@@ -13781,13 +13797,7 @@ Partial Class Ventas
|
||||
Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", ""))
|
||||
Timbre.Comprobante.Folio = Obj.Folio.ToString()
|
||||
Timbre.Comprobante.Serie = Obj.Serie
|
||||
|
||||
If Me.CveVenta = 4381091 Then
|
||||
Timbre.Comprobante.Fecha = Obj.Fecha
|
||||
Else
|
||||
Timbre.Comprobante.Fecha = Obj.FechaCP
|
||||
End If
|
||||
|
||||
Timbre.Comprobante.Fecha = Obj.FechaCP
|
||||
|
||||
Timbre.Comprobante.CondicionesdePago = If(UsuarioActual.CveEmpresa.Contiene(15, 76, 198), "No Aplica", Obj.FormaPago)
|
||||
Timbre.Comprobante.MetodoPago = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {Obj.CveMetodoPago}") ' Obj.ClaveMetodoPagoSAT
|
||||
@@ -13890,7 +13900,8 @@ Partial Class Ventas
|
||||
If Obj.TipoDocto.Contiene("Egs", "Dev") OrElse (NuevaFactura = 1) Then
|
||||
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
|
||||
Timbre.CFDIRelacionados.UUID.Clear()
|
||||
For Each Dr As DataRow In DtVentasNC.Rows
|
||||
'QUITAR LAS QUE ESTEN CANCELADAS
|
||||
For Each Dr As DataRow In DtVentasNC.FiltraParametros("CveEstatusFactura <> 5").Rows
|
||||
Timbre.CFDIRelacionados.UUID.Add(Dr("FolioFiscal").ToString())
|
||||
Next
|
||||
Else
|
||||
@@ -21690,6 +21701,9 @@ Partial Class Ventas
|
||||
|
||||
TmpDT.Columns.Add("Costo", GetType(Decimal))
|
||||
TmpDT.Columns("Costo").DefaultValue = 0D
|
||||
|
||||
TmpDT.Columns.Add("UltimoCosto", GetType(Decimal))
|
||||
TmpDT.Columns("UltimoCosto").DefaultValue = 0D
|
||||
End Sub
|
||||
Private Sub CreaDTmpC()
|
||||
DTmpC = New DataTable
|
||||
@@ -22094,6 +22108,20 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
'SI ES FACTURACION DE COTIZACION Y REQUIERE AUTORIZACION, SOLO DEBE PERMITIR ESTA
|
||||
If UsuarioActual.Empresa.Funcionalidad(595) = "1" AndAlso Request("CveCotizacion") IsNot Nothing AndAlso Request("CveCotizacion").ToString().ToEntero() > 0 AndAlso TieneBloqueoPorAutorizacion = 1 Then
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs"))
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Cot"))
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev"))
|
||||
|
||||
DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
|
||||
DdlTipoComprobante.SelectedValue = "PA"
|
||||
|
||||
BtnCrearApartirDe.Visible = False
|
||||
UpFacturar.Update()
|
||||
End If
|
||||
|
||||
|
||||
'[IPP]: FALTA CONFIGURAR Y DAR PERMISO A TODOS LOS QUE TENGAN ACCESO A VENTAS
|
||||
''Puede remisionar
|
||||
@@ -24729,6 +24757,19 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'si es de FNC contado. bloquear edición si está pagada o en proceso de cobro
|
||||
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||
Using ObjVta As New ClsVentas
|
||||
If ObjVta.GetVenta(Me.CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
Dim DbRowVenta As DataRow = ObjVta.DtResultados.FiltroPrimero("")
|
||||
If DbRowVenta IsNot Nothing AndAlso (DbRowVenta("CveCobranzaEstatus").ToString = "1" OrElse DbRowVenta("Saldo").ToString.ToDecimal = 0) Then
|
||||
Alert("No se puede actualizar la información de la remisión porque esta en proceso de cobro. Para aplicar cambios se debera de liberar desde el módulo de 'cobro por caja'.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
|
||||
Dim OcurrioError As Boolean = False
|
||||
Dim ObjVentas As New ClsVentas
|
||||
ObjVentas.IniciaTransacSQL()
|
||||
@@ -30703,7 +30744,7 @@ Partial Class Ventas
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then
|
||||
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
|
||||
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 1", "Moneda,Fecha,Folio")
|
||||
End If
|
||||
ObjMovtos.Dispose()
|
||||
|
||||
@@ -30807,7 +30848,7 @@ Partial Class Ventas
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then
|
||||
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
|
||||
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 1", "Moneda,Fecha,Folio")
|
||||
End If
|
||||
ObjMovtos.Dispose()
|
||||
|
||||
@@ -33135,7 +33176,7 @@ Partial Class Ventas
|
||||
Next
|
||||
|
||||
If Not Selecciono Then
|
||||
Alert("Tiene que seleccionar al menos un concepto y este dege tener una cantidad mayor a 0. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
|
||||
Alert("Tiene que seleccionar al menos un concepto y este debe tener una cantidad mayor a 0. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@@ -35976,7 +36017,7 @@ Partial Class Ventas
|
||||
#Region "GENERAR AUTORIZACIÓN"
|
||||
|
||||
Protected Sub BtnGeneraAutorizacion_Click(sender As Object, e As EventArgs)
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ped") Then
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ped", "Cot") Then
|
||||
EmitirDocumentoNuevo("PA")
|
||||
End If
|
||||
End Sub
|
||||
@@ -36670,10 +36711,15 @@ Partial Class Ventas
|
||||
Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * PorcentajeIVA).RoundSQL(2)
|
||||
|
||||
Dim TotalRNCDetalle As Decimal = (TotalCalculableImpuestos + ImporteIVA)
|
||||
Dim Saldo As Decimal = GvRow.DataKey("Saldo").ToDecimal()
|
||||
|
||||
'AJUSTAR SALDO SI EL TOTAL ES MAYOR
|
||||
If TotalRNCDetalle > Saldo Then
|
||||
TotalRNCDetalle = Saldo
|
||||
End If
|
||||
|
||||
TotalRNC += TotalRNCDetalle
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user