diff --git a/Bancos/IE.aspx b/Bancos/IE.aspx index e47da35f1..5d8bd47e6 100644 --- a/Bancos/IE.aspx +++ b/Bancos/IE.aspx @@ -1,1565 +1,1565 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="IE.aspx.vb" Inherits="Bancos_IE" ValidateRequest="false" %> - - - - - - - - - - -   - - - -
  • - Listado Facturas Pagadas -
  • -
  • - Imprimir -
  • - - -
  • - Complemento Pago -
  • -
    -
    - -
  • - Actualizar Tipo Cambio -
  • - - <%--
  • - Emitir Complemento de Pago -
  • --%> - - - -
  • - Cheque Devuelto -
  • -
  • - Cancelar Movimiento -
  • -
  • - Eliminar Movimiento -
  • -
  • - Refacturar Complemento -
  • -
  • - Cancelar - - <%-- data-original-title="¿Está seguro que desea cancelar el documento?" data-btn-ok-label="si" Style="color: #686868;"> - -
  • -
    -
    - - - - -
  • - Contabilizar -
  • -
  • - Descontabilizar -
  • - -
    - - - - -
    - -
  • - Envíar Comprobante Mail -
  • - - - -
  • - Ajustar -
  • -
    -
    - -
    - - - - - -
    -
    -
    -
    -
    -
    - -   - - <%----%> Comprobante -   - -
    - -
    - - - - - -
    - -
    -
    - -
    - - - - - -
    -
    - - -
    -
    -
    - -
    - -
    -
    - -
    - -
    - -
    -
    -
    - - -
    -
    -
    - -
    - -
    -
    - - - - -
    - - - - - - - -
    -
    -
    - -
    - - - -
    -
    - -
    - $ - -
    -
    -
    -
    -
    Interes:
    -
    - $ - -
    -
    - -
    - -
    -
    - -
    - $ - - - -
    -
    - - - - -
    - - Clientes - Proveedor - Viaticos - Personal - - - - - - - - - - - - - - - - -
    -
    - -
    - - -
    -
    -
    -
    -
    - -
    -
    - -
    - $ - - -
    -
    -
    - - - - -
    - -
    -
    -
    -
    - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    - -
    -
    - -
    -
    -
    - - - -
    - -
    - - - - - -
    -
    -
    -
    - - - -
    - - -
    - - - - - - -
    -
    -
    -
    - -
    - -
    - -
    - <%-- - -
    - - - -
    -
    -
    --%> -
    - - - -
    - -
    - -
    -
    -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - - - -
    - -
    - - - - -
    -
    -
    - -
    - - - -
    -
    -
    -
    - -
    - -
    - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - - -
    -
    - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    -
    - -
    -
    - - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - -
    - -
    -
    -
    -
    - - - -
    -
    -
    - -
    -
    -
    -
    - - - - - - - - - - - -
    - -
    -
    - - - - - - <%-- - - - - --%> - - - - - - - - - - - - - - - - - -
    CveIE: - -
    Tipo de Documento: - - - -
    Fecha Aplicación -
    - - - - -
    - - - <%-- - - - - --%> - -
    -
    - - -
    Complemento de pago Sustituto de: - -
    -
    -
    -
    - - - -
    -
    - Cargar Comprobante - - - - - - - - - - - -
    - -
    -
    - Nota: Si ya tiene un comprobante este sera reemplazado. -
    -
    -
    -
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - - - -
    Moneda: - - - - - -
    Registró: -
    F. Registró: -
    Tipo Cambio: -
    -
    -
    - -
    -
    -
    - - <%-- - - - --%> - - - - - - - - - <%-- - - - - - - - - - - - --%> -
    Es Abono en Cuenta: - -
    Aplica Impuestos: - -
    No Deducible: - -
    Fue Impreso: - -
    Fue Conciliado: - -
     Fecha Aplicado:  -
    -
    -
    -
    -
    - - - - - - - - -
    Depositado : - Ir -
    -
    -
    -
    - -
    -
    - - - -
    -
    - - - - -
    -
    -
    -
    - - Datos Generales Cancelación -
    -
    -
    -
    -
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - -
    Usuario: - -
    Fecha Cancelación: - -
    Fecha Registro: - -
    - - - -
    -
    -
    -
    - -
    -
    - -
    - -
    -
    - -
    - -
    -
    - - - - - - -
    - - - - - - - - - - -
    - -
    - -
    - -
    -
    -
    -
    - <%----%> - Bitacora -
    -
    -
    - <%--
    - - Agregar -
    --%> -
    - - -
    -
    -
    -
    - - - - - - Fecha - - - - - - Fecha Agenda - - - - - - Usuario - - - - - - Descripción - - - - - - Archivo - - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - Historial de Modificación -
    -
    -
    -
    -
    -
    -
    - - - - Fecha - - - - - - - - - - -
    -
    -
    -
    - <%-- MODAL BITACORA --%> - - - - - - - - - <%-- COMPLEMENTOS PAGO --%> - - - <%-- ACTUALIZAR TIPO CAMBIO PREPOLIZA --%> - - - - - - - - - - - - -
    - - - - +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="IE.aspx.vb" Inherits="Bancos_IE" ValidateRequest="false" %> + + + + + + + + + + +   + + + +
  • + Listado Facturas Pagadas +
  • +
  • + Imprimir +
  • + + +
  • + Complemento Pago +
  • +
    +
    + +
  • + Actualizar Tipo Cambio +
  • + + <%--
  • + Emitir Complemento de Pago +
  • --%> + + + +
  • + Cheque Devuelto +
  • +
  • + Cancelar Movimiento +
  • +
  • + Eliminar Movimiento +
  • +
  • + Refacturar Complemento +
  • +
  • + Cancelar + + <%-- data-original-title="¿Está seguro que desea cancelar el documento?" data-btn-ok-label="si" Style="color: #686868;"> + +
  • +
    +
    + + + + +
  • + Contabilizar +
  • +
  • + Descontabilizar +
  • + +
    + + + + +
    + +
  • + Envíar Comprobante Mail +
  • + + + +
  • + Ajustar +
  • +
    +
    + +
    + + + + + +
    +
    +
    +
    +
    +
    + +   + + <%----%> Comprobante +   + +
    + +
    + + + + + +
    + +
    +
    + +
    + + + + + +
    +
    + + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    + + +
    +
    +
    + +
    + +
    +
    + + + + +
    + + + + + + + +
    +
    +
    + +
    + + + +
    +
    + +
    + $ + +
    +
    +
    +
    +
    Interes:
    +
    + $ + +
    +
    + +
    + +
    +
    + +
    + $ + + + +
    +
    + + + + +
    + + Clientes + Proveedor + Viaticos - Personal + + + + + + + + + + + + + + + + +
    +
    + +
    + + +
    +
    +
    +
    +
    + +
    +
    + +
    + $ + + +
    +
    +
    + + + + +
    + +
    +
    +
    +
    + + + + + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    + + + +
    + +
    + + + + + +
    +
    +
    +
    + + + +
    + + +
    + + + + + + +
    +
    +
    +
    + +
    + +
    + +
    + <%-- + +
    + + + +
    +
    +
    --%> +
    + + + +
    + +
    + +
    +
    +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + + + +
    + +
    + + + + +
    +
    +
    + +
    + + + +
    +
    +
    +
    + +
    + +
    + + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + + +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + +
    + +
    +
    +
    +
    + + + +
    +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + +
    + +
    +
    + + + + + + <%-- + + + + --%> + + + + + + + + + + + + + + + + + +
    CveIE: + +
    Tipo de Documento: + + + +
    Fecha Aplicación +
    + + + + +
    + + + <%-- + + + + --%> + +
    +
    + + +
    Complemento de pago Sustituto de: + +
    +
    +
    +
    + + + +
    +
    + Cargar Comprobante + + + + + + + + + + + +
    + +
    +
    + Nota: Si ya tiene un comprobante este sera reemplazado. +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + +
    Moneda: + + + + + +
    Registró: +
    F. Registró: +
    Tipo Cambio: +
    +
    +
    + +
    +
    +
    + + <%-- + + + --%> + + + + + + + + + <%-- + + + + + + + + + + + --%> +
    Es Abono en Cuenta: + +
    Aplica Impuestos: + +
    No Deducible: + +
    Fue Impreso: + +
    Fue Conciliado: + +
     Fecha Aplicado:  +
    +
    +
    +
    +
    + + + + + + + + +
    Depositado : + Ir +
    +
    +
    +
    + +
    +
    + + + +
    +
    + + + + +
    +
    +
    +
    + + Datos Generales Cancelación +
    +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + +
    Usuario: + +
    Fecha Cancelación: + +
    Fecha Registro: + +
    + + + +
    +
    +
    +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + + + + + + +
    + + + + + + + + + + +
    + +
    + +
    + +
    +
    +
    +
    + <%----%> + Bitacora +
    +
    +
    + <%--
    + + Agregar +
    --%> +
    + + +
    +
    +
    +
    + + + + + + Fecha + + + + + + Fecha Agenda + + + + + + Usuario + + + + + + Descripción + + + + + + Archivo + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + Historial de Modificación +
    +
    +
    +
    +
    +
    +
    + + + + Fecha + + + + + + + + + + +
    +
    +
    +
    + <%-- MODAL BITACORA --%> + + + + + + + + + <%-- COMPLEMENTOS PAGO --%> + + + <%-- ACTUALIZAR TIPO CAMBIO PREPOLIZA --%> + + + + + + + + + + + + +
    + + + + diff --git a/Compras/RepNotasCredito.aspx.vb b/Compras/RepNotasCredito.aspx.vb index f5d63a35b..cd955ec5c 100644 --- a/Compras/RepNotasCredito.aspx.vb +++ b/Compras/RepNotasCredito.aspx.vb @@ -1,281 +1,281 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports Extensiones -Imports Microsoft.Reporting.WebForms - -Partial Class Compras_RepNotasCredito - Inherits ClsPaginas - -#Region "PROPIEDADES" - Private Property DtDatos As DataTable - Get - DtDatos = CType(ViewState("DtDatos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtDatos") = value - End Set - End Property -#End Region - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not Page.IsPostBack Then - DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) - DdlProveedores.DataBind() - TxtFechaSaldar.Text = Now.ToShortDateString - CargaDatos() - End If - End Sub - - Private Sub CargaDatos() - Dim ObjCompras As New ClsCompras - Dim FechaI, FechaF As String - - If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-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 - DtDatos = ObjCompras.DtResultados - CargaGrid("") - Else - Alert("Ocurrió un error al obtener el catálogo de Notas de Crédito", Extensiones.TipoMensaje.MsgError) - End If - - ObjCompras.Dispose() - End Sub - - Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) - 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("HLSerieFolio").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DBCampo("CveCompra")) - - End If - End Sub - - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) - CargaDatos() - End Sub - - Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click - GvDatos.ExportToExcel("RepNotasCredito." & Now.ToShortDateString) - - End Sub - - - Private Sub GenerarPDF(Optional Formato As String = "PDF") - If DtDatos IsNot Nothing Then - Dim StrFiltro As New StringBuilder - 'StrFiltro.AppendFormat(String.Format("Proveedor: {0}, Estatus: {1}", DdlProveedores.SelectedItem.Text, DdlOpcion.SelectedItem.Text)) - ' If DdlTipoComprobante.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Tipo Documento: {0}", DdlTipoComprobante.SelectedItem.Text) - If DdlProveedores.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Proveedor: {0}", DdlProveedores.SelectedItem.Text) - If DdlOpcion.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Estatus: {0}", DdlOpcion.SelectedItem.Text) - - If txtFechaI.Text <> "" Then StrFiltro.AppendFormat(" Fecha Inicio : {0}", txtFechaI.Text.ToDate.ToShortDateString) - If txtFechaF.Text <> "" Then StrFiltro.AppendFormat(" Fecha Fin : {0}", txtFechaF.Text.ToDate.ToShortDateString) - - - 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 dt As DataTable = DtVentas.FiltraParametros("", "Orden") '.FiltraParametros("Total > 0", DistinctColumns:={"GPO", "Cantidad", "SubTotal", "Descuento", "Amortizacion", "IVA", "Total"}) - Dim FechaI, FechaF As String - FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text) - FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text) - Dim params As New List(Of ReportParameter) - - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("FechaInicio", FechaI)) - params.Add(New ReportParameter("FechaFin", FechaF)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - params.Add(New ReportParameter("Filtros", StrFiltro.ToString)) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - ImprimirPDF("Empresas/Grales/Formatos/RepNotasCredito.rdlc", DtDatos, params, String.Format("ReporteVentas-{0}", Now.ToDateTime.ToShortDateString), Formato:=Formato) - Else - Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia) - End If - - End Sub - - Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click - GenerarPDF() - End Sub - - Private Sub LnkHabilitarSaldar_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldar.Click - For Each gr As GridViewRow In GvDatos.Rows - If gr.DataKey("CveCompra") <> "" Then - gr.FCCheckBox("Chk").Visible = True - HLSaldar.Visible = True - LnkHabilitarSaldar.Visible = False - UpDatos.Update() - End If - Next - End Sub - - Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs) - Dim ObjConta As New ClsContabilidad - ObjConta.IniciaTransacSQL() - Dim CvePrePoliza As Integer = 0 - Dim MsgError As String = "" - Dim IdCtaContable As Integer = 0 - Dim IdCtaContableComplementaria As Integer = 0 - Dim Importe As Decimal = 0 - Dim ImporteMN As Decimal = 0 - Dim ImporteComplementaria As Decimal = 0 - Dim CveMoneda As Integer = 0 - Dim TC As Decimal = GlobalTipoCambio(TxtFechaSaldar.Text.ToDate).ToDecimal - Dim TCCompra As Decimal = 0 - Dim Concepto As String = TxtConcepto.Text - Dim UsaComplementaria As Boolean = UsuarioActual.CveEmpresa.Contiene(119) - Dim MensajeAlert = New StringBuilder - - For Each gr As GridViewRow In GvDatos.Rows - If gr.FCCheckBox("Chk").Checked Then - IdCtaContable = 0 - IdCtaContableComplementaria = 0 - Importe = gr.DataKey("Saldo").ToDecimal.RoundSQL - ImporteMN = gr.DataKey("Saldo").ToDecimal.RoundSQL - TCCompra = gr.DataKey("TipoCambio").ToDecimal - 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) - - If CveMoneda > 1 Then - IdCtaContable = gr.DataKey("IdCtaContExtranjera").ToEntero - ImporteMN = (gr.DataKey("Saldo").ToDecimal * TCCompra).RoundSQL - Else - IdCtaContable = gr.DataKey("IdCtaContProveedores").ToEntero - 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 - MsgError = "Ocurrio un Error al saldar el movimiento" - End If - - If UsaComplementaria AndAlso CveMoneda > 1 Then - ImporteComplementaria = (Importe * TCCompra - Importe).RoundSQL - 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 - MsgError = "Ocurrio un Error al saldar el movimiento" - End If - End If - - 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 - MsgError = "Ocurrio un Error al saldar el movimiento" - End If - - If TC <> TCCompra AndAlso CveMoneda > 1 AndAlso UsaComplementaria Then - Dim difFluctuacion As Decimal = TC - TCCompra - Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida - Dim TipoMovtoFluctua As Boolean = True - Dim IdCtaContableFluctua As Integer - Dim CveCuenta As Integer = 0 - If difFluctuacion < 0 Then - CveConceptoFluctua = 65 - TipoMovtoFluctua = False - IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria - Else - CveConceptoFluctua = 64 - TipoMovtoFluctua = True - IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria - End If - 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 - MsgError = "Ocurrio un Error al saldar el movimiento" - End If - End If - - If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then - If ObjConta.ValorPolizaDescuadre > 0 Then - MsgError = ObjConta.MensajePolizaDescuadre - GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then - If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then - If MensajeAlert.ToString = "" Then - MensajeAlert.AppendFormat("Los siguientes movimientos fueron saldados correctamente:
    ") - End If - MensajeAlert.AppendFormat("", ObjConta.ContaIdPoliza, ObjConta.ContaFolio) - End If - End If - - If MsgError <> "" Then Exit For - - End If - Next - - - If MsgError = "" Then - ObjConta.Commit() - If MensajeAlert.ToString <> "" Then - Alert(MensajeAlert.ToString) - Else - Alert("Los movimientos fueron saldados correctamente.") - End If - Alert(MensajeAlert.ToString) - CargaDatos() - HLSaldar.Visible = False - RegistraScript("$('#DivSaldar').modal('hide')") - LnkHabilitarSaldar.Visible = True - Else - ObjConta.RollBack() - Alert(MsgError, TipoMensaje.MsgError) - End If - ObjConta.Dispose() - End Sub - Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs) - - End Sub - - -#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) - Dim Orden As String = "" - Dim Campo As String = "" - Dim Literal As Literal = Nothing - Const OrdenInicial As String = "" - Dim Arg(2) As String - - Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) - Campo = Arg(0) - 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 - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) - Literal.Text = String.Format("") - Else - ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo) - Literal.Text = String.Format("") - End If - Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString - ViewState("Orden") = Orden - CargaGrid(Orden) - End Sub - - Protected Sub CargaGrid(Orden As String) - Dim DV As DataView = Nothing - DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows) - If Orden <> String.Empty Then - GvDatos.DataSource = DV.ToTable() - Else - GvDatos.DataSource = DtDatos - End If - - GvDatos.DataBind() - UpDatos.Update() - DV.Dispose() - End Sub -#End Region - - -End Class +Option Explicit On +Option Strict On + +Imports System.Data +Imports Extensiones +Imports Microsoft.Reporting.WebForms + +Partial Class Compras_RepNotasCredito + Inherits ClsPaginas + +#Region "PROPIEDADES" + Private Property DtDatos As DataTable + Get + DtDatos = CType(ViewState("DtDatos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtDatos") = value + End Set + End Property +#End Region + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + DdlProveedores.DataBind() + TxtFechaSaldar.Text = Now.ToShortDateString + CargaDatos() + End If + End Sub + + Private Sub CargaDatos() + Dim ObjCompras As New ClsCompras + Dim FechaI, FechaF As String + + If txtFechaI.Text <> "" Then FechaI = txtFechaI.Text Else FechaI = "-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 + DtDatos = ObjCompras.DtResultados + CargaGrid("") + Else + Alert("Ocurrió un error al obtener el catálogo de Notas de Crédito", Extensiones.TipoMensaje.MsgError) + End If + + ObjCompras.Dispose() + End Sub + + Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) + 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("HLSerieFolio").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DBCampo("CveCompra")) + + End If + End Sub + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaDatos() + End Sub + + Protected Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click + GvDatos.ExportToExcel("RepNotasCredito." & Now.ToShortDateString) + + End Sub + + + Private Sub GenerarPDF(Optional Formato As String = "PDF") + If DtDatos IsNot Nothing Then + Dim StrFiltro As New StringBuilder + 'StrFiltro.AppendFormat(String.Format("Proveedor: {0}, Estatus: {1}", DdlProveedores.SelectedItem.Text, DdlOpcion.SelectedItem.Text)) + ' If DdlTipoComprobante.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Tipo Documento: {0}", DdlTipoComprobante.SelectedItem.Text) + If DdlProveedores.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Proveedor: {0}", DdlProveedores.SelectedItem.Text) + If DdlOpcion.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Estatus: {0}", DdlOpcion.SelectedItem.Text) + + If txtFechaI.Text <> "" Then StrFiltro.AppendFormat(" Fecha Inicio : {0}", txtFechaI.Text.ToDate.ToShortDateString) + If txtFechaF.Text <> "" Then StrFiltro.AppendFormat(" Fecha Fin : {0}", txtFechaF.Text.ToDate.ToShortDateString) + + + 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 dt As DataTable = DtVentas.FiltraParametros("", "Orden") '.FiltraParametros("Total > 0", DistinctColumns:={"GPO", "Cantidad", "SubTotal", "Descuento", "Amortizacion", "IVA", "Total"}) + Dim FechaI, FechaF As String + FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text) + FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text) + Dim params As New List(Of ReportParameter) + + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("FechaInicio", FechaI)) + params.Add(New ReportParameter("FechaFin", FechaF)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + params.Add(New ReportParameter("Filtros", StrFiltro.ToString)) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + ImprimirPDF("Empresas/Grales/Formatos/RepNotasCredito.rdlc", DtDatos, params, String.Format("ReporteVentas-{0}", Now.ToDateTime.ToShortDateString), Formato:=Formato) + Else + Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia) + End If + + End Sub + + Protected Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click + GenerarPDF() + End Sub + + Private Sub LnkHabilitarSaldar_Click(sender As Object, e As EventArgs) Handles LnkHabilitarSaldar.Click + For Each gr As GridViewRow In GvDatos.Rows + If gr.DataKey("CveCompra") <> "" Then + gr.FCCheckBox("Chk").Visible = True + HLSaldar.Visible = True + LnkHabilitarSaldar.Visible = False + UpDatos.Update() + End If + Next + End Sub + + Protected Sub BtnSaldar_Click(sender As Object, e As EventArgs) + Dim ObjConta As New ClsContabilidad + ObjConta.IniciaTransacSQL() + Dim CvePrePoliza As Integer = 0 + Dim MsgError As String = "" + Dim IdCtaContable As Integer = 0 + Dim IdCtaContableComplementaria As Integer = 0 + Dim Importe As Decimal = 0 + Dim ImporteMN As Decimal = 0 + Dim ImporteComplementaria As Decimal = 0 + Dim CveMoneda As Integer = 0 + Dim TC As Decimal = GlobalTipoCambio(TxtFechaSaldar.Text.ToDate).ToDecimal + Dim TCCompra As Decimal = 0 + Dim Concepto As String = TxtConcepto.Text + Dim UsaComplementaria As Boolean = UsuarioActual.CveEmpresa.Contiene(119) + Dim MensajeAlert = New StringBuilder + + For Each gr As GridViewRow In GvDatos.Rows + If gr.FCCheckBox("Chk").Checked Then + IdCtaContable = 0 + IdCtaContableComplementaria = 0 + Importe = gr.DataKey("Saldo").ToDecimal.RoundSQL + ImporteMN = gr.DataKey("Saldo").ToDecimal.RoundSQL + TCCompra = gr.DataKey("TipoCambio").ToDecimal + 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) + + If CveMoneda > 1 Then + IdCtaContable = gr.DataKey("IdCtaContExtranjera").ToEntero + ImporteMN = (gr.DataKey("Saldo").ToDecimal * TCCompra).RoundSQL + Else + IdCtaContable = gr.DataKey("IdCtaContProveedores").ToEntero + 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 + MsgError = "Ocurrio un Error al saldar el movimiento" + End If + + If UsaComplementaria AndAlso CveMoneda > 1 Then + ImporteComplementaria = (Importe * TCCompra - Importe).RoundSQL + 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 + MsgError = "Ocurrio un Error al saldar el movimiento" + End If + End If + + 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 + MsgError = "Ocurrio un Error al saldar el movimiento" + End If + + If TC <> TCCompra AndAlso CveMoneda > 1 AndAlso UsaComplementaria Then + Dim difFluctuacion As Decimal = TC - TCCompra + Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida + Dim TipoMovtoFluctua As Boolean = True + Dim IdCtaContableFluctua As Integer + Dim CveCuenta As Integer = 0 + If difFluctuacion < 0 Then + CveConceptoFluctua = 65 + TipoMovtoFluctua = False + IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria + CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria + Else + CveConceptoFluctua = 64 + TipoMovtoFluctua = True + IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria + CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria + End If + 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 + MsgError = "Ocurrio un Error al saldar el movimiento" + End If + End If + + If ObjConta.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then + If ObjConta.ValorPolizaDescuadre > 0 Then + MsgError = ObjConta.MensajePolizaDescuadre + GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then + If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + If MensajeAlert.ToString = "" Then + MensajeAlert.AppendFormat("Los siguientes movimientos fueron saldados correctamente:
    ") + End If + MensajeAlert.AppendFormat("", ObjConta.ContaIdPoliza, ObjConta.ContaFolio) + End If + End If + + If MsgError <> "" Then Exit For + + End If + Next + + + If MsgError = "" Then + ObjConta.Commit() + If MensajeAlert.ToString <> "" Then + Alert(MensajeAlert.ToString) + Else + Alert("Los movimientos fueron saldados correctamente.") + End If + Alert(MensajeAlert.ToString) + CargaDatos() + HLSaldar.Visible = False + RegistraScript("$('#DivSaldar').modal('hide')") + LnkHabilitarSaldar.Visible = True + Else + ObjConta.RollBack() + Alert(MsgError, TipoMensaje.MsgError) + End If + ObjConta.Dispose() + End Sub + Protected Sub LnkSaldar_Click(sender As Object, e As EventArgs) + + End Sub + + +#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) + Dim Orden As String = "" + Dim Campo As String = "" + Dim Literal As Literal = Nothing + Const OrdenInicial As String = "" + Dim Arg(2) As String + + Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c) + Campo = Arg(0) + 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 + ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo) + Literal.Text = String.Format("") + Else + ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo) + Literal.Text = String.Format("") + End If + Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString + ViewState("Orden") = Orden + CargaGrid(Orden) + End Sub + + Protected Sub CargaGrid(Orden As String) + Dim DV As DataView = Nothing + DV = New DataView(DtDatos, "", Orden, DataViewRowState.CurrentRows) + If Orden <> String.Empty Then + GvDatos.DataSource = DV.ToTable() + Else + GvDatos.DataSource = DtDatos + End If + + GvDatos.DataBind() + UpDatos.Update() + DV.Dispose() + End Sub +#End Region + + +End Class diff --git a/Contabilidad/RepIVA.aspx b/Contabilidad/RepIVA.aspx index 254800fc3..fe925144c 100644 --- a/Contabilidad/RepIVA.aspx +++ b/Contabilidad/RepIVA.aspx @@ -1,268 +1,268 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIVA.aspx.cs" Inherits="Contabilidad_RepIVA" %> - - - - - - - - Reporte de Impuestos - - -
  • - PDF -
  • -
  • - Excel -
  • -
  • - Ver Dlls en pesos -
  • - - - -
  • - Generar DIOT -
  • - -
    - - - -
    -
    - - - - - - - -
    -
    -
    - -
    -
    -
    - -
    -
    - - - - - - - - - - -   -
    -
    - -
    -
    - - - - - - - - - - -
    -
    - -
    - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - -
    - - -

    IVA Trasladado

    - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - -
    -

    IEPS por Porcentaje

    - - - - - - - - - -
    -
    -

    IVA por Porcentaje

    - - - - - - - - -
    -
    -
    - -
    -
    - - - -

    IVA Acreditable

    - - - - - - - - - - - - - - - - - RetIVA
    Hon/Ser.Prof.
    -
    - - - -
    - - - - - - - - - <%-- - - - --%> - - - - - -
    -
    - -
    -

    IVA por Porcentaje

    - - - - - - - - -
    - -
    -
    -
    - -
    -
    - - - - - -
    - - - +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIVA.aspx.cs" Inherits="Contabilidad_RepIVA" %> + + + + + + + + Reporte de Impuestos + + +
  • + PDF +
  • +
  • + Excel +
  • +
  • + Ver Dlls en pesos +
  • + + + +
  • + Generar DIOT +
  • + +
    + + + +
    +
    + + + + + + + +
    +
    +
    + +
    +
    +
    + +
    +
    + + + + + + + + + + +   +
    +
    + +
    +
    + + + + + + + + + + +
    +
    + +
    + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + +
    + + +

    IVA Trasladado

    + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + +
    +

    IEPS por Porcentaje

    + + + + + + + + + +
    +
    +

    IVA por Porcentaje

    + + + + + + + + +
    +
    +
    + +
    +
    + + + +

    IVA Acreditable

    + + + + + + + + + + + + + + + + + RetIVA
    Hon/Ser.Prof.
    +
    + + + +
    + + + + + + + + + <%-- + + + --%> + + + + + +
    +
    + +
    +

    IVA por Porcentaje

    + + + + + + + + +
    + +
    +
    +
    + +
    +
    + + + + + +
    + + + diff --git a/Contabilidad/RepIVA.aspx.cs b/Contabilidad/RepIVA.aspx.cs index 0730328b1..176f60830 100644 --- a/Contabilidad/RepIVA.aspx.cs +++ b/Contabilidad/RepIVA.aspx.cs @@ -1,316 +1,316 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI.WebControls; -using Extensiones; -using System.Data; -using static Extensiones.ModExtensiones; -using Microsoft.Reporting.WebForms; -using System.Activities.Expressions; -using System.Text; -using System.IO; - -public partial class Contabilidad_RepIVA : ClsPaginas -{ - #region PROPIEDADES - - private DataTable DtIVATrasladado - { - get { return DtIVATrasladado = (DataTable)ViewState["DtIVATrasladado"]; } - set { ViewState["DtIVATrasladado"] = value; } - } - private DataTable DtIVAAcreditable - { - get { return DtIVAAcreditable = (DataTable)ViewState["DtIVAAcreditable"]; } - set { ViewState["DtIVAAcreditable"] = value; } - } - private double TCEspecifico - { - get { return TCEspecifico = (double)ViewState["TCEspecifico"]; } - set { ViewState["TCEspecifico"] = value; } - } - - private int TipoCambio - { - get { return TipoCambio = (int)ViewState["TipoCambio"]; } - set { ViewState["TipoCambio"] = value; } - } - - #endregion - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { - InicializaValores(); - - } - } - - public void InicializaValores() - { - TipoCambio = 1; - TCEspecifico = -1; - txtFechaI.Text = $"01/{DateTime.Now.Month}/{DateTime.Now.Year}"; - txtFechaF.Text = DateTime.Now.ToShortDateString(); - - LnkAccionesDIOT.Visible = true; - - } - - public void Consulta() - { - if (TipoCambio == 3 && TxtEspecifico.Text != "") { TCEspecifico = TxtEspecifico.Text.ToDouble(); } else { TCEspecifico = -1; } - int Conciliado = DdlTipoMovto.SelectedValue.ToEntero(); - LblMsgAcreditable.Text = ""; // lbl de mensajes de negativos - - ClsContabilidad ObjCont = new ClsContabilidad(); - if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) - { - GvT.DataSource = ObjCont.DtResultados; - DtIVATrasladado = ObjCont.DtResultados; - if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) - { - GvIEPSA.DataSource = ObjCont.DtResultados; - } - - if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) - { - GvIVAA.DataSource = ObjCont.DtResultados; - } - - } - if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) - { - GvA.DataSource = ObjCont.DtResultados; - DtIVAAcreditable = ObjCont.DtResultados; - 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"; - } - - - if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) - { - GvIVA2.DataSource = ObjCont.DtResultados; - } - - - } - ObjCont.Dispose(); - GvT.DataBind(); - GvA.DataBind(); - GvIEPSA.DataBind(); - GvIVAA.DataBind(); - GvIVA2.DataBind(); - UpDatos.Update(); - } - - protected void BtnConsultar_Click(object sender, EventArgs e) - { - Consulta(); - } - - protected void GvIVATrasladado_RowDataBound(object sender, GridViewRowEventArgs e) - { - if (e.Row.RowType == DataControlRowType.DataRow) - { - if (e.Row.DBCampo("CveVenta").ToEntero() < 1) - { - e.Row.CssClass = "Totales"; - } - } - } - - protected void GvIVAAcreditable_RowDataBound(object sender, GridViewRowEventArgs e) - { - if (e.Row.RowType == DataControlRowType.DataRow) - { - if (e.Row.DBCampo("CveCompra").ToEntero() < 1) - { - e.Row.CssClass = "Totales"; - } - 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 dif = Math.Round(SubTotal * e.Row.DBCampo("PorcentajeIVA").ToDecimal(), 2) - Math.Round(e.Row.DBCampo("IVA").ToDecimal(), 2); - if (dif > 1) - { - e.Row.ForeColor = System.Drawing.Color.Red; - 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"); - } - } - } - } - - protected void LnkPdf_Click(object sender, EventArgs e) - { - Imprimir("PDF"); - } - - protected void LnkExcel_Click(object sender, EventArgs e) - { - Imprimir("EXCEL"); - } - - public void Imprimir(String Opcion) - { - String FechaF; - if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $" Fecha Final: {txtFechaF.Text}"; } - String FechaI; - if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $" Fecha Inicial: {txtFechaI.Text}"; } - if (DtIVATrasladado.Rows.Count > 0 || DtIVAAcreditable.Rows.Count > 0) - { - System.IO.FileInfo Imagen; - String logouri = ""; - - if (UsuarioActual.CveEmpresa.Contiene(119)) - { - 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); - } - else - { - 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); - } - - List para = new List(); - para.Add(new CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa)); - para.Add(new CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre)); - para.Add(new CrystalParametro("Filtros", $"Filtros: {FechaI}{FechaF}")); - if (Imagen.Exists) - { - para.Add(new CrystalParametro("LogoPath", logouri)); - } - else - { - para.Add(new CrystalParametro("LogoPath", "")); - } - - DataTable Dt = TT.ActiveTabIndex == 0 ? DtIVATrasladado.Copy() : DtIVAAcreditable.Copy(); - string Formato = TT.ActiveTabIndex == 0 ? "RepIVA.rpt" : "RepIVAAcreditable.rpt"; - para.Add(new CrystalParametro("Excel", Formato)); - - ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath($"~/Empresas/Grales/Formatos/{Formato}"),Dt,para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion); - } - else - { - Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia); - } - } - - protected void BtnTipoCambio_Click(object sender, EventArgs e) - { - Consulta(); - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio")); - } - - protected void RblTipoCambio_SelectedIndexChanged(object sender, EventArgs e) - { - TipoCambio = RblTipoCambio.SelectedValue.ToEntero(); - if (TipoCambio == 3) - { - LiEspecifico.Visible = true; - TCEspecifico = get_GlobalTipoCambio(DateTime.Now).ToString().ToDouble(); - TxtEspecifico.Text = TCEspecifico.ToString(); - } - else - { - LiEspecifico.Visible = false; - } - UpBodyTipoCambio.Update(); - } - - - protected string GenerarDIOT() - { - System.Text.StringBuilder Respuesta = new System.Text.StringBuilder(); - - - - return Respuesta.ToString(); - } - - protected void LnkAccionesDIOT_Click(object sender, EventArgs e) - { - - ClsContabilidad Objconta = new ClsContabilidad(); - StringBuilder SBDIOT = new StringBuilder(); - int Conciliado = DdlTipoMovto.SelectedValue.ToEntero(); - - 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) - { - SBDIOT.AppendLine( - Drow["TipoTercero"].ToString() + "|" + - Drow["TipoOperacion"].ToString() + "|" + - Drow["RFC"].ToString() +"|"+ - Drow["NumeroIDFiscal"].ToString() + "|" + - Drow["NombreExtranjero"].ToString() +"|"+ - Drow["PaisResidencia"].ToString() + "|" + - Drow["Nacionalidad"].ToString() +"|"+ - LV(Drow["valorActos1516"].ToString()) + "|"+ - LV(Drow["valorActos15"].ToString()) + "|" + - LV(Drow["ValorIvaNo1516"].ToString()) +"|"+ - - LV(Drow["valorActos1011"].ToString()) + "|" + - LV(Drow["valorActos10"].ToString()) + "|" + - LV(Drow["valorActosImp8"].ToString()) + "|" + - LV(Drow["ValorIvaNo10"].ToString()) + "|" + - LV(Drow["ValorIvaNo08"].ToString()) + "|" + - - LV(Drow["valorActosImp1516"].ToString()) + "|" + - LV(Drow["ValorIvaNoImp16"].ToString()) + "|" + - - LV(Drow["valorActosImp10"].ToString()) + "|" + - LV(Drow["ValorIvaNoImp10"].ToString()) + "|" + - - LV(Drow["IvaExentoImpo"].ToString()) + "|"+ - LV(Drow["IVACero"].ToString()) + "|" + - LV(Drow["IvaExento"].ToString()) + "|"+ - LV(Drow["IvaRetenido"].ToString()) + "|" + - LV(Drow["IvaDevoluciones"].ToString()) + "|"); - } - } - - Objconta.Dispose(); - - //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(); - - Response.Clear(); - Response.ClearHeaders(); - - Response.AppendHeader("Content-Length", SBDIOT.ToString().Length.ToString()); - Response.ContentType = "text/plain"; - Response.AppendHeader("Content-Disposition", $"attachment;filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt"); - - Response.Write(SBDIOT.ToString()); - Response.End(); - } - - protected string LV(string Valor ) - { - return (Valor.ToDecimal() > 0) ? Valor.ToDecimal().ToString().FormatoNumero(0).Replace(",", string.Empty) : ""; - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; +using static Extensiones.ModExtensiones; +using Microsoft.Reporting.WebForms; +using System.Activities.Expressions; +using System.Text; +using System.IO; + +public partial class Contabilidad_RepIVA : ClsPaginas +{ + #region PROPIEDADES + + private DataTable DtIVATrasladado + { + get { return DtIVATrasladado = (DataTable)ViewState["DtIVATrasladado"]; } + set { ViewState["DtIVATrasladado"] = value; } + } + private DataTable DtIVAAcreditable + { + get { return DtIVAAcreditable = (DataTable)ViewState["DtIVAAcreditable"]; } + set { ViewState["DtIVAAcreditable"] = value; } + } + private double TCEspecifico + { + get { return TCEspecifico = (double)ViewState["TCEspecifico"]; } + set { ViewState["TCEspecifico"] = value; } + } + + private int TipoCambio + { + get { return TipoCambio = (int)ViewState["TipoCambio"]; } + set { ViewState["TipoCambio"] = value; } + } + + #endregion + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + InicializaValores(); + + } + } + + public void InicializaValores() + { + TipoCambio = 1; + TCEspecifico = -1; + txtFechaI.Text = $"01/{DateTime.Now.Month}/{DateTime.Now.Year}"; + txtFechaF.Text = DateTime.Now.ToShortDateString(); + + LnkAccionesDIOT.Visible = true; + + } + + public void Consulta() + { + if (TipoCambio == 3 && TxtEspecifico.Text != "") { TCEspecifico = TxtEspecifico.Text.ToDouble(); } else { TCEspecifico = -1; } + int Conciliado = DdlTipoMovto.SelectedValue.ToEntero(); + LblMsgAcreditable.Text = ""; // lbl de mensajes de negativos + + ClsContabilidad ObjCont = new ClsContabilidad(); + if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 1, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) + { + GvT.DataSource = ObjCont.DtResultados; + DtIVATrasladado = ObjCont.DtResultados; + if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + GvIEPSA.DataSource = ObjCont.DtResultados; + } + + if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + GvIVAA.DataSource = ObjCont.DtResultados; + } + + } + if (ObjCont.GetRepIVA(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), 2, UsuarioActual.CveUsuario, Conciliado, UsuarioActual.CveEmpresa, TipoCambio, TCEspecifico)) + { + GvA.DataSource = ObjCont.DtResultados; + DtIVAAcreditable = ObjCont.DtResultados; + 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"; + } + + + if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + { + GvIVA2.DataSource = ObjCont.DtResultados; + } + + + } + ObjCont.Dispose(); + GvT.DataBind(); + GvA.DataBind(); + GvIEPSA.DataBind(); + GvIVAA.DataBind(); + GvIVA2.DataBind(); + UpDatos.Update(); + } + + protected void BtnConsultar_Click(object sender, EventArgs e) + { + Consulta(); + } + + protected void GvIVATrasladado_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + if (e.Row.DBCampo("CveVenta").ToEntero() < 1) + { + e.Row.CssClass = "Totales"; + } + } + } + + protected void GvIVAAcreditable_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + if (e.Row.DBCampo("CveCompra").ToEntero() < 1) + { + e.Row.CssClass = "Totales"; + } + 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 dif = Math.Round(SubTotal * e.Row.DBCampo("PorcentajeIVA").ToDecimal(), 2) - Math.Round(e.Row.DBCampo("IVA").ToDecimal(), 2); + if (dif > 1) + { + e.Row.ForeColor = System.Drawing.Color.Red; + 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"); + } + } + } + } + + protected void LnkPdf_Click(object sender, EventArgs e) + { + Imprimir("PDF"); + } + + protected void LnkExcel_Click(object sender, EventArgs e) + { + Imprimir("EXCEL"); + } + + public void Imprimir(String Opcion) + { + String FechaF; + if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $" Fecha Final: {txtFechaF.Text}"; } + String FechaI; + if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $" Fecha Inicial: {txtFechaI.Text}"; } + if (DtIVATrasladado.Rows.Count > 0 || DtIVAAcreditable.Rows.Count > 0) + { + System.IO.FileInfo Imagen; + String logouri = ""; + + if (UsuarioActual.CveEmpresa.Contiene(119)) + { + 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); + } + else + { + 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); + } + + List para = new List(); + para.Add(new CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa)); + para.Add(new CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre)); + para.Add(new CrystalParametro("Filtros", $"Filtros: {FechaI}{FechaF}")); + if (Imagen.Exists) + { + para.Add(new CrystalParametro("LogoPath", logouri)); + } + else + { + para.Add(new CrystalParametro("LogoPath", "")); + } + + DataTable Dt = TT.ActiveTabIndex == 0 ? DtIVATrasladado.Copy() : DtIVAAcreditable.Copy(); + string Formato = TT.ActiveTabIndex == 0 ? "RepIVA.rpt" : "RepIVAAcreditable.rpt"; + para.Add(new CrystalParametro("Excel", Formato)); + + ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath($"~/Empresas/Grales/Formatos/{Formato}"),Dt,para, "Reporte de IVA", Opcion), "Reporte de IVA", Opcion); + } + else + { + Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia); + } + } + + protected void BtnTipoCambio_Click(object sender, EventArgs e) + { + Consulta(); + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivTipoCambio")); + } + + protected void RblTipoCambio_SelectedIndexChanged(object sender, EventArgs e) + { + TipoCambio = RblTipoCambio.SelectedValue.ToEntero(); + if (TipoCambio == 3) + { + LiEspecifico.Visible = true; + TCEspecifico = get_GlobalTipoCambio(DateTime.Now).ToString().ToDouble(); + TxtEspecifico.Text = TCEspecifico.ToString(); + } + else + { + LiEspecifico.Visible = false; + } + UpBodyTipoCambio.Update(); + } + + + protected string GenerarDIOT() + { + System.Text.StringBuilder Respuesta = new System.Text.StringBuilder(); + + + + return Respuesta.ToString(); + } + + protected void LnkAccionesDIOT_Click(object sender, EventArgs e) + { + + ClsContabilidad Objconta = new ClsContabilidad(); + StringBuilder SBDIOT = new StringBuilder(); + int Conciliado = DdlTipoMovto.SelectedValue.ToEntero(); + + 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) + { + SBDIOT.AppendLine( + Drow["TipoTercero"].ToString() + "|" + + Drow["TipoOperacion"].ToString() + "|" + + Drow["RFC"].ToString() +"|"+ + Drow["NumeroIDFiscal"].ToString() + "|" + + Drow["NombreExtranjero"].ToString() +"|"+ + Drow["PaisResidencia"].ToString() + "|" + + Drow["Nacionalidad"].ToString() +"|"+ + LV(Drow["valorActos1516"].ToString()) + "|"+ + LV(Drow["valorActos15"].ToString()) + "|" + + LV(Drow["ValorIvaNo1516"].ToString()) +"|"+ + + LV(Drow["valorActos1011"].ToString()) + "|" + + LV(Drow["valorActos10"].ToString()) + "|" + + LV(Drow["valorActosImp8"].ToString()) + "|" + + LV(Drow["ValorIvaNo10"].ToString()) + "|" + + LV(Drow["ValorIvaNo08"].ToString()) + "|" + + + LV(Drow["valorActosImp1516"].ToString()) + "|" + + LV(Drow["ValorIvaNoImp16"].ToString()) + "|" + + + LV(Drow["valorActosImp10"].ToString()) + "|" + + LV(Drow["ValorIvaNoImp10"].ToString()) + "|" + + + LV(Drow["IvaExentoImpo"].ToString()) + "|"+ + LV(Drow["IVACero"].ToString()) + "|" + + LV(Drow["IvaExento"].ToString()) + "|"+ + LV(Drow["IvaRetenido"].ToString()) + "|" + + LV(Drow["IvaDevoluciones"].ToString()) + "|"); + } + } + + Objconta.Dispose(); + + //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(); + + Response.Clear(); + Response.ClearHeaders(); + + Response.AppendHeader("Content-Length", SBDIOT.ToString().Length.ToString()); + Response.ContentType = "text/plain"; + Response.AppendHeader("Content-Disposition", $"attachment;filename=DIOT_{ txtFechaI.Text.ToDate().ToString("ddMMyyyy") }_{txtFechaI.Text.ToDate().ToString("ddMMyyyy") }.txt"); + + Response.Write(SBDIOT.ToString()); + Response.End(); + } + + protected string LV(string Valor ) + { + return (Valor.ToDecimal() > 0) ? Valor.ToDecimal().ToString().FormatoNumero(0).Replace(",", string.Empty) : ""; + } } \ No newline at end of file diff --git a/Empresas/Grales/Formatos/RepClientesCxC.rpt b/Empresas/Grales/Formatos/RepClientesCxC.rpt index 85aa597c6..3e2e401dd 100644 Binary files a/Empresas/Grales/Formatos/RepClientesCxC.rpt and b/Empresas/Grales/Formatos/RepClientesCxC.rpt differ