-- ajustes para validación y carga de txt
This commit is contained in:
@@ -39,8 +39,8 @@
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>Tipo Reporte:</td>
|
||||
<td>
|
||||
<asp:DropDownList ID="DdlTipoReporte" CssClass="form-control input-sm select2me" runat="server">
|
||||
<td colspan="2">
|
||||
<asp:DropDownList ID="DdlTipoReporte" CssClass="form-control input-sm select2me" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoReporte_SelectedIndexChanged">
|
||||
<asp:ListItem Text="Catálogo Cuentas" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Balanza Comprobación" Value="2"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
@@ -54,21 +54,30 @@
|
||||
<td>Periodo: </td>
|
||||
<td>
|
||||
<asp:DropDownList ID="DdlPeriodo" CssClass="form-control input-sm select2me" runat="server">
|
||||
<asp:ListItem Text="Enero" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Febrero" Value="2"></asp:ListItem>
|
||||
<asp:ListItem Text="Marzo" Value="3"></asp:ListItem>
|
||||
<asp:ListItem Text="Abril" Value="4"></asp:ListItem>
|
||||
<asp:ListItem Text="Mayo" Value="5"></asp:ListItem>
|
||||
<asp:ListItem Text="Junio" Value="6"></asp:ListItem>
|
||||
<asp:ListItem Text="Julio" Value="7"></asp:ListItem>
|
||||
<asp:ListItem Text="Agosto" Value="8"></asp:ListItem>
|
||||
<asp:ListItem Text="Septiembre" Value="9"></asp:ListItem>
|
||||
<asp:ListItem Text="Enero" Value="01"></asp:ListItem>
|
||||
<asp:ListItem Text="Febrero" Value="02"></asp:ListItem>
|
||||
<asp:ListItem Text="Marzo" Value="03"></asp:ListItem>
|
||||
<asp:ListItem Text="Abril" Value="04"></asp:ListItem>
|
||||
<asp:ListItem Text="Mayo" Value="05"></asp:ListItem>
|
||||
<asp:ListItem Text="Junio" Value="06"></asp:ListItem>
|
||||
<asp:ListItem Text="Julio" Value="07"></asp:ListItem>
|
||||
<asp:ListItem Text="Agosto" Value="08"></asp:ListItem>
|
||||
<asp:ListItem Text="Septiembre" Value="09"></asp:ListItem>
|
||||
<asp:ListItem Text="Octubre" Value="10"></asp:ListItem>
|
||||
<asp:ListItem Text="Noviembre" Value="11"></asp:ListItem>
|
||||
<asp:ListItem Text="Diciembre" Value="12"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="trTipoEnvio" runat="server" visible="false">
|
||||
<td>Tipo Envío:</td>
|
||||
<td colspan="2">
|
||||
<asp:DropDownList ID="DdlTipoEnvío" CssClass="form-control input-sm select2me" runat="server">
|
||||
<asp:ListItem Text="Normal" Value="N"></asp:ListItem>
|
||||
<asp:ListItem Text="Complementaria" Value="C"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr />
|
||||
|
||||
@@ -102,7 +102,7 @@ Partial Class Contabilidad_ContabilidadElectronica
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
|
||||
Dim objconta As New ClsContabilidad
|
||||
If objconta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
DtCuentas = objconta.DtResultados
|
||||
DtCuentas = objconta.DtResultados.FiltraParametros("CodigoSAT <> ''")
|
||||
End If
|
||||
objconta.Dispose()
|
||||
Else
|
||||
@@ -119,11 +119,11 @@ Partial Class Contabilidad_ContabilidadElectronica
|
||||
|
||||
'CABECERA
|
||||
Str.Append("<?xml version=""1.0"" encoding=""UTF-8""?>")
|
||||
Str.Append("<catalogocuentas:Catalogo xsi:schemaLocation=""www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas/CatalogoCuentas_1_3.xsd"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" Version=""1.3"" ")
|
||||
Str.Append("<catalogocuentas:Catalogo xsi:schemaLocation=""http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas/CatalogoCuentas_1_3.xsd"" Version=""1.3"" ")
|
||||
Str.AppendFormat("RFC=""{0}"" ", UsuarioActual.Empresa.RFC)
|
||||
Str.AppendFormat("Mes=""{0}"" ", DdlPeriodo.SelectedValue)
|
||||
Str.AppendFormat("Mes=""{0}"" ", DdlPeriodo.SelectedValue.PadLeft(2, "0"c))
|
||||
Str.AppendFormat("Anio=""{0}"" ", DdlEjercicio.SelectedValue)
|
||||
Str.Append("xmlns:catalogocuentas=""www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas"">")
|
||||
Str.Append("xmlns:catalogocuentas=""http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">")
|
||||
|
||||
'DETALLES
|
||||
For Each Dr As DataRow In DtCuentas.Rows
|
||||
@@ -134,7 +134,7 @@ Partial Class Contabilidad_ContabilidadElectronica
|
||||
Str.AppendFormat("Desc=""{0}"" ", HttpUtility.HtmlEncode(Dr("Nombre").ToString))
|
||||
Str.AppendFormat("SubCtaDe=""{0}"" ", Dr("CodigoPadre").ToString)
|
||||
Str.AppendFormat("Nivel=""{0}"" ", Dr("Nivel").ToString)
|
||||
Str.AppendFormat("Natur=""{0}"" ", Dr("Tipo").ToString)
|
||||
Str.AppendFormat("Natur=""{0}"" ", If(Dr("Tipo").ToString.Contiene("A", "C", "D", "G", "H"), "D", "A")) 'Atributo requerido para expresar la naturaleza de la cuenta o subcuenta. (D - Deudora, A - Acreedora). ( Activo = D ) ( Pasivo = A ) ( Capital = A ) ( Ingreso = A ) ( Costo = D ) ( Gasto = D ) ( Resultado Integral de Financiamiento = D y/o A ) ( Cuentas de orden = D y/o A ). Existen cuentas de Activo, Pasivo y Capital que por su naturaleza pueden presentarse de manera Deudora o Acreedora.
|
||||
Else
|
||||
Str.AppendFormat("CodAgrup=""{0}"" ", Dr("CodAgrup").ToString)
|
||||
Str.AppendFormat("NumCta=""{0}"" ", Dr("NumCta").ToString)
|
||||
@@ -156,20 +156,30 @@ Partial Class Contabilidad_ContabilidadElectronica
|
||||
|
||||
'SOBREESCRIBE
|
||||
If System.IO.File.Exists(ArchivoCuentas) Then System.IO.File.Delete(ArchivoCuentas)
|
||||
|
||||
Dim fs As FileStream = File.Create(ArchivoCuentas)
|
||||
Dim info As Byte() = New UTF8Encoding(True).GetBytes(Str.ToString)
|
||||
fs.Write(info, 0, info.Length)
|
||||
fs.Close()
|
||||
Dim Archivo As New System.IO.FileInfo(ArchivoCuentas)
|
||||
'DESCARGA XML
|
||||
Dim DescargaZIP As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile()
|
||||
'Dim DescargaZIP As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile()
|
||||
|
||||
'If IO.File.Exists(ArchivoCuentas) Then DescargaZIP.AddFile(ArchivoCuentas, "")
|
||||
'generar el sello
|
||||
SellarXML(Str.ToString, ArchivoCuentas, 1)
|
||||
|
||||
If IO.File.Exists(ArchivoCuentas) Then DescargaZIP.AddFile(ArchivoCuentas, "")
|
||||
|
||||
DescargaZIP.Save(Response.OutputStream)
|
||||
Response.AddHeader("content-Disposition", String.Format("attachment; filename={0}{1}{2}CT.zip", UsuarioActual.Empresa.RFC, DdlEjercicio.SelectedValue, DdlPeriodo.SelectedValue.PadLeft(2, "0"c)))
|
||||
Response.ContentType = "application/zip"
|
||||
Response.End()
|
||||
|
||||
'SellarXML(Str.ToString, ArchivoCuentas, 1)
|
||||
'DescargaZIP.Save(Response.OutputStream)
|
||||
'Response.AddHeader("content-Disposition", String.Format("attachment; filename={0}{1}{2}CT.zip", UsuarioActual.Empresa.RFC, DdlEjercicio.SelectedValue, DdlPeriodo.SelectedValue.PadLeft(2, "0"c)))
|
||||
'Response.ContentType = "application/zip"
|
||||
'Response.End()
|
||||
HttpContext.Current.Response.Clear()
|
||||
HttpContext.Current.Response.ClearContent()
|
||||
HttpContext.Current.Response.ContentType = "application/xml"
|
||||
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
HttpContext.Current.Response.TransmitFile(ArchivoCuentas)
|
||||
'HttpContext.Current.Response.Flush()
|
||||
HttpContext.Current.Response.End()
|
||||
Archivo = Nothing
|
||||
End If
|
||||
|
||||
End Sub
|
||||
@@ -291,13 +301,15 @@ Partial Class Contabilidad_ContabilidadElectronica
|
||||
Str.Append("Version=""1.3"" ")
|
||||
|
||||
Str.AppendFormat("RFC=""{0}"" ", UsuarioActual.Empresa.RFC)
|
||||
Str.AppendFormat("Mes=""{0}"" ", DdlPeriodo.SelectedValue)
|
||||
Str.AppendFormat("Mes=""{0}"" ", DdlPeriodo.SelectedValue.PadLeft(2, "0"c))
|
||||
Str.AppendFormat("Anio=""{0}"" ", DdlEjercicio.SelectedValue)
|
||||
|
||||
Str.AppendFormat("TipoEnvio=""{0}"" ", "C")
|
||||
Str.AppendFormat("FechaModBal=""{0}"" >", FechaF.ToString("yyyy-MM-dd"))
|
||||
Str.AppendFormat("TipoEnvio=""{0}"" ", DdlTipoEnvío.SelectedValue)
|
||||
'SOLO CUANDO ES COMPLEMENTARIA
|
||||
If DdlTipoEnvío.SelectedValue = "C" Then Str.AppendFormat("FechaModBal=""{0}""", FechaF.ToString("yyyy-MM-dd"))
|
||||
Str.AppendFormat(">")
|
||||
'DETALLES
|
||||
For Each Dr As DataRow In DtCuentas.Rows
|
||||
For Each Dr As DataRow In DtCuentas.FiltraParametros("Codigo <> ''").Rows
|
||||
Str.Append("<bnc:Ctas ")
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
|
||||
Str.AppendFormat("NumCta=""{0}"" ", Dr("Codigo").ToString.Replace("-", ""))
|
||||
@@ -328,24 +340,50 @@ Partial Class Contabilidad_ContabilidadElectronica
|
||||
|
||||
'SOBREESCRIBE
|
||||
If System.IO.File.Exists(ArchivoBalanza) Then System.IO.File.Delete(ArchivoBalanza)
|
||||
'DESCARGA XML
|
||||
Dim DescargaZIP As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile()
|
||||
'generar el sello
|
||||
SellarXML(Str.ToString, ArchivoBalanza, 2)
|
||||
Dim fs As FileStream = File.Create(ArchivoBalanza)
|
||||
Dim info As Byte() = New UTF8Encoding(True).GetBytes(Str.ToString)
|
||||
fs.Write(info, 0, info.Length)
|
||||
fs.Close()
|
||||
Dim Archivo As New System.IO.FileInfo(ArchivoBalanza)
|
||||
|
||||
If IO.File.Exists(ArchivoBalanza) Then
|
||||
DescargaZIP.AddFile(ArchivoBalanza, "")
|
||||
End If
|
||||
HttpContext.Current.Response.Clear()
|
||||
HttpContext.Current.Response.ClearContent()
|
||||
HttpContext.Current.Response.ContentType = "application/xml"
|
||||
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
HttpContext.Current.Response.TransmitFile(ArchivoBalanza)
|
||||
'HttpContext.Current.Response.Flush()
|
||||
HttpContext.Current.Response.End()
|
||||
Archivo = Nothing
|
||||
|
||||
DescargaZIP.Save(Response.OutputStream)
|
||||
Response.AddHeader("content-Disposition", String.Format("attachment; filename={0}{1}{2}BN.zip", UsuarioActual.Empresa.RFC, DdlEjercicio.SelectedValue, DdlPeriodo.SelectedValue.PadLeft(2, "0"c)))
|
||||
Response.ContentType = "application/zip"
|
||||
Response.End()
|
||||
''SOBREESCRIBE
|
||||
'If System.IO.File.Exists(ArchivoBalanza) Then System.IO.File.Delete(ArchivoBalanza)
|
||||
''DESCARGA XML
|
||||
'Dim DescargaZIP As Ionic.Zip.ZipFile = New Ionic.Zip.ZipFile()
|
||||
''generar el sello
|
||||
'SellarXML(Str.ToString, ArchivoBalanza, 2)
|
||||
|
||||
'If IO.File.Exists(ArchivoBalanza) Then
|
||||
' DescargaZIP.AddFile(ArchivoBalanza, "")
|
||||
'End If
|
||||
|
||||
'DescargaZIP.Save(Response.OutputStream)
|
||||
'Response.AddHeader("content-Disposition", String.Format("attachment; filename={0}{1}{2}BN.zip", UsuarioActual.Empresa.RFC, DdlEjercicio.SelectedValue, DdlPeriodo.SelectedValue.PadLeft(2, "0"c)))
|
||||
'Response.ContentType = "application/zip"
|
||||
'Response.End()
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
Protected Sub DdlTipoReporte_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
|
||||
If DdlTipoReporte.SelectedValue = "1" Then
|
||||
trTipoEnvio.Visible = False
|
||||
ElseIf DdlTipoReporte.SelectedValue = "2" Then
|
||||
trTipoEnvio.Visible = True
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user