IE cancelacion, RegPrePolizasS contabilizar descontabilizar Folio opcional
This commit is contained in:
@@ -1171,13 +1171,14 @@ Public Class ClsContabilidad
|
||||
End Function
|
||||
|
||||
|
||||
Public Function ContabilizaDesContabilizaPrePoliza(CvePrePoliza As Integer, Contabilizar As Boolean, CveEmpresa As Integer) As Boolean
|
||||
Public Function ContabilizaDesContabilizaPrePoliza(CvePrePoliza As Integer, Contabilizar As Boolean, CveEmpresa As Integer, Optional Folio As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Conta_PrePolizasContabilizarDescontabilizar")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
|
||||
.Add("@Contabilizar", SqlDbType.Bit).Value = Contabilizar
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@Folio", SqlDbType.Int).Value = Folio
|
||||
.Add("@FolioPoliza", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||
End With
|
||||
Try
|
||||
|
||||
@@ -3243,7 +3243,7 @@ Public Class ClsNominas
|
||||
|
||||
Public Function GetLayoutAltaBanorte(CvePeriodo As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim retorno As Boolean = False
|
||||
DataAdapter("PA_Nom_Dispersionnomina", CommandType.StoredProcedure)
|
||||
DataAdapter("PA_Nom_LayoutAltaBanorteGet", CommandType.StoredProcedure)
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
@@ -3258,6 +3258,22 @@ Public Class ClsNominas
|
||||
End Function
|
||||
|
||||
|
||||
Public Function GetDispersionNominaBanorte(CvePeriodo As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim retorno As Boolean = False
|
||||
DataAdapter("PA_Nom_DispersionNominaBanorteGet", CommandType.StoredProcedure)
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener el layout de nominas Banorte.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return retorno
|
||||
End Function
|
||||
|
||||
|
||||
#Region "IDisposable Support"
|
||||
' IDisposable
|
||||
|
||||
@@ -4559,15 +4559,24 @@ Partial Class Bancos_IE
|
||||
|
||||
Dim TipoMovimiento As Integer = 1
|
||||
|
||||
Dim CveTipoTransaccionCancelacion As Integer = DdlTipoTransaccionCancelacion.SelectedValue.ToEntero
|
||||
|
||||
If ChkGeneraCancelacion.Checked AndAlso GeneraCancelacionEnCero Then
|
||||
GeneraCancelacionEnCero = False
|
||||
TipoMovimiento = 2
|
||||
|
||||
If DdlTipoTransaccionCancelacion.SelectedValue.ToEntero = -1 Then
|
||||
CveTipoTransaccionCancelacion = 16 'Validacion manual para solo enviar el correcto
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Dim CvePrePolizaCancelacion As Integer = 0
|
||||
|
||||
If Not GeneraCancelacionEnCero Then
|
||||
'CANCELA IE MES ANTERIOR
|
||||
CvePrePolizaCancelacion = Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate, TipoMovimiento:=TipoMovimiento, CveTipoTransaccionCancelacion:=DdlTipoTransaccionCancelacion.SelectedValue.ToEntero)
|
||||
CvePrePolizaCancelacion = Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate, TipoMovimiento:=TipoMovimiento,
|
||||
CveTipoTransaccionCancelacion:=CveTipoTransaccionCancelacion)
|
||||
If CvePrePolizaCancelacion <= 0 Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Error al cancelar IE MES ANTERIOR"
|
||||
@@ -4582,7 +4591,8 @@ Partial Class Bancos_IE
|
||||
MensajeError = "Error al desbloquear prepoliza."
|
||||
Else
|
||||
'CANCELA IE MES ACTUAL
|
||||
CvePrePolizaCancelacion = Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, False, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate, CveTipoTransaccionCancelacion:=DdlTipoTransaccionCancelacion.SelectedValue.ToEntero)
|
||||
CvePrePolizaCancelacion = Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, False, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate,
|
||||
CveTipoTransaccionCancelacion:=CveTipoTransaccionCancelacion)
|
||||
If CvePrePolizaCancelacion <= 0 Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Error al cancelar IE MES ACTUAL"
|
||||
@@ -4797,7 +4807,7 @@ Partial Class Bancos_IE
|
||||
Else
|
||||
|
||||
'siempre se hace una cancelación
|
||||
If Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, TxtFechaDevuelto.Text.ToDate, 2) <= 0 Then
|
||||
If Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, TxtFechaDevuelto.Text.ToDate, 2, 16) <= 0 Then
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
|
||||
|
||||
@@ -4054,9 +4054,7 @@ Partial Class Compras_Compras
|
||||
Protected Sub BtnGuardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnGuardar.Click
|
||||
|
||||
|
||||
'If Not AjustaCombustibles() Then
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
|
||||
'------------------ INICIA VALIDACIONES ------------------
|
||||
|
||||
@@ -4478,6 +4476,10 @@ Partial Class Compras_Compras
|
||||
|
||||
'------------------TERMINA VALIDACIONES------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'si hay necesidad de actualizar el globaldtps
|
||||
If RegeneraPS Then
|
||||
'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT)
|
||||
@@ -5935,7 +5937,10 @@ Partial Class Compras_Compras
|
||||
Dim IdCtaContable As Integer = 0
|
||||
Dim Concepto As String = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, NombreProveedor, $"{TxtSerie.Text}-{TxtFolio.Text}", If(TxtDocumentoFolio.Visible, TxtDocumentoFolio.Text, If(TxtDocumentoFolioCaja.Visible, TxtDocumentoFolioCaja.Text, ConceptoPersonal)))
|
||||
Dim importeMN As Decimal = 0
|
||||
Dim Multiplicador As Integer = If(Row("Multiplicador").ToString.ToEntero = 1, 1, -1)
|
||||
|
||||
Dim Multiplicador As Integer = If(Row("Multiplicador").ToString.ToEntero = 1, -1, 1)
|
||||
|
||||
|
||||
Dim Referencia As String = $"{TxtSerie.Text}-{TxtFolio.Text}" ' concatenation interpolation
|
||||
Dim PorcentajeImpuesto As Decimal = 0
|
||||
CveConceptoOriginal = ConceptoContable
|
||||
@@ -8980,7 +8985,7 @@ Partial Class Compras_Compras
|
||||
IdCtaContable = 0
|
||||
Dim Concepto As String = String.Format("{0}-{1}", TxtSerie.Text, TxtFolio.Text)
|
||||
Dim importeMN As Decimal = 0
|
||||
Dim Multiplicador As Integer = If(Row("Multiplicador").ToString.ToEntero = 1, 1, -1)
|
||||
Dim Multiplicador As Integer = If(Row("Multiplicador").ToString.ToEntero = 1, -1, 1)
|
||||
Dim PorcentajeImpuesto As Decimal = 0
|
||||
Dim ConceptoPartida As String = String.Format("{0}-{1}", TxtSerie.Text, TxtFolio.Text)
|
||||
|
||||
@@ -10599,7 +10604,7 @@ Partial Class Compras_Compras
|
||||
Dim importeMovimiento As Decimal = 0
|
||||
Dim IdCtaContable As Integer = 0
|
||||
Dim importeMN As Decimal = 0
|
||||
Dim Multiplicador As Integer = If(Row("Multiplicador").ToString.ToEntero = 1, 1, -1)
|
||||
Dim Multiplicador As Integer = If(Row("Multiplicador").ToString.ToEntero = 1, -1, 1)
|
||||
Dim Referencia As String = $"{TxtSerie.Text}-{TxtFolio.Text}" ' concatenation interpolation
|
||||
|
||||
Select Case ConceptoContable
|
||||
|
||||
@@ -713,18 +713,36 @@ Partial Class Compras_Proveedores
|
||||
Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix)
|
||||
Dim cfdVer As String = "http://www.sat.gob.mx/cfd/3"
|
||||
Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable)
|
||||
Dim nodo As XmlNode = XMLDoc.DocumentElement
|
||||
|
||||
If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
namespaces.AddNamespace(Prefijo, cfdVer)
|
||||
Dim nodo As XmlNode = XMLDoc.DocumentElement
|
||||
Dim Version As String = ValorXml(nodo, "Version")
|
||||
|
||||
|
||||
If Version = "3.2" Then
|
||||
Prefijo = "cfd"
|
||||
cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
ElseIf Version = "3.3" Then
|
||||
cfdVer = "http://www.sat.gob.mx/cfd/3"
|
||||
|
||||
Else ' se considera que es la version 4.0
|
||||
cfdVer = "http://www.sat.gob.mx/cfd/4"
|
||||
End If
|
||||
|
||||
|
||||
|
||||
'If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2"
|
||||
namespaces.AddNamespace(Prefijo, cfdVer)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Dim node As XmlNode
|
||||
node = XMLDoc.SelectSingleNode(String.Format("//{0}:Emisor", Prefijo), namespaces)
|
||||
If node IsNot Nothing Then
|
||||
TxtRFC.Text = ValorXml(node, "rfc")
|
||||
|
||||
If Version = "3.3" Then
|
||||
If Version = "3.3" Or Version = "4.0" Then
|
||||
TxtRazonSocial.Text = HttpUtility.HtmlDecode(ValorXml(node, "Nombre"))
|
||||
TxtNombreComercial.Text = HttpUtility.HtmlDecode(ValorXml(node, "Nombre"))
|
||||
ChkEstado.Checked = True
|
||||
|
||||
@@ -1700,7 +1700,7 @@ Partial Class Compras_eFacturas
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalFacturas"))
|
||||
|
||||
|
||||
asdasd
|
||||
|
||||
'Alert(String.Format("Se cargaron {0} Facturas", Arreglo.Count), TipoMensaje.MsgInformacion)
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -88,9 +88,9 @@
|
||||
|
||||
<asp:LinkButton ID="LnkAddConcepto" runat="server" OnClick="LnkAddConcepto_Click" Visible="true"><i class="fa fa-plus" ></i> Agregar Concepto</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkCrearAPartirDe" runat="server" Visible="false" OnClick="LnkCrearAPartirDe_Click" Style="color: #686868;"><i class="fa fa-plus" style="color:#686868;" ></i>Crear a partir de</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkCrearAPartirDe" runat="server" Visible="false" OnClick="LnkCrearAPartirDe_Click" Style="color: #686868;"><i class="fa fa-plus" style="color:#686868;" ></i>Crear a partir de</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
@@ -156,8 +156,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox CssClass="form-control" ID="TxtFolio" runat="server" MaxLength="15" Enabled="false"></asp:TextBox>
|
||||
<div class="form-group form-md-line-input input-group input-small ">
|
||||
<asp:TextBox CssClass="form-control" ID="TxtFolio" runat="server" MaxLength="15" Enabled="false" Width="100%"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton runat="server" ID="LnkFolioManual" CssClass="blue" Visible="false"> <i class="fa fa-pencil" aria-hidden="true"></i></asp:LinkButton>
|
||||
</span>
|
||||
|
||||
|
||||
|
||||
<label for="<%= TxtFolio.ClientID.ToString()%>">Folio: </label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -710,6 +716,8 @@
|
||||
<asp:ValidationSummary ID="VS" runat="server" DisplayMode="BulletList" ShowSummary="true" ValidationGroup="GrpGuardar" />
|
||||
<asp:Button ID="BtnEliminar" runat="server" Text="Eliminar" class="btn btn-danger" />
|
||||
<asp:Button ID="BtnContabilizar" runat="server" Text="Contabilizar" CssClass="btn btn-primary green" Visible="false" />
|
||||
<asp:Button ID="BtnDescontabilizar" runat="server" Text="Descontabilizar" CssClass="btn btn-primary" Visible="false"
|
||||
data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="si" />
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</td>
|
||||
|
||||
@@ -277,6 +277,21 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
ValidaCrearAPartirDe()
|
||||
DvPlantilla.Visible = False
|
||||
UPPDocumento.Visible = False
|
||||
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
|
||||
|
||||
If Folio.ToEntero > 0 Then
|
||||
BtnDescontabilizar.Visible = True
|
||||
LnkFolioManual.Visible = False
|
||||
Else
|
||||
BtnDescontabilizar.Visible = False
|
||||
LnkFolioManual.Visible = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Exit Sub
|
||||
|
||||
ElseIf Request("CvePrePolizaOrigen") IsNot Nothing AndAlso IsNumeric(Request("CvePrePolizaOrigen")) AndAlso Request("CvePrePolizaOrigen").ToEntero > 0 Then
|
||||
@@ -2695,22 +2710,51 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
|
||||
If IdPoliza > 0 Then 'si está bloqueada, lo desbloqueaprimero
|
||||
ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False)
|
||||
End If
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
|
||||
|
||||
If Folio.ToEntero = 0 Then
|
||||
|
||||
Dim FolioManual As Integer = If(TxtFolio.Text.ToEntero > 0, TxtFolio.Text.ToEntero, -1)
|
||||
|
||||
|
||||
|
||||
If ObjConta.ContabilizaDesContabilizaPrePoliza(CvePrePoliza, True, UsuarioActual.CveEmpresa, Folio:=FolioManual) Then
|
||||
|
||||
Alert($"Contabilizado Correctamente Folio <b>{ ObjConta.ContaFolio.ToString()}.</b>", TipoMensaje.MsgInformacion)
|
||||
|
||||
TxtFolio.Text = ObjConta.ContaFolio.ToString()
|
||||
LnkFolioManual.Visible = False
|
||||
UpPoliza.Update()
|
||||
|
||||
End If
|
||||
|
||||
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, pIDPoliza:=If(IdPoliza > 0, IdPoliza, -1), Concepto:=TxtConcepto.Text, Fecha:=TxtFechaDocumento.Text.ToDateTime()) Then
|
||||
If UsuarioActual.Empresa.TipoContabilizacion = 1 Then
|
||||
Alert(String.Format("Prepóliza contabilizada. <br/><br/>Folio: <b>{0}</b> ", ObjConta.FolioPoliza), ModExtensiones.TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert(String.Format("Prepóliza contabilizada. <br/><br/>Folio:<a Class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", ObjConta.ContaIdPoliza), ModExtensiones.TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
Alert($"Ocurrio un error al contabilizar {ObjConta.AlertaMensaje}", TipoMensaje.MsgAdvertencia)
|
||||
|
||||
If IdPoliza > 0 Then 'si está bloqueada, lo desbloqueaprimero
|
||||
ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False)
|
||||
End If
|
||||
|
||||
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, pIDPoliza:=If(IdPoliza > 0, IdPoliza, -1), Concepto:=TxtConcepto.Text, Fecha:=TxtFechaDocumento.Text.ToDateTime()) Then
|
||||
If UsuarioActual.Empresa.TipoContabilizacion = 1 Then
|
||||
Alert(String.Format("Prepóliza contabilizada. <br/><br/>Folio: <b>{0}</b> ", ObjConta.FolioPoliza), ModExtensiones.TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert(String.Format("Prepóliza contabilizada. <br/><br/>Folio:<a Class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", ObjConta.ContaIdPoliza), ModExtensiones.TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
Alert($"Ocurrio un error al contabilizar {ObjConta.AlertaMensaje}", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ObjConta.Dispose()
|
||||
End Sub
|
||||
|
||||
@@ -3159,13 +3203,38 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
Private Sub BtnDescontabilizar_Click(sender As Object, e As EventArgs) Handles BtnDescontabilizar.Click
|
||||
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
|
||||
|
||||
If ObjConta.ContabilizaDesContabilizaPrePoliza(CvePrePoliza, False, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Descontabilizado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
TxtFolio.Text = ""
|
||||
LnkFolioManual.Visible = True
|
||||
End If
|
||||
|
||||
ObjConta.Dispose()
|
||||
|
||||
UpPoliza.Update()
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub LnkFolioManual_Click(sender As Object, e As EventArgs) Handles LnkFolioManual.Click
|
||||
|
||||
TxtFolio.Enabled = True
|
||||
TxtFolio.Focus()
|
||||
UpPoliza.Update()
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
@@ -910,8 +910,13 @@ Partial Class RepCxCDetalle
|
||||
'End If
|
||||
|
||||
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 As String = ""
|
||||
If Imagen.Exists Then
|
||||
logouri = String.Format("file://{0}", Imagen.FullName)
|
||||
End If
|
||||
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("FechaInicio", FechaI))
|
||||
|
||||
@@ -4227,13 +4227,13 @@
|
||||
<div class="modal-body">
|
||||
|
||||
|
||||
<div class="form-group form-md-line-input">
|
||||
<%-- <div class="form-group form-md-line-input">
|
||||
<asp:RadioButtonList runat="server" ID="RBLModalBancosLayout" RepeatDirection="Horizontal" CssClass=" form-control input-sm" >
|
||||
<asp:ListItem Value="1" Selected="True">Generar Layout</asp:ListItem>
|
||||
<asp:ListItem Value="2">Altas Nomina</asp:ListItem>
|
||||
</asp:RadioButtonList>
|
||||
<asp:Label runat="server" AssociatedControlID="RBLModalBancosLayout">Tipo Operacóon:</asp:Label>
|
||||
</div>
|
||||
</div>--%>
|
||||
|
||||
<div class="form-group form-md-line-input">
|
||||
<asp:DropDownList ID="DdlModalBancosLayout" CssClass=" form-control input-sm select2me" runat="server" Width="100%">
|
||||
|
||||
@@ -1298,8 +1298,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
string RFCReceptor = Nom.RFC;
|
||||
string RFCEmisor = UsuarioActual.Empresa.RFC;
|
||||
string SerieFolio = Nom.SerieFolio;
|
||||
string SerieFolioFiniquito = string.Format ("{0}F-{1}", nrow["Serie"], nrow["Folio"]);
|
||||
bool SeTimbroFiniquito = nrow["SeTimbroFiniquito"].ToString().ToUpper().Contiene(new string[] {"1","TRUE"});
|
||||
string SerieFolioFiniquito = string.Format("{0}F-{1}", nrow["Serie"], nrow["Folio"]);
|
||||
bool SeTimbroFiniquito = nrow["SeTimbroFiniquito"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" });
|
||||
string FolioFiscalFiniquito = nrow["FolioFiscalFiniquito"].ToString();
|
||||
//SeTimbroFiniquito,N.FolioFiscalFiniquito
|
||||
DataRow rowc = get_GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa).FiltroPrimero(string.Format("CveMotivoCancelacion={0}", DdlMotivoCancelacion.SelectedValue));
|
||||
@@ -1341,33 +1341,33 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
}
|
||||
else
|
||||
{
|
||||
reultado = ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscalFiniquito, Total, RFCReceptor, RFCEmisor, 4, CveSATMotivoCancelacion: CveMotivoCancelacion);
|
||||
if (reultado.Verificado)//,CveSATMotivoCancelacion:=
|
||||
{
|
||||
try
|
||||
reultado = ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscalFiniquito, Total, RFCReceptor, RFCEmisor, 4, CveSATMotivoCancelacion: CveMotivoCancelacion);
|
||||
if (reultado.Verificado)//,CveSATMotivoCancelacion:=
|
||||
{
|
||||
string ruta = string.Format("{0}XML\\Nomina\\", UsuarioActual.Empresa.Ruta);
|
||||
string archivo = string.Format("{0}{1}.xml", ruta, SerieFolioFiniquito);
|
||||
int contador = 1;
|
||||
string archivonew = string.Format("{0}{1}_{2}.xml", ruta, SerieFolioFiniquito, contador++);
|
||||
while (System.IO.File.Exists(archivonew))
|
||||
try
|
||||
{
|
||||
archivonew = string.Format("{0}{1}_{2}.xml", ruta, SerieFolioFiniquito, contador++);
|
||||
string ruta = string.Format("{0}XML\\Nomina\\", UsuarioActual.Empresa.Ruta);
|
||||
string archivo = string.Format("{0}{1}.xml", ruta, SerieFolioFiniquito);
|
||||
int contador = 1;
|
||||
string archivonew = string.Format("{0}{1}_{2}.xml", ruta, SerieFolioFiniquito, contador++);
|
||||
while (System.IO.File.Exists(archivonew))
|
||||
{
|
||||
archivonew = string.Format("{0}{1}_{2}.xml", ruta, SerieFolioFiniquito, contador++);
|
||||
}
|
||||
File.Move(archivo, archivonew);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Alert("Ocurrió un error al mover el archivo fiscal cancelado");
|
||||
}
|
||||
File.Move(archivo, archivonew);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Alert("Ocurrió un error al mover el archivo fiscal cancelado");
|
||||
}
|
||||
|
||||
secancelo12 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
string.Format("Error al cancelar nomina {0}", FolioFiscalFiniquito).GuardaLog();
|
||||
//ObjTimbrado.MensajeErrorCFDI.GuardaLog();
|
||||
}
|
||||
secancelo12 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
string.Format("Error al cancelar nomina {0}", FolioFiscalFiniquito).GuardaLog();
|
||||
//ObjTimbrado.MensajeErrorCFDI.GuardaLog();
|
||||
}
|
||||
|
||||
}
|
||||
if (secancelo11 && secancelo12)
|
||||
@@ -1375,7 +1375,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
Nom.UpdateEstatusNomNominas(2, UsuarioActual.Empresa.CvePAC, "", ("01/01/2000").ToDate(), ("01/01/2000").ToDate(), CveNomina);
|
||||
Alert($"La nómina con folio fiscal '{FolioFiscal}' fue cancelada ante el SAT", TipoMensaje.MsgInformacion);
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert($"no se pudo cancelar el folio fiscal<br>{ObjTimbrado.MensajeErrorCFDI}", TipoMensaje.MsgAdvertencia);
|
||||
|
||||
@@ -5636,7 +5637,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
ChkEstatus.Checked = true;
|
||||
UpMovtosPermanentesModal.Update();
|
||||
RegistraScript("$('#ModalMovtoPermanente').modal()");
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void LnkAddMovto_Click(object sender, EventArgs e)
|
||||
@@ -5718,7 +5719,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
this.Alert("Se ha eliminadó el movimiento permanente");
|
||||
}
|
||||
}
|
||||
protected void LnkEditarMovtoPermanente_Click(object sender, EventArgs e)
|
||||
protected void LnkEditarMovtoPermanente_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
@@ -7662,9 +7663,9 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
}
|
||||
loadtablas();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected void LnkAsistenciaIncidencias_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -8112,7 +8113,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
protected void LnkLayoutContable_Click(object sender, EventArgs e)
|
||||
{
|
||||
RBLModalBancosLayout.SelectedValue = "1";
|
||||
// RBLModalBancosLayout.SelectedValue = "1";
|
||||
DdlModalBancosLayout.SelectedValueExist("-1");
|
||||
this.RegistraScript("$('#ModalLayoutBancos').modal('show');");
|
||||
UpModalBancosLayout.Update();
|
||||
@@ -8127,35 +8128,51 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
protected void BtnModalBancosProcesar_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(RBLModalBancosLayout.SelectedValue.ToEntero() == 1)
|
||||
//if (RBLModalBancosLayout.SelectedValue.ToEntero() == 1)
|
||||
//{
|
||||
if (DdlModalBancosLayout.SelectedValue.ToEntero() == 1)
|
||||
{
|
||||
if (DdlModalBancosLayout.SelectedValue.ToEntero() == 1)
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
if (objnom.GetDispersionnomina(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
if (objnom.GetDispersionnomina(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
CrearLayoutNominaBancomer(objnom.DtResultados);
|
||||
}
|
||||
CrearLayoutNominaBancomer(objnom.DtResultados);
|
||||
}
|
||||
|
||||
}
|
||||
else if (DdlModalBancosLayout.SelectedValue.ToEntero() == 2)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else if (RBLModalBancosLayout.SelectedValue.ToEntero() == 2)
|
||||
else if (DdlModalBancosLayout.SelectedValue.ToEntero() == 2)
|
||||
{
|
||||
if(DdlModalBancosLayout.SelectedValue.ToEntero() == 1 )
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
|
||||
}
|
||||
else if (DdlModalBancosLayout.SelectedValue.ToEntero() == 2)
|
||||
{
|
||||
//Banorte
|
||||
if (objnom.GetDispersionNominaBanorte(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
CrearLayoutNominaBanorte(objnom.DtResultados, "1234");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//}
|
||||
//else if (RBLModalBancosLayout.SelectedValue.ToEntero() == 2)
|
||||
//{
|
||||
// if (DdlModalBancosLayout.SelectedValue.ToEntero() == 1)
|
||||
// {
|
||||
// //Sin Alta
|
||||
// }
|
||||
// else if (DdlModalBancosLayout.SelectedValue.ToEntero() == 2)
|
||||
// {
|
||||
// //Banorte
|
||||
|
||||
// using (ClsNominas objnom = new ClsNominas())
|
||||
// {
|
||||
// if (objnom.GetLayoutAltaBanorte(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
|
||||
// {
|
||||
// CrearLayoutAltaBanorte(objnom.DtResultados, " 04539871", "12345", UsuarioActual.Empresa.Empresa);
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@@ -8255,109 +8272,594 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
|
||||
|
||||
private void CrearLayoutAltaBanorte(DataTable DTNomina, string Promotor, string NIE, string RazonSocial)
|
||||
//private void CrearLayoutAltaBanorte(DataTable DTNomina, string Promotor, string NIE, string RazonSocial)
|
||||
//{
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// StringBuilder SbErrores = new StringBuilder();
|
||||
|
||||
// char Cero = '0';
|
||||
// char Espacio = ' ';
|
||||
|
||||
// bool ErrorProceso = false;
|
||||
|
||||
|
||||
|
||||
// Promotor = Promotor.Trim();
|
||||
// NIE = NIE.Trim();
|
||||
// RazonSocial = RazonSocial.Trim();
|
||||
|
||||
// //SbErrores.AppendLine("Se detectaron los siguientes errores en la generación del layout");
|
||||
|
||||
|
||||
|
||||
// if (DTNomina.Rows.Count > 0)
|
||||
// {
|
||||
|
||||
// //Tip oRegistro 1 1-1
|
||||
// //Clave servicio 2 2-3
|
||||
// sb.Append($"HNE");
|
||||
|
||||
|
||||
// //Promotor 8 4-11
|
||||
// if (Promotor.Length > 0 && Promotor.Length <= 8)
|
||||
// {
|
||||
// sb.Append(Promotor.PadLeft(8, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"Promotor {Promotor} debe de tener una logitud de entre 1 y 8<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //NIE 5 12-26
|
||||
// if (ErrorProceso == false && NIE.Length > 0 && NIE.Length <= 5)
|
||||
// {
|
||||
// sb.Append(NIE.PadLeft(5, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"NIE {NIE} debe de tener una logitud de entre 1 y 8<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
|
||||
// //Nombre de Empresa ó Razón Social 40 17-56
|
||||
// if (ErrorProceso == false && RazonSocial.Length > 0 && RazonSocial.Length <= 40)
|
||||
// {
|
||||
// sb.Append(RazonSocial.PadLeft(40, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"RazonSocial {RazonSocial} debe de tener una logitud de entre 1 y 40<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //57-58consecutivo 1
|
||||
// sb.Append("1");
|
||||
|
||||
|
||||
// //Número de registros N 6 59-64
|
||||
// sb.Append(DTNomina.Rows.ToString().PadRight(6, Espacio));
|
||||
|
||||
// //Filler A 283 65-347
|
||||
// sb.Append(DTNomina.Rows.ToString().PadLeft(283, Espacio));
|
||||
|
||||
|
||||
|
||||
// if (!ErrorProceso)
|
||||
// {
|
||||
// foreach (DataRow dRow in DTNomina.Rows)
|
||||
// {
|
||||
|
||||
|
||||
// string CodigoEmpleado = dRow["Codigo"].ToString().Trim();
|
||||
// string Nombres = dRow["Nombres"].ToString().Trim();
|
||||
// string APaterno = dRow["APaterno"].ToString().Trim();
|
||||
// string Amaterno = dRow["AMaterno"].ToString().Trim();
|
||||
// string CodigoNacionalOperacion = dRow["CodigoNacionalOperacion"].ToString().Trim();
|
||||
// string NombreCorto = dRow["NombreCorto"].ToString().Trim();
|
||||
// string TipoDeVia = dRow["TipoDeVia"].ToString().Trim();
|
||||
// string Direccion = dRow["Direccion"].ToString().Trim();
|
||||
// string NumExt = dRow["NumExt"].ToString().Trim();
|
||||
// string TipoDeVivienda = dRow["TipoDeVivienda"].ToString().Trim();
|
||||
// string Colonia = dRow["Colonia"].ToString().Trim();
|
||||
// string DelegacionMunicipio = dRow["DelegacionMunicipio"].ToString().Trim();
|
||||
// string ClaveEstado = dRow["ClaveEstado"].ToString().Trim();
|
||||
// string CP = dRow["CP"].ToString().Trim();
|
||||
// string Sexo = dRow["Sexo"].ToString().Trim();
|
||||
// DateTime FechaNacimiento = dRow["FechaNacimiento"].ToString().ToDate();
|
||||
// string Nacionalidad = dRow["Nacionalidad"].ToString().Trim();
|
||||
// string EstadoCivil = dRow["EstadoCivil"].ToString().Trim();
|
||||
// string Escolaridad = dRow["Escolaridad"].ToString().Trim();
|
||||
// string TipoEmpleado = dRow["TipoEmpleado"].ToString().Trim();
|
||||
// string RFC = dRow["RFC"].ToString().Trim();
|
||||
// string TipoAlta = dRow["TipoAlta"].ToString().Trim();
|
||||
// string TipoDeTarjeta = dRow["TipoDeTarjeta"].ToString().Trim();
|
||||
// string CodigoDeBanco = dRow["CodigoDeBanco"].ToString().Trim();
|
||||
// string TipoCuenta = dRow["TipoCuenta"].ToString().Trim();
|
||||
// string Cuenta = dRow["Cuenta"].ToString().Trim();
|
||||
// string ImpresionContrato = dRow["ImpresionContrato"].ToString().Trim();
|
||||
|
||||
|
||||
// //Tipo de registro A 1 1-1
|
||||
// sb.AppendLine("D");
|
||||
|
||||
|
||||
// //CodigoEmpleado A 10 2-11
|
||||
// if (ErrorProceso == false && CodigoEmpleado.Length > 0 && CodigoEmpleado.Trim().Length <= 10)
|
||||
// {
|
||||
// sb.Append(CodigoEmpleado.PadLeft(10, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"Codigo {CodigoEmpleado} debe de tener una logitud de entre 1 y 10<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
|
||||
// //Nombres A 20 12-31
|
||||
// if (ErrorProceso == false && Nombres.Length > 0 && Nombres.Trim().Length <= 20)
|
||||
// {
|
||||
// sb.Append(Nombres.PadRight(20, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Nombre {Nombres} debe de tener una logitud de entre 1 y 20<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
|
||||
// //Apellido Paterno A 20 32-51
|
||||
// if (ErrorProceso == false && APaterno.Length > 0 && APaterno.Trim().Length <= 20)
|
||||
// {
|
||||
// sb.Append(APaterno.PadRight(20, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Apellido Paterno {APaterno} debe de tener una logitud de entre 1 y 20<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
|
||||
// //Aperllido Materno A 20 52-71
|
||||
// if (ErrorProceso == false && Amaterno.Length > 0 && Amaterno.Trim().Length <= 20)
|
||||
// {
|
||||
// sb.Append(Amaterno.PadRight(20, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Apellido Materno {Amaterno} debe de tener una logitud de entre 1 y 20<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// // Dependencia A 5 72-76
|
||||
// sb.Append(string.Empty.PadRight(5, Espacio)); // No requerido
|
||||
|
||||
|
||||
// //CodigoNacionalOperacion N 2 77-78 Anexo 1
|
||||
// if (ErrorProceso == false && CodigoNacionalOperacion.Length > 0 && CodigoNacionalOperacion.Trim().Length <= 2)
|
||||
// {
|
||||
// sb.Append(CodigoNacionalOperacion.PadLeft(2, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Codigo Nacional de Operación {CodigoNacionalOperacion} debe de tener una logitud de entre 1 y 20<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
|
||||
// //NombreCorto A 19 79-97
|
||||
// if (ErrorProceso == false && NombreCorto.Length > 0 && NombreCorto.Trim().Length <= 19)
|
||||
// {
|
||||
// sb.Append(NombreCorto.PadRight(19, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Nombre Corto{NombreCorto} debe de tener una logitud de entre 1 y 19<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
|
||||
// //TipoDeVia A 2 98-99 Anexo 2
|
||||
// if (ErrorProceso == false && TipoDeVia.Length > 0 && TipoDeVia.Trim().Length <= 2)
|
||||
// {
|
||||
// sb.Append(TipoDeVia.PadRight(2, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Tipo De Via {TipoDeVia} debe de tener una logitud de entre 1 y 2<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// //Calle A 24 100-123
|
||||
// if (ErrorProceso == false && Direccion.Length > 0 && Direccion.Trim().Length <= 24)
|
||||
// {
|
||||
// sb.Append(Direccion.PadRight(24, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Calle {Direccion} debe de tener una logitud de entre 1 y 24<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// //Numero A 7 124-130
|
||||
// if (ErrorProceso == false && NumExt.Length > 0 && NumExt.Trim().Length <= 7)
|
||||
// {
|
||||
// sb.Append(NumExt.PadRight(7, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Tipo De Via {NumExt} debe de tener una logitud de entre 1 y 7<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //TipoDeVivienda N 2 131-132
|
||||
// if (ErrorProceso == false && TipoDeVivienda.Length > 0 && TipoDeVivienda.Trim().Length <= 2)
|
||||
// {
|
||||
// sb.Append(TipoDeVivienda.PadLeft(2, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Tipo de Vivienda {TipoDeVivienda} debe de tener una logitud de entre 1 y 2<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //Entrada A 2 133-134
|
||||
// sb.Append(string.Empty.PadRight(2, Espacio)); // No requerido
|
||||
|
||||
// //Piso A 5 135-136
|
||||
// sb.Append(string.Empty.PadRight(2, Espacio)); // No requerido
|
||||
|
||||
// //Deparatmento A 4 137-140
|
||||
// sb.Append(string.Empty.PadRight(4, Espacio)); // No requerido
|
||||
|
||||
|
||||
// //Colonia A 40 141-180
|
||||
// if (ErrorProceso == false && Colonia.Length > 0 && Colonia.Trim().Length <= 40)
|
||||
// {
|
||||
// sb.Append(Colonia.PadRight(40, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Colonia Municipio {Colonia} debe de tener una logitud de entre 1 y 40<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
|
||||
// //DelegacionMunicipio N 3 181-183
|
||||
// if (ErrorProceso == false && DelegacionMunicipio.Length > 0 && DelegacionMunicipio.Trim().Length <= 3)
|
||||
// {
|
||||
// sb.Append(DelegacionMunicipio.PadLeft(3, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Delegacion Municipio {DelegacionMunicipio} debe de tener una logitud de entre 1 y 3<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //ClaveEstado N 2 184-185
|
||||
// if (ErrorProceso == false && ClaveEstado.Length > 0 && ClaveEstado.Trim().Length <= 2)
|
||||
// {
|
||||
// sb.Append(ClaveEstado.PadLeft(2, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Clave Estado {ClaveEstado} debe de tener una logitud de entre 1 y 2<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //Codigo Postal N 5 186-190
|
||||
// if (ErrorProceso == false && CP.Length > 0 && CP.Trim().Length <= 5)
|
||||
// {
|
||||
// sb.Append(CP.PadLeft(5, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Codigo Postal {CP} debe de tener una logitud de entre 1 y 5<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //Telefono A 12 191-202
|
||||
// sb.Append(string.Empty.PadRight(12, Espacio)); // No requerido
|
||||
|
||||
// //Sexo A 1 203-203
|
||||
// sb.Append(Sexo); // No requerido
|
||||
|
||||
|
||||
// //Fecha Nacimiento A N 204-211
|
||||
// sb.Append(FechaNacimiento.ToString("yyyyMMdd"));
|
||||
|
||||
// //Nacionalidad N 3 212-214 Anexo 6
|
||||
// if (ErrorProceso == false && Nacionalidad.Length > 0 && Nacionalidad.Trim().Length <= 3)
|
||||
// {
|
||||
// sb.Append(Nacionalidad.PadLeft(3, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Nacionalidad {Nacionalidad} debe de tener una logitud de entre 1 y 2<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //Estado Civil N 3 215-215 Anexo 7
|
||||
// if (ErrorProceso == false && EstadoCivil.Length > 0 && EstadoCivil.Trim().Length <= 1)
|
||||
// {
|
||||
// sb.Append(EstadoCivil);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Estado Civil {EstadoCivil} debe de tener una logitud de 1<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //Regimen Matrimonial A 1 216-216
|
||||
// sb.Append(string.Empty.PadRight(1, Espacio)); // No requerido Anexo 8
|
||||
|
||||
|
||||
// //Escolaridad N 3 217-219 Anexo 9
|
||||
// if (ErrorProceso == false && Escolaridad.Length > 0 && Escolaridad.Trim().Length <= 3)
|
||||
// {
|
||||
// sb.Append(Escolaridad.PadLeft(3, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Escolaridad {Escolaridad} debe de tener una logitud de entre 1 y 3<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //Titulo Profecional N 5 220-223
|
||||
// sb.Append(string.Empty.PadLeft(3, Cero)); // No requerido Anexo 10
|
||||
|
||||
|
||||
// //RFC N 13 225-237
|
||||
// if (ErrorProceso == false && RFC.Length > 0 && RFC.Trim().Length <= 13)
|
||||
// {
|
||||
// sb.Append(RFC.PadRight(13, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} RFC {RFC} debe de tener una logitud de entre 1 y 13<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //Curp A 18 238-255
|
||||
// sb.Append(string.Empty.PadLeft(18, Espacio)); // No requerido
|
||||
|
||||
|
||||
// //Tipo de Alta N 2 256-257
|
||||
// if (ErrorProceso == false && TipoAlta.Length > 0 && TipoAlta.Trim().Length <= 2)
|
||||
// {
|
||||
// sb.Append(TipoAlta.PadLeft(3, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Tipo de Alta {TipoAlta} debe de tener una logitud de entre 1 y 2<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //TipoDeTarjeta N 1 258-258
|
||||
// sb.Append(TipoDeTarjeta);
|
||||
|
||||
|
||||
// //Número de Tarjeta de Débito N 16 259-274
|
||||
// sb.Append(string.Empty.PadLeft(16, Cero)); // No requerido
|
||||
|
||||
// //Clave del Producto de la Cuenta N 4 275-278
|
||||
// sb.Append(string.Empty.PadLeft(4, Cero)); // No requerido
|
||||
|
||||
|
||||
// //Código de Banco de la Cuenta N 3 279-281
|
||||
// if (ErrorProceso == false && CodigoDeBanco.Length > 0 && CodigoDeBanco.Trim().Length <= 3)
|
||||
// {
|
||||
// sb.Append(CodigoDeBanco.PadLeft(3, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Codigo De Banco {CodigoDeBanco} debe de tener una logitud de entre 1 y 3<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //Tipo Cuenta N 2 282-283
|
||||
// if (ErrorProceso == false && TipoCuenta.Length > 0 && TipoCuenta.Trim().Length <= 2)
|
||||
// {
|
||||
// sb.Append(TipoCuenta.PadLeft(2, Cero));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Tipo Cuenta {TipoCuenta} debe de tener una logitud de entre 1 y 2<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
|
||||
// //Numero cuenta 18 284-301
|
||||
// if (ErrorProceso == false && Cuenta.Length > 0 && Cuenta.Trim().Length <= 18)
|
||||
// {
|
||||
// sb.Append(Cuenta.PadRight(18, Espacio));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SbErrores.AppendLine($"{CodigoEmpleado} Numero cuenta {Cuenta} debe de tener una logitud de entre 1 y 18<br/>");
|
||||
// ErrorProceso = true;
|
||||
// }
|
||||
|
||||
// //CR Chequera N 4 302-305
|
||||
// sb.Append(string.Empty.PadLeft(4, Cero)); // No requerido
|
||||
|
||||
// //Impresion Contrato A 1 306-306
|
||||
// sb.Append("S");
|
||||
|
||||
// //Sueldo N 15 307-321
|
||||
// sb.Append(string.Empty.PadLeft(15, Cero)); // No requerido
|
||||
|
||||
// //Numero targeta N 16 307-321
|
||||
// sb.Append(string.Empty.PadLeft(16, Cero)); // No requerido
|
||||
|
||||
// //Filler A 10 338-347
|
||||
// sb.Append(string.Empty.PadLeft(10, Cero)); // Relleno
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if (!ErrorProceso)
|
||||
// {
|
||||
// Response.Clear();
|
||||
// Response.ClearHeaders();
|
||||
// Response.AppendHeader("Content-Length", sb.ToString());
|
||||
// Response.ContentType = "text/plain";
|
||||
// //Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina{DateTime.Now.ToString("yyyyMMddhhmmss").ToString()}.txt\"");
|
||||
// Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Alta_Banorte_{DdlPeriodo.SelectedItem.Text }.txt\"");
|
||||
// Response.Write(sb.ToString());
|
||||
// this.RegistraScript("$('#ModalLayoutBancos').modal('hide');");
|
||||
// Response.Flush();
|
||||
// Response.End();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.Alert($"Errores {SbErrores.ToString()}", TipoMensaje.ToastAdventencia);
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
|
||||
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
private void CrearLayoutNominaBanorte(DataTable DTNomina, string Emisora)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder SbErrores = new StringBuilder();
|
||||
|
||||
char Cero = '0';
|
||||
char Espacio = ' ';
|
||||
|
||||
bool ErrorProceso = false;
|
||||
|
||||
|
||||
|
||||
Promotor = Promotor.Trim();
|
||||
NIE = NIE.Trim();
|
||||
RazonSocial = RazonSocial.Trim();
|
||||
|
||||
//SbErrores.AppendLine("Se detectaron los siguientes errores en la generación del layout");
|
||||
|
||||
|
||||
|
||||
if (DTNomina.Rows.Count > 0)
|
||||
{
|
||||
//Tipo Registro A 1 1-1
|
||||
sb.Append("H");
|
||||
//Cleve de Servicio A 2 2-3
|
||||
sb.Append("NE");
|
||||
//Emisora N 5 4-8
|
||||
sb.Append(Emisora.PadLeft(5, Cero));
|
||||
//FechaProceso N 8 9-16
|
||||
sb.Append(DateTime.Now.ToString("yyyyMMdd"));
|
||||
//Conmsecutivo N 2 17-18
|
||||
sb.Append("01");
|
||||
//Numero Total de Registros N 6 19-24
|
||||
sb.Append(DTNomina.Rows.Count.ToString().PadLeft(6, Cero));
|
||||
|
||||
//Tip oRegistro 1 1-1
|
||||
//Clave servicio 2 2-3
|
||||
sb.Append($"HNE");
|
||||
|
||||
|
||||
//Promotor 8 4-11
|
||||
if (Promotor.Length > 0 && Promotor.Length <= 8)
|
||||
{
|
||||
sb.Append(Promotor.PadLeft(8, '0'));
|
||||
}
|
||||
else
|
||||
{
|
||||
SbErrores.AppendLine($"Promotor {Promotor} debe de tener una logitud de entre 1 y 8<br/>");
|
||||
ErrorProceso = true;
|
||||
}
|
||||
|
||||
//NIE 5 12-26
|
||||
if (ErrorProceso == false && NIE.Length > 0 && NIE.Length <= 5)
|
||||
{
|
||||
sb.Append(NIE.PadLeft(5, ' '));
|
||||
}
|
||||
else
|
||||
{
|
||||
SbErrores.AppendLine($"NIE {NIE} debe de tener una NIE de entre 1 y 8<br/>");
|
||||
ErrorProceso = true;
|
||||
}
|
||||
|
||||
|
||||
//Nombre de Empresa ó Razón Social 40 17-56
|
||||
if (ErrorProceso == false && RazonSocial.Length > 0 && RazonSocial.Length <= 40)
|
||||
{
|
||||
sb.Append(RazonSocial.PadLeft(40, ' '));
|
||||
}
|
||||
else
|
||||
{
|
||||
SbErrores.AppendLine($"RazonSocial {RazonSocial} debe de tener una NIE de entre 1 y 40<br/>");
|
||||
ErrorProceso = true;
|
||||
}
|
||||
|
||||
//57-58consecutivo 1
|
||||
sb.Append("1");
|
||||
|
||||
|
||||
//Número de registros N 6 59-64
|
||||
sb.Append(DTNomina.Rows.ToString().PadRight(6, ' '));
|
||||
|
||||
//Filler A 283 65-347
|
||||
sb.Append(DTNomina.Rows.ToString().PadLeft(283, ' '));
|
||||
|
||||
//Importe Total de Registros N 15 25-39
|
||||
sb.Append(DTNomina.SUMD("Importe").ToString("0000000000000.00").Replace(".", ""));
|
||||
|
||||
//Numero Total altas N 6 40-45
|
||||
sb.Append("000000");
|
||||
//Importe Total altas N 15 46-60
|
||||
sb.Append("000000000000000");
|
||||
//Numero Total Bajas N 6 61-66
|
||||
sb.Append("000000");
|
||||
//Importe Total Bajas N 15 67-81
|
||||
sb.Append("000000000000000");
|
||||
//Numero Total de cuentas a verificar N 6 82-87
|
||||
sb.Append("000000");
|
||||
//Accion N 1 88-88
|
||||
sb.Append("0");
|
||||
//filler 77 89-165
|
||||
sb.Append(string.Empty.PadLeft(77, Espacio));
|
||||
|
||||
if (!ErrorProceso)
|
||||
{
|
||||
foreach (DataRow dRow in DTNomina.Rows)
|
||||
{
|
||||
|
||||
// Codigo ReferenciaDelServicio ReferenciaLeyendaDelOrdenante Importe NumeroBancoReceptor TipoCuenta NumeroCuenta TipoMovimiento Accion ImporteIvaOperacion
|
||||
string Codigo = dRow["Codigo"].ToString().Trim();
|
||||
string ReferenciaDelServicio = dRow["ReferenciaDelServicio"].ToString().Trim();
|
||||
string ReferenciaLeyendaDelOrdenante = dRow["ReferenciaLeyendaDelOrdenante"].ToString().Trim();
|
||||
decimal Importe = dRow["Importe"].ToString().ToDecimal();
|
||||
string NumeroBancoReceptor = dRow["NumeroBancoReceptor"].ToString().Trim();
|
||||
string TipoCuenta = dRow["TipoCuenta"].ToString().Trim();
|
||||
string NumeroCuenta = dRow["NumeroCuenta"].ToString().Trim();
|
||||
string TipoMovimiento = dRow["TipoMovimiento"].ToString().Trim();
|
||||
string Accion = dRow["Accion"].ToString().Trim();
|
||||
string ImporteIvaOperacion = dRow["ImporteIvaOperacion"].ToString().Trim();
|
||||
|
||||
string CodigoEmpleado = dRow["CodigoEmpleado"].ToString().Trim();
|
||||
|
||||
//Tipo de registro A 1 1-1
|
||||
sb.AppendLine("D");
|
||||
//Fecha Aplicacion N 8 2-9
|
||||
sb.Append(DateTime.Now.ToString("yyyyMMdd"));
|
||||
|
||||
|
||||
//CodigoEmpleado A 10 2-11
|
||||
if (ErrorProceso == false && CodigoEmpleado.Length > 0 && CodigoEmpleado.Trim().Length <= 10)
|
||||
//CodigoEmpleado A 10 10-19
|
||||
if (ErrorProceso == false && Codigo.Length > 0 && Codigo.Trim().Length <= 10)
|
||||
{
|
||||
sb.Append(CodigoEmpleado.PadLeft(10, '0'));
|
||||
sb.Append(Codigo.PadLeft(10, Cero));
|
||||
}
|
||||
else
|
||||
{
|
||||
SbErrores.AppendLine($"RazonSocial {RazonSocial} debe de tener una NIE de entre 1 y 40<br/>");
|
||||
SbErrores.AppendLine($"{Codigo} Codigo {Codigo} debe de tener una logitud de entre 1 y 10<br/>");
|
||||
ErrorProceso = true;
|
||||
}
|
||||
|
||||
//ReferenciaDelServicio A 40 20-29
|
||||
sb.Append(ReferenciaDelServicio.PadLeft(40, Espacio));
|
||||
//ReferenciaLeyendaDelOrdenante A 40 60-99
|
||||
sb.Append(ReferenciaLeyendaDelOrdenante.PadLeft(40, Espacio));
|
||||
//Importe N 15 100-114
|
||||
sb.Append(Importe.ToString("0000000000000.00").Replace(".", ""));
|
||||
//NumeroBancoReceptor N 3 115-117
|
||||
sb.Append(NumeroBancoReceptor.PadLeft(3, Cero));
|
||||
//TipoCuenta N 2 118-119
|
||||
sb.Append(TipoCuenta.PadLeft(2, Cero));
|
||||
//NumeroCuenta N 18 120-137
|
||||
sb.Append(NumeroCuenta.PadLeft(18, Cero));
|
||||
//Tipo movimiento N 1 138-138
|
||||
sb.Append(TipoCuenta.PadLeft(1, Cero));
|
||||
//Accion N 1 139-139
|
||||
sb.Append(Accion.PadLeft(1, Espacio));
|
||||
//ImporteIvaOperacion 140-147
|
||||
sb.Append(ImporteIvaOperacion.PadLeft(8, Cero));
|
||||
//filler 18 148-165
|
||||
sb.Append(string.Empty.PadLeft(77, Espacio));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!ErrorProceso)
|
||||
{
|
||||
Response.Clear();
|
||||
Response.ClearHeaders();
|
||||
Response.AppendHeader("Content-Length", sb.ToString());
|
||||
Response.ContentType = "text/plain";
|
||||
Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina_Banorte_{DdlPeriodo.SelectedItem.Text }.txt\"");
|
||||
Response.Write(sb.ToString());
|
||||
this.RegistraScript("$('#ModalLayoutBancos').modal('hide');");
|
||||
Response.Flush();
|
||||
Response.End();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Alert($"Errores {SbErrores.ToString()}", TipoMensaje.ToastAdventencia);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user