Amplió campo Importe

This commit is contained in:
janeth arvizu
2019-10-17 14:07:58 -07:00
parent f556ecfe9c
commit 85629bc3b8
5 changed files with 2429 additions and 2429 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,281 +1,281 @@
Option Explicit On Option Explicit On
Option Strict On Option Strict On
Imports System.Data Imports System.Data
Imports Extensiones Imports Extensiones
Imports Microsoft.Reporting.WebForms Imports Microsoft.Reporting.WebForms
Partial Class Compras_RepNotasCredito Partial Class Compras_RepNotasCredito
Inherits ClsPaginas Inherits ClsPaginas
#Region "PROPIEDADES" #Region "PROPIEDADES"
Private Property DtDatos As DataTable Private Property DtDatos As DataTable
Get Get
DtDatos = CType(ViewState("DtDatos"), DataTable) DtDatos = CType(ViewState("DtDatos"), DataTable)
End Get End Get
Set(value As DataTable) Set(value As DataTable)
ViewState("DtDatos") = value ViewState("DtDatos") = value
End Set End Set
End Property End Property
#End Region #End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
DdlProveedores.DataBind() DdlProveedores.DataBind()
TxtFechaSaldar.Text = Now.ToShortDateString TxtFechaSaldar.Text = Now.ToShortDateString
CargaDatos() CargaDatos()
End If End If
End Sub End Sub
Private Sub CargaDatos() Private Sub CargaDatos()
Dim ObjCompras As New ClsCompras Dim ObjCompras As New ClsCompras
Dim FechaI, FechaF As String Dim FechaI, FechaF As String
If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1" If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-1"
If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1" If txtFechaF.Text <> "" Then FechaF = txtFechaF.Text Else FechaF = "-1"
If ObjCompras.GetNotasCreditoRep(DdlProveedores.SelectedValue.ToEntero, DdlOpcion.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa) Then If ObjCompras.GetNotasCreditoRep(DdlProveedores.SelectedValue.ToEntero, DdlOpcion.SelectedValue.ToEntero, FechaI, FechaF, UsuarioActual.CveEmpresa) Then
DtDatos = ObjCompras.DtResultados DtDatos = ObjCompras.DtResultados
CargaGrid("") CargaGrid("")
Else Else
Alert("Ocurrió un error al obtener el catálogo de Notas de Crédito", Extensiones.TipoMensaje.MsgError) Alert("Ocurrió un error al obtener el catálogo de Notas de Crédito", Extensiones.TipoMensaje.MsgError)
End If End If
ObjCompras.Dispose() ObjCompras.Dispose()
End Sub End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCHyperLink("HLRazonSocial").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor")) e.Row.FCHyperLink("HLRazonSocial").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
e.Row.FCHyperLink("HLSerieFolio").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DBCampo("CveCompra")) e.Row.FCHyperLink("HLSerieFolio").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DBCampo("CveCompra"))
End If End If
End Sub End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos() CargaDatos()
End Sub End Sub
Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click
GvDatos.ExportToExcel("RepNotasCredito." & Now.ToShortDateString) GvDatos.ExportToExcel("RepNotasCredito." & Now.ToShortDateString)
End Sub End Sub
Private Sub GenerarPDF(Optional Formato As String = "PDF") Private Sub GenerarPDF(Optional Formato As String = "PDF")
If DtDatos IsNot Nothing Then If DtDatos IsNot Nothing Then
Dim StrFiltro As New StringBuilder Dim StrFiltro As New StringBuilder
'StrFiltro.AppendFormat(String.Format("<b>Proveedor:</b> {0}, <b>Estatus:</b> {1}", DdlProveedores.SelectedItem.Text, DdlOpcion.SelectedItem.Text)) 'StrFiltro.AppendFormat(String.Format("<b>Proveedor:</b> {0}, <b>Estatus:</b> {1}", DdlProveedores.SelectedItem.Text, DdlOpcion.SelectedItem.Text))
' If DdlTipoComprobante.SelectedValue <> "-1" Then StrFiltro.AppendFormat("&emsp;<b>Tipo Documento</b>: {0}", DdlTipoComprobante.SelectedItem.Text) ' If DdlTipoComprobante.SelectedValue <> "-1" Then StrFiltro.AppendFormat("&emsp;<b>Tipo Documento</b>: {0}", DdlTipoComprobante.SelectedItem.Text)
If DdlProveedores.SelectedValue <> "-1" Then StrFiltro.AppendFormat("&emsp;<b>Proveedor:</b> {0}", DdlProveedores.SelectedItem.Text) If DdlProveedores.SelectedValue <> "-1" Then StrFiltro.AppendFormat("&emsp;<b>Proveedor:</b> {0}", DdlProveedores.SelectedItem.Text)
If DdlOpcion.SelectedValue <> "-1" Then StrFiltro.AppendFormat("&emsp;<b>Estatus:</b> {0}", DdlOpcion.SelectedItem.Text) If DdlOpcion.SelectedValue <> "-1" Then StrFiltro.AppendFormat("&emsp;<b>Estatus:</b> {0}", DdlOpcion.SelectedItem.Text)
If txtFechaI.Text <> "" Then StrFiltro.AppendFormat("&emsp;<b>Fecha Inicio </b>: {0}", txtFechaI.Text.ToDate.ToShortDateString) If txtFechaI.Text <> "" Then StrFiltro.AppendFormat("&emsp;<b>Fecha Inicio </b>: {0}", txtFechaI.Text.ToDate.ToShortDateString)
If txtFechaF.Text <> "" Then StrFiltro.AppendFormat("&emsp;<b>Fecha Fin </b>: {0}", txtFechaF.Text.ToDate.ToShortDateString) If txtFechaF.Text <> "" Then StrFiltro.AppendFormat("&emsp;<b>Fecha Fin </b>: {0}", txtFechaF.Text.ToDate.ToShortDateString)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
'Dim dt As DataTable = DtVentas.FiltraParametros("", "Orden") '.FiltraParametros("Total > 0", DistinctColumns:={"GPO", "Cantidad", "SubTotal", "Descuento", "Amortizacion", "IVA", "Total"}) 'Dim dt As DataTable = DtVentas.FiltraParametros("", "Orden") '.FiltraParametros("Total > 0", DistinctColumns:={"GPO", "Cantidad", "SubTotal", "Descuento", "Amortizacion", "IVA", "Total"})
Dim FechaI, FechaF As String Dim FechaI, FechaF As String
FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text) FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text)
FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text) FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text)
Dim params As New List(Of ReportParameter) Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("FechaInicio", FechaI)) params.Add(New ReportParameter("FechaInicio", FechaI))
params.Add(New ReportParameter("FechaFin", FechaF)) params.Add(New ReportParameter("FechaFin", FechaF))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
params.Add(New ReportParameter("Filtros", StrFiltro.ToString)) params.Add(New ReportParameter("Filtros", StrFiltro.ToString))
If Imagen.Exists Then If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri)) params.Add(New ReportParameter("LogoPath", logouri))
Else Else
params.Add(New ReportParameter("LogoPath", "")) params.Add(New ReportParameter("LogoPath", ""))
End If End If
ImprimirPDF("Empresas/Grales/Formatos/RepNotasCredito.rdlc", DtDatos, params, String.Format("ReporteVentas-{0}", Now.ToDateTime.ToShortDateString), Formato:=Formato) ImprimirPDF("Empresas/Grales/Formatos/RepNotasCredito.rdlc", DtDatos, params, String.Format("ReporteVentas-{0}", Now.ToDateTime.ToShortDateString), Formato:=Formato)
Else Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia) Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If End If
End Sub End Sub
Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click
GenerarPDF() GenerarPDF()
End Sub End Sub
Private Sub LnkHabilitarSaldar_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldar.Click Private Sub LnkHabilitarSaldar_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldar.Click
For Each gr As GridViewRow In GvDatos.Rows For Each gr As GridViewRow In GvDatos.Rows
If gr.DataKey("CveCompra") <> "" Then If gr.DataKey("CveCompra") <> "" Then
gr.FCCheckBox("Chk").Visible = True gr.FCCheckBox("Chk").Visible = True
HLSaldar.Visible = True HLSaldar.Visible = True
LnkHabilitarSaldar.Visible = False LnkHabilitarSaldar.Visible = False
UpDatos.Update() UpDatos.Update()
End If End If
Next Next
End Sub End Sub
Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs) Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs)
Dim ObjConta As New ClsContabilidad Dim ObjConta As New ClsContabilidad
ObjConta.IniciaTransacSQL() ObjConta.IniciaTransacSQL()
Dim CvePrePoliza As Integer = 0 Dim CvePrePoliza As Integer = 0
Dim MsgError As String = "" Dim MsgError As String = ""
Dim IdCtaContable As Integer = 0 Dim IdCtaContable As Integer = 0
Dim IdCtaContableComplementaria As Integer = 0 Dim IdCtaContableComplementaria As Integer = 0
Dim Importe As Decimal = 0 Dim Importe As Decimal = 0
Dim ImporteMN As Decimal = 0 Dim ImporteMN As Decimal = 0
Dim ImporteComplementaria As Decimal = 0 Dim ImporteComplementaria As Decimal = 0
Dim CveMoneda As Integer = 0 Dim CveMoneda As Integer = 0
Dim TC As Decimal = GlobalTipoCambio(TxtFechaSaldar.Text.ToDate).ToDecimal Dim TC As Decimal = GlobalTipoCambio(TxtFechaSaldar.Text.ToDate).ToDecimal
Dim TCCompra As Decimal = 0 Dim TCCompra As Decimal = 0
Dim Concepto As String = TxtConcepto.Text Dim Concepto As String = TxtConcepto.Text
Dim UsaComplementaria As Boolean = UsuarioActual.CveEmpresa.Contiene(119) Dim UsaComplementaria As Boolean = UsuarioActual.CveEmpresa.Contiene(119)
Dim MensajeAlert = New StringBuilder Dim MensajeAlert = New StringBuilder
For Each gr As GridViewRow In GvDatos.Rows For Each gr As GridViewRow In GvDatos.Rows
If gr.FCCheckBox("Chk").Checked Then If gr.FCCheckBox("Chk").Checked Then
IdCtaContable = 0 IdCtaContable = 0
IdCtaContableComplementaria = 0 IdCtaContableComplementaria = 0
Importe = gr.DataKey("Saldo").ToDecimal.RoundSQL Importe = gr.DataKey("Saldo").ToDecimal.RoundSQL
ImporteMN = gr.DataKey("Saldo").ToDecimal.RoundSQL ImporteMN = gr.DataKey("Saldo").ToDecimal.RoundSQL
TCCompra = gr.DataKey("TipoCambio").ToDecimal TCCompra = gr.DataKey("TipoCambio").ToDecimal
CveMoneda = gr.DataKey("CveMoneda").ToEntero CveMoneda = gr.DataKey("CveMoneda").ToEntero
CvePrePoliza = ObjConta.AddPrePolizas("Compras/RepNotasCredito", 103, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, Now, "Saldado manual", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrePoliza = ObjConta.AddPrePolizas("Compras/RepNotasCredito", 103, gr.DataKey("Saldo").ToDecimal, gr.DataKey("Saldo").ToDecimal, gr.DataKey("CveMoneda").ToEntero, Now, "Saldado manual", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CveMoneda > 1 Then If CveMoneda > 1 Then
IdCtaContable = gr.DataKey("IdCtaContExtranjera").ToEntero IdCtaContable = gr.DataKey("IdCtaContExtranjera").ToEntero
ImporteMN = (gr.DataKey("Saldo").ToDecimal * TCCompra).RoundSQL ImporteMN = (gr.DataKey("Saldo").ToDecimal * TCCompra).RoundSQL
Else Else
IdCtaContable = gr.DataKey("IdCtaContProveedores").ToEntero IdCtaContable = gr.DataKey("IdCtaContProveedores").ToEntero
End If End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -Importe, "", 18, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, ImporteMX:=-If(CveMoneda > 1 AndAlso UsaComplementaria, Importe, ImporteMN), ImporteME:=-If(CveMoneda > 1, Importe, 0), CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra) Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -Importe, "", 18, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, ImporteMX:=-If(CveMoneda > 1 AndAlso UsaComplementaria, Importe, ImporteMN), ImporteME:=-If(CveMoneda > 1, Importe, 0), CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, TipoCambio:=TCCompra) Then
MsgError = "Ocurrio un Error al saldar el movimiento" MsgError = "Ocurrio un Error al saldar el movimiento"
End If End If
If UsaComplementaria AndAlso CveMoneda > 1 Then If UsaComplementaria AndAlso CveMoneda > 1 Then
ImporteComplementaria = (Importe * TCCompra - Importe).RoundSQL ImporteComplementaria = (Importe * TCCompra - Importe).RoundSQL
IdCtaContableComplementaria = gr.DataKey("IdCtaContComplementaria").ToEntero IdCtaContableComplementaria = gr.DataKey("IdCtaContComplementaria").ToEntero
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -ImporteComplementaria, "", 235, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContableComplementaria, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=-ImporteComplementaria, ImporteME:=-ImporteComplementaria, TipoCambioPago:=TC, TipoCambio:=TCCompra) Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, -ImporteComplementaria, "", 235, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContableComplementaria, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveCompraAmortizacion:=gr.DataKey("CveCompra").ToEntero, CvePersonal:=gr.DataKey("CvePersonal").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=-ImporteComplementaria, ImporteME:=-ImporteComplementaria, TipoCambioPago:=TC, TipoCambio:=TCCompra) Then
MsgError = "Ocurrio un Error al saldar el movimiento" MsgError = "Ocurrio un Error al saldar el movimiento"
End If End If
End If End If
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(564).ToString.ToEntero IdCtaContable = UsuarioActual.Empresa.Funcionalidad(564).ToString.ToEntero
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, "", 211, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, ImporteMX:=If(CveMoneda > 1, (Importe * TC), Importe).RoundSQL, CveCuenta:=-1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero) Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, "", 211, Concepto, TxtFechaSaldar.Text.ToDate, IdCtaContable, -1, gr.DataKey("CveIE").ToEntero, ImporteMX:=If(CveMoneda > 1, (Importe * TC), Importe).RoundSQL, CveCuenta:=-1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero) Then
MsgError = "Ocurrio un Error al saldar el movimiento" MsgError = "Ocurrio un Error al saldar el movimiento"
End If End If
If TC <> TCCompra AndAlso CveMoneda > 1 AndAlso UsaComplementaria Then If TC <> TCCompra AndAlso CveMoneda > 1 AndAlso UsaComplementaria Then
Dim difFluctuacion As Decimal = TC - TCCompra Dim difFluctuacion As Decimal = TC - TCCompra
Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida
Dim TipoMovtoFluctua As Boolean = True Dim TipoMovtoFluctua As Boolean = True
Dim IdCtaContableFluctua As Integer Dim IdCtaContableFluctua As Integer
Dim CveCuenta As Integer = 0 Dim CveCuenta As Integer = 0
If difFluctuacion < 0 Then If difFluctuacion < 0 Then
CveConceptoFluctua = 65 CveConceptoFluctua = 65
TipoMovtoFluctua = False TipoMovtoFluctua = False
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria
Else Else
CveConceptoFluctua = 64 CveConceptoFluctua = 64
TipoMovtoFluctua = True TipoMovtoFluctua = True
IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria
End If End If
Dim ImporteFluctuacion As Decimal = Math.Abs((Importe * difFluctuacion).RoundSQL) Dim ImporteFluctuacion As Decimal = Math.Abs((Importe * difFluctuacion).RoundSQL)
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, "", CveConceptoFluctua, Concepto, Now, IdCtaContableFluctua, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, TipoCambio:=TCCompra, TipoCambioPago:=TC, CveCuenta:=CveCuenta) Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, "", CveConceptoFluctua, Concepto, Now, IdCtaContableFluctua, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, TipoCambio:=TCCompra, TipoCambioPago:=TC, CveCuenta:=CveCuenta) Then
MsgError = "Ocurrio un Error al saldar el movimiento" MsgError = "Ocurrio un Error al saldar el movimiento"
End If End If
End If End If
If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then
If ObjConta.ValorPolizaDescuadre > 0 Then If ObjConta.ValorPolizaDescuadre > 0 Then
MsgError = ObjConta.MensajePolizaDescuadre MsgError = ObjConta.MensajePolizaDescuadre
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
End If End If
End If End If
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
If MensajeAlert.ToString = "" Then If MensajeAlert.ToString = "" Then
MensajeAlert.AppendFormat("Los siguientes movimientos fueron saldados correctamente: <br/>") MensajeAlert.AppendFormat("Los siguientes movimientos fueron saldados correctamente: <br/>")
End If End If
MensajeAlert.AppendFormat("<ul><li><a Class=""Texto"" href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Poliza {1}</a></li></ul>", ObjConta.ContaIdPoliza, ObjConta.ContaFolio) MensajeAlert.AppendFormat("<ul><li><a Class=""Texto"" href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Poliza {1}</a></li></ul>", ObjConta.ContaIdPoliza, ObjConta.ContaFolio)
End If End If
End If End If
If MsgError <> "" Then Exit For If MsgError <> "" Then Exit For
End If End If
Next Next
If MsgError = "" Then If MsgError = "" Then
ObjConta.Commit() ObjConta.Commit()
If MensajeAlert.ToString <> "" Then If MensajeAlert.ToString <> "" Then
Alert(MensajeAlert.ToString) Alert(MensajeAlert.ToString)
Else Else
Alert("Los movimientos fueron saldados correctamente.") Alert("Los movimientos fueron saldados correctamente.")
End If End If
Alert(MensajeAlert.ToString) Alert(MensajeAlert.ToString)
CargaDatos() CargaDatos()
HLSaldar.Visible = False HLSaldar.Visible = False
RegistraScript("$('#DivSaldar').modal('hide')") RegistraScript("$('#DivSaldar').modal('hide')")
LnkHabilitarSaldar.Visible = True LnkHabilitarSaldar.Visible = True
Else Else
ObjConta.RollBack() ObjConta.RollBack()
Alert(MsgError, TipoMensaje.MsgError) Alert(MsgError, TipoMensaje.MsgError)
End If End If
ObjConta.Dispose() ObjConta.Dispose()
End Sub End Sub
Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs) Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs)
End Sub End Sub
#Region "O R D E N A M I E N T O" #Region "O R D E N A M I E N T O"
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs) Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim Orden As String = "" Dim Orden As String = ""
Dim Campo As String = "" Dim Campo As String = ""
Dim Literal As Literal = Nothing Dim Literal As Literal = Nothing
Const OrdenInicial As String = "" Const OrdenInicial As String = ""
Dim Arg(2) As String Dim Arg(2) As String
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
Campo = Arg(0) Campo = Arg(0)
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(", ", "_")), Literal) Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(", ", "_")), Literal)
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>") Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
Else Else
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo) ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>") Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
End If End If
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
ViewState("Orden") = Orden ViewState("Orden") = Orden
CargaGrid(Orden) CargaGrid(Orden)
End Sub End Sub
Protected Sub CargaGrid(Orden As String) Protected Sub CargaGrid(Orden As String)
Dim DV As DataView = Nothing Dim DV As DataView = Nothing
DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows) DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows)
If Orden <> String.Empty Then If Orden <> String.Empty Then
GvDatos.DataSource = DV.ToTable() GvDatos.DataSource = DV.ToTable()
Else Else
GvDatos.DataSource = DtDatos GvDatos.DataSource = DtDatos
End If End If
GvDatos.DataBind() GvDatos.DataBind()
UpDatos.Update() UpDatos.Update()
DV.Dispose() DV.Dispose()
End Sub End Sub
#End Region #End Region
End Class End Class

View File

@@ -1,268 +1,268 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIVA.aspx.cs" Inherits="Contabilidad_RepIVA" %> <%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIVA.aspx.cs" Inherits="Contabilidad_RepIVA" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server"> <asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style> <style>
.truncate2 { .truncate2 {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width:100px; max-width:100px;
} }
</style> </style>
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Reporte de Impuestos Reporte de Impuestos
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
<li> <li>
<asp:LinkButton ID="LnkPdf" OnClick="LnkPdf_Click" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> PDF</asp:LinkButton> <asp:LinkButton ID="LnkPdf" OnClick="LnkPdf_Click" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> PDF</asp:LinkButton>
</li> </li>
<li> <li>
<asp:LinkButton ID="LnkExcel" OnClick="LnkExcel_Click" runat="server"><i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Excel</asp:LinkButton> <asp:LinkButton ID="LnkExcel" OnClick="LnkExcel_Click" runat="server"><i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Excel</asp:LinkButton>
</li> </li>
<li> <li>
<asp:HyperLink NavigateUrl="javascript:;" data-toggle="modal" data-target="#DivTipoCambio" ID="ImgTipoCambio" runat="server"> <i class="fa fa-money"></i> Ver Dlls en pesos</asp:HyperLink> <asp:HyperLink NavigateUrl="javascript:;" data-toggle="modal" data-target="#DivTipoCambio" ID="ImgTipoCambio" runat="server"> <i class="fa fa-money"></i> Ver Dlls en pesos</asp:HyperLink>
</li> </li>
<asp:UpdatePanel runat="server" ID="UpAccionesDIOT" UpdateMode="Conditional" > <asp:UpdatePanel runat="server" ID="UpAccionesDIOT" UpdateMode="Conditional" >
<ContentTemplate> <ContentTemplate>
<li> <li>
<asp:LinkButton ID="LnkAccionesDIOT" OnClick="LnkAccionesDIOT_Click" runat="server" Visible="false"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Generar DIOT</asp:LinkButton> <asp:LinkButton ID="LnkAccionesDIOT" OnClick="LnkAccionesDIOT_Click" runat="server" Visible="false"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Generar DIOT</asp:LinkButton>
</li> </li>
</ContentTemplate> </ContentTemplate>
<Triggers> <Triggers>
<asp:PostBackTrigger ControlID="LnkAccionesDIOT" /> <asp:PostBackTrigger ControlID="LnkAccionesDIOT" />
</Triggers> </Triggers>
</asp:UpdatePanel> </asp:UpdatePanel>
</asp:Content> </asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server"> <asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server"> <asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server"> <asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPPFiltros" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter"> <div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle"> <div class="portlet-title portlet-filterT smalltitle">
<div class="tools"> <div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" OnClick="BtnConsultar_Click" CssClass="btn btn-primary" /> <asp:Button ID="BtnConsultar" runat="server" Text="Consultar" OnClick="BtnConsultar_Click" CssClass="btn btn-primary" />
</div> </div>
<div class="titlefiltros caption "> <div class="titlefiltros caption ">
<div class="row"> <div class="row">
<label class="col-md-1 truncate">Fecha Inicio:</label> <label class="col-md-1 truncate">Fecha Inicio:</label>
<div class="col-md-2"> <div class="col-md-2">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;"> <div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control" Width="99%" CausesValidation="true" MaxLength="10"></asp:TextBox> <asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control" Width="99%" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn "> <span class="input-group-btn ">
<asp:LinkButton ID="ImgCalendarioI" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton> <asp:LinkButton ID="ImgCalendarioI" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span> </span>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender> <ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender1" TargetControlID="txtFechaI" PopupButtonID="ImgCalendarioI" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender> <ajax:CalendarExtender runat="server" ID="CalendarExtender1" TargetControlID="txtFechaI" PopupButtonID="ImgCalendarioI" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator> <asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
&nbsp; &nbsp;
</div> </div>
</div> </div>
<label class="col-md-1 truncate">Fecha Fin:</label> <label class="col-md-1 truncate">Fecha Fin:</label>
<div class="col-md-2"> <div class="col-md-2">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;"> <div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control" Width="99%" CausesValidation="true" MaxLength="10"></asp:TextBox> <asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control" Width="99%" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn "> <span class="input-group-btn ">
<asp:LinkButton ID="imgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton> <asp:LinkButton ID="imgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span> </span>
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender> <ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender> <ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator> <asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
</div> </div>
</div> </div>
<label class="col-md-1 truncate">Tipo Movto:</label> <label class="col-md-1 truncate">Tipo Movto:</label>
<div class="col-md-2"> <div class="col-md-2">
<asp:DropDownList ID="DdlTipoMovto" runat="server"> <asp:DropDownList ID="DdlTipoMovto" runat="server">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem> <asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Conciliados" Value="1"></asp:ListItem> <asp:ListItem Text="Conciliados" Value="1"></asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="portlet-body"> <div class="portlet-body">
</div> </div>
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<ajax:TabContainer ID="TT" runat="server" ActiveTabIndex="0" Width="100%"> <ajax:TabContainer ID="TT" runat="server" ActiveTabIndex="0" Width="100%">
<ajax:TabPanel ID="TTr" runat="server" HeaderText="IVA Trasladado"> <ajax:TabPanel ID="TTr" runat="server" HeaderText="IVA Trasladado">
<ContentTemplate> <ContentTemplate>
<div class="row"> <div class="row">
<h4><b>IVA Trasladado</b></h4> <h4><b>IVA Trasladado</b></h4>
<asp:GridView ID="GvT" runat="server" EmptyDataText="No se encontraron datos con los filtros seleccionados" OnRowDataBound="GvIVATrasladado_RowDataBound" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="99%" GridLines="None" AutoGenerateColumns="false"> <asp:GridView ID="GvT" runat="server" EmptyDataText="No se encontraron datos con los filtros seleccionados" OnRowDataBound="GvIVATrasladado_RowDataBound" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="99%" GridLines="None" AutoGenerateColumns="false">
<Columns> <Columns>
<asp:BoundField HeaderText="Docto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField HeaderText="Docto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Fecha Documento" DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField HeaderText="Fecha Documento" DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" HeaderText="Folio" ControlStyle-Width="85px" /> <asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" HeaderText="Folio" ControlStyle-Width="85px" />
<asp:BoundField HeaderText="SubTotal" DataField="SubTotal" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="SubTotal" DataField="SubTotal" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="%IVA" DataField="PorcentajeIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="%IVA" DataField="PorcentajeIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="RetIVA" DataField="RetIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="RetIVA" DataField="RetIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="RetISR" DataField="RetISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="RetISR" DataField="RetISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:HyperLinkField HeaderText="Cliente" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" DataTextField="Nombre" ControlStyle-CssClass="truncate2" /> <asp:HyperLinkField HeaderText="Cliente" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" DataTextField="Nombre" ControlStyle-CssClass="truncate2" />
<asp:HyperLinkField HeaderText="Folio Bancario" DataNavigateUrlFields="CveIE" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" DataTextField="FolioIE" Target="_blank" /> <asp:HyperLinkField HeaderText="Folio Bancario" DataNavigateUrlFields="CveIE" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" DataTextField="FolioIE" Target="_blank" />
<asp:BoundField HeaderText="Num. Cuenta" DataField="NumCuenta" ItemStyle-CssClass="truncate2" /> <asp:BoundField HeaderText="Num. Cuenta" DataField="NumCuenta" ItemStyle-CssClass="truncate2" />
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>
<br /> <br />
<div class="row"> <div class="row">
<div id="DvTipo" class="col-md-6"> <div id="DvTipo" class="col-md-6">
<h4><b>IEPS por Porcentaje</b></h4> <h4><b>IEPS por Porcentaje</b></h4>
<asp:GridView ID="GvIEPSA" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false"> <asp:GridView ID="GvIEPSA" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false">
<Columns> <Columns>
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIEPS" /> <asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIEPS" />
<asp:BoundField HeaderText="Categoria" DataField="Categoria" /> <asp:BoundField HeaderText="Categoria" DataField="Categoria" />
<asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<h4><b>IVA por Porcentaje</b></h4> <h4><b>IVA por Porcentaje</b></h4>
<asp:GridView ID="GvIVAA" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false"> <asp:GridView ID="GvIVAA" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false">
<Columns> <Columns>
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIVA" /> <asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIVA" />
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>
</div> </div>
<br /> <br />
</ContentTemplate> </ContentTemplate>
</ajax:TabPanel> </ajax:TabPanel>
<ajax:TabPanel ID="TA" runat="server" HeaderText="IVA Acreditable"> <ajax:TabPanel ID="TA" runat="server" HeaderText="IVA Acreditable">
<ContentTemplate> <ContentTemplate>
<h4><b>IVA Acreditable</b></h4> <h4><b>IVA Acreditable</b></h4>
<asp:Label ID="LblMsgAcreditable" runat="server" Text="" ForeColor="Red"></asp:Label> <asp:Label ID="LblMsgAcreditable" runat="server" Text="" ForeColor="Red"></asp:Label>
<asp:GridView ID="GvA" runat="server" EmptyDataText="No se encontraron datos con los filtros seleccionados" OnRowDataBound="GvIVAAcreditable_RowDataBound" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="99%" GridLines="None" AutoGenerateColumns="false"> <asp:GridView ID="GvA" runat="server" EmptyDataText="No se encontraron datos con los filtros seleccionados" OnRowDataBound="GvIVAAcreditable_RowDataBound" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="99%" GridLines="None" AutoGenerateColumns="false">
<Columns> <Columns>
<asp:BoundField HeaderText="Docto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField HeaderText="Docto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="RFC" DataField="RFC" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField HeaderText="RFC" DataField="RFC" ItemStyle-HorizontalAlign="Center" />
<asp:HyperLinkField HeaderText="Proveedor" DataNavigateUrlFields="CveProveedor" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataTextField="RazonSocial" ControlStyle-CssClass="truncate2" /> <asp:HyperLinkField HeaderText="Proveedor" DataNavigateUrlFields="CveProveedor" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataTextField="RazonSocial" ControlStyle-CssClass="truncate2" />
<asp:BoundField HeaderText="Fecha Documento" DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField HeaderText="Fecha Documento" DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveCompra" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" HeaderText="Folio" /> <asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveCompra" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" HeaderText="Folio" />
<asp:BoundField HeaderText="SubTotal 16%" DataField="valorActos1516" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="SubTotal 16%" DataField="valorActos1516" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="SubTotal 8%" DataField="valorActosImp8" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="SubTotal 8%" DataField="valorActosImp8" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="SubTotal 0%" DataField="valorActosImp0" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="SubTotal 0%" DataField="valorActosImp0" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="%IVA" DataField="PorcentajeIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="%IVA" DataField="PorcentajeIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:TemplateField ItemStyle-HorizontalAlign="Right"> <asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate> <HeaderTemplate>
<asp:Label ID="LblHRetIVAHon" data-toggle="tooltip" data-placement="top" ToolTip="Ret IVA Honorario/Serv. Prof." runat="server">RetIVA <br/>Hon/Ser.Prof.</asp:Label> <asp:Label ID="LblHRetIVAHon" data-toggle="tooltip" data-placement="top" ToolTip="Ret IVA Honorario/Serv. Prof." runat="server">RetIVA <br/>Hon/Ser.Prof.</asp:Label>
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:Label ID="LblRetIVAHon" runat="server" Text='<%# Eval("RetIVAHonorario", "{0:N2}") %>'></asp:Label> <asp:Label ID="LblRetIVAHon" runat="server" Text='<%# Eval("RetIVAHonorario", "{0:N2}") %>'></asp:Label>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField HeaderText="RetIVA <br/> Fletes P.F" HtmlEncode="False" DataField="RetIVAFletePF" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="RetIVA <br/> Fletes P.F" HtmlEncode="False" DataField="RetIVAFletePF" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="RetIVA <br/> Fletes P.M." HtmlEncode="False" DataField="RetIVAFletePM" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="RetIVA <br/> Fletes P.M." HtmlEncode="False" DataField="RetIVAFletePM" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="RetIVA <br/> Arrenda." HtmlEncode="False" DataField="RetIVAArrend" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="RetIVA <br/> Arrenda." HtmlEncode="False" DataField="RetIVAArrend" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="RetISR <br/> Honorario" HtmlEncode="False" DataField="RetISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="RetISR <br/> Honorario" HtmlEncode="False" DataField="RetISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="RetISR <br/> Arrendamiento" HtmlEncode="False" DataField="RetISRArrend" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="RetISR <br/> Arrendamiento" HtmlEncode="False" DataField="RetISRArrend" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<%-- <asp:BoundField HeaderText="IEPS 3%" DataField="IEPS3" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <%-- <asp:BoundField HeaderText="IEPS 3%" DataField="IEPS3" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IEPS 6%" DataField="IEPS6" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IEPS 6%" DataField="IEPS6" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IEPS 7%" DataField="IEPS7" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IEPS 7%" DataField="IEPS7" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IEPS 9%" DataField="IEPS9" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />--%> <asp:BoundField HeaderText="IEPS 9%" DataField="IEPS9" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />--%>
<asp:HyperLinkField HeaderText="Folio Bancario" DataNavigateUrlFields="CveIE" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" DataTextField="FolioIE" Target="_blank" /> <asp:HyperLinkField HeaderText="Folio Bancario" DataNavigateUrlFields="CveIE" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" DataTextField="FolioIE" Target="_blank" />
<asp:BoundField HeaderText="Num. Cuenta" DataField="NumCuenta" ItemStyle-CssClass ="truncate2"/> <asp:BoundField HeaderText="Num. Cuenta" DataField="NumCuenta" ItemStyle-CssClass ="truncate2"/>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
<div class="row"> <div class="row">
<h4><b>IVA por Porcentaje</b></h4> <h4><b>IVA por Porcentaje</b></h4>
<asp:GridView ID="GvIVA2" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false"> <asp:GridView ID="GvIVA2" runat="server" EmptyDataText="" CssClass="table table-hover table-striped ScrollAD mysmallbtn" data-sort="true" Width="400px" GridLines="None" AutoGenerateColumns="false">
<Columns> <Columns>
<asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIVA" /> <asp:BoundField HeaderText="Porcentaje" DataField="PorcentajeIVA" />
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Base" DataField="Base" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>
</ContentTemplate> </ContentTemplate>
</ajax:TabPanel> </ajax:TabPanel>
</ajax:TabContainer> </ajax:TabContainer>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="UpTipoCambio" UpdateMode="Conditional"> <asp:UpdatePanel runat="server" ID="UpTipoCambio" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div id="DivTipoCambio" class="modal fade" role="dialog"> <div id="DivTipoCambio" class="modal fade" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button> <button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"> <h4 class="modal-title">
<asp:Label ID="Label2" runat="server" ClientIDMode="Static" Text="Cambiar Tipo Cambio de Dólares"></asp:Label> <asp:Label ID="Label2" runat="server" ClientIDMode="Static" Text="Cambiar Tipo Cambio de Dólares"></asp:Label>
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<asp:UpdatePanel runat="server" ID="UpBodyTipoCambio" UpdateMode="Conditional"> <asp:UpdatePanel runat="server" ID="UpBodyTipoCambio" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<asp:RadioButtonList runat="server" ID="RblTipoCambio" OnSelectedIndexChanged="RblTipoCambio_SelectedIndexChanged" AutoPostBack="true"> <asp:RadioButtonList runat="server" ID="RblTipoCambio" OnSelectedIndexChanged="RblTipoCambio_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem Selected="true" Text="Moneda Original" Value="1"></asp:ListItem> <asp:ListItem Selected="true" Text="Moneda Original" Value="1"></asp:ListItem>
<asp:ListItem Text="Dólares en Tipo Cambio de la Fecha Venta" Value="2"></asp:ListItem> <asp:ListItem Text="Dólares en Tipo Cambio de la Fecha Venta" Value="2"></asp:ListItem>
<asp:ListItem Text="Tipo Cambio Especifico" Value="3"></asp:ListItem> <asp:ListItem Text="Tipo Cambio Especifico" Value="3"></asp:ListItem>
</asp:RadioButtonList> </asp:RadioButtonList>
<div class="row" style="margin-left: 10px;" runat="server" id="LiEspecifico" visible="false"> <div class="row" style="margin-left: 10px;" runat="server" id="LiEspecifico" visible="false">
Especifico: Especifico:
<asp:TextBox ID="TxtEspecifico" runat="server" Width="55px" /> <asp:TextBox ID="TxtEspecifico" runat="server" Width="55px" />
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<asp:Button ID="BtnTipoCambio" runat="server" OnClick="BtnTipoCambio_Click" Text="Aceptar" class="btn btn-primary" /> <asp:Button ID="BtnTipoCambio" runat="server" OnClick="BtnTipoCambio_Click" Text="Aceptar" class="btn btn-primary" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button> <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</asp:Content> </asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
</asp:Content> </asp:Content>

View File

@@ -1,316 +1,316 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web; using System.Web;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using Extensiones; using Extensiones;
using System.Data; using System.Data;
using static Extensiones.ModExtensiones; using static Extensiones.ModExtensiones;
using Microsoft.Reporting.WebForms; using Microsoft.Reporting.WebForms;
using System.Activities.Expressions; using System.Activities.Expressions;
using System.Text; using System.Text;
using System.IO; using System.IO;
public partial class Contabilidad_RepIVA : ClsPaginas public partial class Contabilidad_RepIVA : ClsPaginas
{ {
#region PROPIEDADES #region PROPIEDADES
private DataTable DtIVATrasladado private DataTable DtIVATrasladado
{ {
get { return DtIVATrasladado = (DataTable)ViewState["DtIVATrasladado"]; } get { return DtIVATrasladado = (DataTable)ViewState["DtIVATrasladado"]; }
set { ViewState["DtIVATrasladado"] = value; } set { ViewState["DtIVATrasladado"] = value; }
} }
private DataTable DtIVAAcreditable private DataTable DtIVAAcreditable
{ {
get { return DtIVAAcreditable = (DataTable)ViewState["DtIVAAcreditable"]; } get { return DtIVAAcreditable = (DataTable)ViewState["DtIVAAcreditable"]; }
set { ViewState["DtIVAAcreditable"] = value; } set { ViewState["DtIVAAcreditable"] = value; }
} }
private double TCEspecifico private double TCEspecifico
{ {
get { return TCEspecifico = (double)ViewState["TCEspecifico"]; } get { return TCEspecifico = (double)ViewState["TCEspecifico"]; }
set { ViewState["TCEspecifico"] = value; } set { ViewState["TCEspecifico"] = value; }
} }
private int TipoCambio private int TipoCambio
{ {
get { return TipoCambio = (int)ViewState["TipoCambio"]; } get { return TipoCambio = (int)ViewState["TipoCambio"]; }
set { ViewState["TipoCambio"] = value; } set { ViewState["TipoCambio"] = value; }
} }
#endregion #endregion
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
if (!IsPostBack) if (!IsPostBack)
{ {
InicializaValores(); InicializaValores();
} }
} }
public void InicializaValores() public void InicializaValores()
{ {
TipoCambio = 1; TipoCambio = 1;
TCEspecifico = -1; TCEspecifico = -1;
txtFechaI.Text = $"01/{DateTime.Now.Month}/{DateTime.Now.Year}"; txtFechaI.Text = $"01/{DateTime.Now.Month}/{DateTime.Now.Year}";
txtFechaF.Text = DateTime.Now.ToShortDateString(); txtFechaF.Text = DateTime.Now.ToShortDateString();
LnkAccionesDIOT.Visible = true; LnkAccionesDIOT.Visible = true;
} }
public void Consulta() public void Consulta()
{ {
if (TipoCambio == 3 && TxtEspecifico.Text != "") { TCEspecifico = TxtEspecifico.Text.ToDouble(); } else { TCEspecifico = -1; } if (TipoCambio == 3 && TxtEspecifico.Text != "") { TCEspecifico = TxtEspecifico.Text.ToDouble(); } else { TCEspecifico = -1; }
int Conciliado = DdlTipoMovto.SelectedValue.ToEntero(); int Conciliado = DdlTipoMovto.SelectedValue.ToEntero();
LblMsgAcreditable.Text = ""; // lbl de mensajes de negativos LblMsgAcreditable.Text = ""; // lbl de mensajes de negativos
ClsContabilidad ObjCont = new ClsContabilidad(); ClsContabilidad ObjCont = new ClsContabilidad();
if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico))
{ {
GvT.DataSource = ObjCont.DtResultados; GvT.DataSource = ObjCont.DtResultados;
DtIVATrasladado = ObjCont.DtResultados; DtIVATrasladado = ObjCont.DtResultados;
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
{ {
GvIEPSA.DataSource = ObjCont.DtResultados; GvIEPSA.DataSource = ObjCont.DtResultados;
} }
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
{ {
GvIVAA.DataSource = ObjCont.DtResultados; GvIVAA.DataSource = ObjCont.DtResultados;
} }
} }
if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico))
{ {
GvA.DataSource = ObjCont.DtResultados; GvA.DataSource = ObjCont.DtResultados;
DtIVAAcreditable = ObjCont.DtResultados; DtIVAAcreditable = ObjCont.DtResultados;
if (DtIVAAcreditable.FiltraParametros("IVA < 0 OR IEPS < 0 ").Rows.Count > 0) if (DtIVAAcreditable.FiltraParametros("IVA < 0 OR IEPS < 0 ").Rows.Count > 0)
{ {
LblMsgAcreditable.Text = "La información presenta importes en negativo, estos no se incluirán en el archivo generado para DIOT"; LblMsgAcreditable.Text = "La información presenta importes en negativo, estos no se incluirán en el archivo generado para DIOT";
} }
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
{ {
GvIVA2.DataSource = ObjCont.DtResultados; GvIVA2.DataSource = ObjCont.DtResultados;
} }
} }
ObjCont.Dispose(); ObjCont.Dispose();
GvT.DataBind(); GvT.DataBind();
GvA.DataBind(); GvA.DataBind();
GvIEPSA.DataBind(); GvIEPSA.DataBind();
GvIVAA.DataBind(); GvIVAA.DataBind();
GvIVA2.DataBind(); GvIVA2.DataBind();
UpDatos.Update(); UpDatos.Update();
} }
protected void BtnConsultar_Click(object sender, EventArgs e) protected void BtnConsultar_Click(object sender, EventArgs e)
{ {
Consulta(); Consulta();
} }
protected void GvIVATrasladado_RowDataBound(object sender, GridViewRowEventArgs e) protected void GvIVATrasladado_RowDataBound(object sender, GridViewRowEventArgs e)
{ {
if (e.Row.RowType == DataControlRowType.DataRow) if (e.Row.RowType == DataControlRowType.DataRow)
{ {
if (e.Row.DBCampo("CveVenta").ToEntero() < 1) if (e.Row.DBCampo("CveVenta").ToEntero() < 1)
{ {
e.Row.CssClass = "Totales"; e.Row.CssClass = "Totales";
} }
} }
} }
protected void GvIVAAcreditable_RowDataBound(object sender, GridViewRowEventArgs e) protected void GvIVAAcreditable_RowDataBound(object sender, GridViewRowEventArgs e)
{ {
if (e.Row.RowType == DataControlRowType.DataRow) if (e.Row.RowType == DataControlRowType.DataRow)
{ {
if (e.Row.DBCampo("CveCompra").ToEntero() < 1) if (e.Row.DBCampo("CveCompra").ToEntero() < 1)
{ {
e.Row.CssClass = "Totales"; e.Row.CssClass = "Totales";
} }
if (e.Row.DBCampo("PorcentajeIVA").ToDecimal() > 0 ) if (e.Row.DBCampo("PorcentajeIVA").ToDecimal() > 0 )
{ {
Decimal SubTotal = (e.Row.DBCampo("SubTotal16").ToDecimal() > 0? e.Row.DBCampo("SubTotal16").ToDecimal() : (e.Row.DBCampo("SubTotal8").ToDecimal() > 0? e.Row.DBCampo("SubTotal8").ToDecimal() : (Decimal)0.0) ); Decimal SubTotal = (e.Row.DBCampo("SubTotal16").ToDecimal() > 0? e.Row.DBCampo("SubTotal16").ToDecimal() : (e.Row.DBCampo("SubTotal8").ToDecimal() > 0? e.Row.DBCampo("SubTotal8").ToDecimal() : (Decimal)0.0) );
Decimal dif = Math.Round(SubTotal * e.Row.DBCampo("PorcentajeIVA").ToDecimal(), 2) - Math.Round(e.Row.DBCampo("IVA").ToDecimal(), 2); Decimal dif = Math.Round(SubTotal * e.Row.DBCampo("PorcentajeIVA").ToDecimal(), 2) - Math.Round(e.Row.DBCampo("IVA").ToDecimal(), 2);
if (dif > 1) if (dif > 1)
{ {
e.Row.ForeColor = System.Drawing.Color.Red; e.Row.ForeColor = System.Drawing.Color.Red;
e.Row.Cells[0].Text = e.Row.Cells[0].Text + "Err"; e.Row.Cells[0].Text = e.Row.Cells[0].Text + "Err";
e.Row.ToolTip = "Dif:" + dif.ToString() + "- Sub:" + e.Row.DBCampo("SubTotal")+ " - IVA:"+ e.Row.DBCampo("IVA"); e.Row.ToolTip = "Dif:" + dif.ToString() + "- Sub:" + e.Row.DBCampo("SubTotal")+ " - IVA:"+ e.Row.DBCampo("IVA");
} }
} }
} }
} }
protected void LnkPdf_Click(object sender, EventArgs e) protected void LnkPdf_Click(object sender, EventArgs e)
{ {
Imprimir("PDF"); Imprimir("PDF");
} }
protected void LnkExcel_Click(object sender, EventArgs e) protected void LnkExcel_Click(object sender, EventArgs e)
{ {
Imprimir("EXCEL"); Imprimir("EXCEL");
} }
public void Imprimir(String Opcion) public void Imprimir(String Opcion)
{ {
String FechaF; String FechaF;
if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $"&emsp;<b>Fecha Final:</b> {txtFechaF.Text}"; } if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $"&emsp;<b>Fecha Final:</b> {txtFechaF.Text}"; }
String FechaI; String FechaI;
if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $"&emsp;<b>Fecha Inicial:</b> {txtFechaI.Text}"; } if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $"&emsp;<b>Fecha Inicial:</b> {txtFechaI.Text}"; }
if (DtIVATrasladado.Rows.Count > 0 || DtIVAAcreditable.Rows.Count > 0) if (DtIVATrasladado.Rows.Count > 0 || DtIVAAcreditable.Rows.Count > 0)
{ {
System.IO.FileInfo Imagen; System.IO.FileInfo Imagen;
String logouri = ""; String logouri = "";
if (UsuarioActual.CveEmpresa.Contiene(119)) if (UsuarioActual.CveEmpresa.Contiene(119))
{ {
Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.jpg", UsuarioActual.Empresa.Ruta)); Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.jpg", UsuarioActual.Empresa.Ruta));
logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa); logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
} }
else else
{ {
Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)); Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta));
logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa); logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
} }
List<CrystalParametro> para = new List<CrystalParametro>(); List<CrystalParametro> para = new List<CrystalParametro>();
para.Add(new CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa)); para.Add(new CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa));
para.Add(new CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre)); para.Add(new CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre));
para.Add(new CrystalParametro("Filtros", $"<b>Filtros:</b> {FechaI}{FechaF}")); para.Add(new CrystalParametro("Filtros", $"<b>Filtros:</b> {FechaI}{FechaF}"));
if (Imagen.Exists) if (Imagen.Exists)
{ {
para.Add(new CrystalParametro("LogoPath", logouri)); para.Add(new CrystalParametro("LogoPath", logouri));
} }
else else
{ {
para.Add(new CrystalParametro("LogoPath", "")); para.Add(new CrystalParametro("LogoPath", ""));
} }
DataTable Dt = TT.ActiveTabIndex == 0 ? DtIVATrasladado.Copy() : DtIVAAcreditable.Copy(); DataTable Dt = TT.ActiveTabIndex == 0 ? DtIVATrasladado.Copy() : DtIVAAcreditable.Copy();
string Formato = TT.ActiveTabIndex == 0 ? "RepIVA.rpt" : "RepIVAAcreditable.rpt"; string Formato = TT.ActiveTabIndex == 0 ? "RepIVA.rpt" : "RepIVAAcreditable.rpt";
para.Add(new CrystalParametro("Excel", Formato)); para.Add(new CrystalParametro("Excel", Formato));
ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath($"~/Empresas/Grales/Formatos/{Formato}"),Dt,para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion); ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath($"~/Empresas/Grales/Formatos/{Formato}"),Dt,para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion);
} }
else else
{ {
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia); Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia);
} }
} }
protected void BtnTipoCambio_Click(object sender, EventArgs e) protected void BtnTipoCambio_Click(object sender, EventArgs e)
{ {
Consulta(); Consulta();
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio")); RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio"));
} }
protected void RblTipoCambio_SelectedIndexChanged(object sender, EventArgs e) protected void RblTipoCambio_SelectedIndexChanged(object sender, EventArgs e)
{ {
TipoCambio = RblTipoCambio.SelectedValue.ToEntero(); TipoCambio = RblTipoCambio.SelectedValue.ToEntero();
if (TipoCambio == 3) if (TipoCambio == 3)
{ {
LiEspecifico.Visible = true; LiEspecifico.Visible = true;
TCEspecifico = get_GlobalTipoCambio(DateTime.Now).ToString().ToDouble(); TCEspecifico = get_GlobalTipoCambio(DateTime.Now).ToString().ToDouble();
TxtEspecifico.Text = TCEspecifico.ToString(); TxtEspecifico.Text = TCEspecifico.ToString();
} }
else else
{ {
LiEspecifico.Visible = false; LiEspecifico.Visible = false;
} }
UpBodyTipoCambio.Update(); UpBodyTipoCambio.Update();
} }
protected string GenerarDIOT() protected string GenerarDIOT()
{ {
System.Text.StringBuilder Respuesta = new System.Text.StringBuilder(); System.Text.StringBuilder Respuesta = new System.Text.StringBuilder();
return Respuesta.ToString(); return Respuesta.ToString();
} }
protected void LnkAccionesDIOT_Click(object sender, EventArgs e) protected void LnkAccionesDIOT_Click(object sender, EventArgs e)
{ {
ClsContabilidad Objconta = new ClsContabilidad(); ClsContabilidad Objconta = new ClsContabilidad();
StringBuilder SBDIOT = new StringBuilder(); StringBuilder SBDIOT = new StringBuilder();
int Conciliado = DdlTipoMovto.SelectedValue.ToEntero(); int Conciliado = DdlTipoMovto.SelectedValue.ToEntero();
if (Objconta.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) if (Objconta.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico))
{ {
foreach (DataRow Drow in Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 and SubTotal >= 1 ").Rows) // and(IVA > 1 OR IEPS > 0) foreach (DataRow Drow in Objconta.DtResultados.FiltraParametros("CveCompra is null and CveProveedor > 0 and SubTotal >= 1 ").Rows) // and(IVA > 1 OR IEPS > 0)
{ {
SBDIOT.AppendLine( SBDIOT.AppendLine(
Drow["TipoTercero"].ToString() + "|" + Drow["TipoTercero"].ToString() + "|" +
Drow["TipoOperacion"].ToString() + "|" + Drow["TipoOperacion"].ToString() + "|" +
Drow["RFC"].ToString() +"|"+ Drow["RFC"].ToString() +"|"+
Drow["NumeroIDFiscal"].ToString() + "|" + Drow["NumeroIDFiscal"].ToString() + "|" +
Drow["NombreExtranjero"].ToString() +"|"+ Drow["NombreExtranjero"].ToString() +"|"+
Drow["PaisResidencia"].ToString() + "|" + Drow["PaisResidencia"].ToString() + "|" +
Drow["Nacionalidad"].ToString() +"|"+ Drow["Nacionalidad"].ToString() +"|"+
LV(Drow["valorActos1516"].ToString()) + "|"+ LV(Drow["valorActos1516"].ToString()) + "|"+
LV(Drow["valorActos15"].ToString()) + "|" + LV(Drow["valorActos15"].ToString()) + "|" +
LV(Drow["ValorIvaNo1516"].ToString()) +"|"+ LV(Drow["ValorIvaNo1516"].ToString()) +"|"+
LV(Drow["valorActos1011"].ToString()) + "|" + LV(Drow["valorActos1011"].ToString()) + "|" +
LV(Drow["valorActos10"].ToString()) + "|" + LV(Drow["valorActos10"].ToString()) + "|" +
LV(Drow["valorActosImp8"].ToString()) + "|" + LV(Drow["valorActosImp8"].ToString()) + "|" +
LV(Drow["ValorIvaNo10"].ToString()) + "|" + LV(Drow["ValorIvaNo10"].ToString()) + "|" +
LV(Drow["ValorIvaNo08"].ToString()) + "|" + LV(Drow["ValorIvaNo08"].ToString()) + "|" +
LV(Drow["valorActosImp1516"].ToString()) + "|" + LV(Drow["valorActosImp1516"].ToString()) + "|" +
LV(Drow["ValorIvaNoImp16"].ToString()) + "|" + LV(Drow["ValorIvaNoImp16"].ToString()) + "|" +
LV(Drow["valorActosImp10"].ToString()) + "|" + LV(Drow["valorActosImp10"].ToString()) + "|" +
LV(Drow["ValorIvaNoImp10"].ToString()) + "|" + LV(Drow["ValorIvaNoImp10"].ToString()) + "|" +
LV(Drow["IvaExentoImpo"].ToString()) + "|"+ LV(Drow["IvaExentoImpo"].ToString()) + "|"+
LV(Drow["IVACero"].ToString()) + "|" + LV(Drow["IVACero"].ToString()) + "|" +
LV(Drow["IvaExento"].ToString()) + "|"+ LV(Drow["IvaExento"].ToString()) + "|"+
LV(Drow["IvaRetenido"].ToString()) + "|" + LV(Drow["IvaRetenido"].ToString()) + "|" +
LV(Drow["IvaDevoluciones"].ToString()) + "|"); LV(Drow["IvaDevoluciones"].ToString()) + "|");
} }
} }
Objconta.Dispose(); Objconta.Dispose();
//MemoryStream ms = new MemoryStream(); //MemoryStream ms = new MemoryStream();
//TextWriter tw = new StreamWriter(ms, System.Text.Encoding.UTF8); //TextWriter tw = new StreamWriter(ms, System.Text.Encoding.UTF8);
//tw.Write(SBDIOT.ToString()); //tw.Write(SBDIOT.ToString());
//tw.Flush(); //tw.Flush();
//byte[] bytes = ms.ToArray(); //byte[] bytes = ms.ToArray();
//ms.Close(); //ms.Close();
//Response.Clear(); //Response.Clear();
//Response.AppendHeader("Content-Length", text.Length.ToString()); //Response.AppendHeader("Content-Length", text.Length.ToString());
//Response.ContentType = "text/plain"; //Response.ContentType = "text/plain";
//Response.AddHeader("content-disposition", $"attachment; filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt"); //Response.AddHeader("content-disposition", $"attachment; filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt");
//Response.BinaryWrite(bytes); //Response.BinaryWrite(bytes);
//Response.End(); //Response.End();
Response.Clear(); Response.Clear();
Response.ClearHeaders(); Response.ClearHeaders();
Response.AppendHeader("Content-Length", SBDIOT.ToString().Length.ToString()); Response.AppendHeader("Content-Length", SBDIOT.ToString().Length.ToString());
Response.ContentType = "text/plain"; Response.ContentType = "text/plain";
Response.AppendHeader("Content-Disposition", $"attachment;filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt"); Response.AppendHeader("Content-Disposition", $"attachment;filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt");
Response.Write(SBDIOT.ToString()); Response.Write(SBDIOT.ToString());
Response.End(); Response.End();
} }
protected string LV(string Valor ) protected string LV(string Valor )
{ {
return (Valor.ToDecimal() > 0) ? Valor.ToDecimal().ToString().FormatoNumero(0).Replace(",", string.Empty) : ""; return (Valor.ToDecimal() > 0) ? Valor.ToDecimal().ToString().FormatoNumero(0).Replace(",", string.Empty) : "";
} }
} }