This commit is contained in:
2023-06-01 17:50:58 -07:00
6 changed files with 342 additions and 70 deletions

View File

@@ -122,7 +122,7 @@
<asp:GridView ID="GvFolioGarantia" runat="server" AutoGenerateColumns="False" <asp:GridView ID="GvFolioGarantia" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveFolioGarantia,FolioGarantia,CveEstatus,Estatus,CveUsuario,Usuario,FechaIng,SubProyecto,CveSubProyecto,tipoFolio,Limite,CveMovimiento" DataKeyNames="CveFolioGarantia,FolioGarantia,CveEstatus,Estatus,CveUsuario,Usuario,FechaIng,SubProyecto,CveSubProyecto,tipoFolio,Limite,CveMovimiento"
EmptyDataText="No se encontraron registros" ToolTip="Listado de Folios de Garantía" EmptyDataText="No se encontraron registros"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn"
data-sort="true" data-sort="true"
data-freezerows="1" data-freezerows="1"

View File

@@ -1911,16 +1911,6 @@ Partial Class Compras_Compras
TxtSerie.Enabled = False TxtSerie.Enabled = False
End If End If
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") Then 'cuando es emp acumuladora
divFolioGarantia.Visible = True
Using objAcum As New ClsAcumuladores
If objAcum.FoliosGarantiaGet(-1, UsuarioActual.Empresa.CveEmpresa, Estatus:=2, TipoFolio:="-1", Area:=-1, CveSubProyecto:=-1) Then
DdlFolioGarantia.DataSource = objAcum.DtResultados.FiltraParametros("", "FechaIng DESC")
DdlFolioGarantia.DataBind()
End If
End Using
End If
'PERMISO PARA MODIFICACIÓN DE FECHA AUN CON FACTURA 'PERMISO PARA MODIFICACIÓN DE FECHA AUN CON FACTURA
TxtFecha.Enabled = UsuarioActual.TienePermisoProceso(216) TxtFecha.Enabled = UsuarioActual.TienePermisoProceso(216)
ImgFecha.Enabled = UsuarioActual.TienePermisoProceso(216) ImgFecha.Enabled = UsuarioActual.TienePermisoProceso(216)
@@ -4111,7 +4101,6 @@ Partial Class Compras_Compras
Alert("Falta asignar Proyecto a la compra", TipoMensaje.MsgAdvertencia) Alert("Falta asignar Proyecto a la compra", TipoMensaje.MsgAdvertencia)
End If End If
If Not ValidaVinculacionNotaFactura() Then If Not ValidaVinculacionNotaFactura() Then
Alert("Se requiere que la nota este aplciada a las facturas", TipoMensaje.MsgAdvertencia) Alert("Se requiere que la nota este aplciada a las facturas", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
@@ -4530,6 +4519,13 @@ Partial Class Compras_Compras
UM.Dispose() UM.Dispose()
PSS.Dispose() PSS.Dispose()
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoCompra.SelectedValue = "12" Then 'cuando es garantía, debe de especificar la salida de almacen
If Not GvInv.HeaderRow.FCCheckBox("cbAll").Checked OrElse GvInv.HeaderRow.FCDropDownList("ddlAlmacen").SelectedValue.ToEntero <= 0 Then
Alert("No ha especificado la salida de almacen en la garantía.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
'VALIDA IMPORTES 'VALIDA IMPORTES
If Not ValidaTotalesGuardar() Then If Not ValidaTotalesGuardar() Then
Exit Sub Exit Sub
@@ -4551,9 +4547,9 @@ Partial Class Compras_Compras
Exit Sub Exit Sub
End If End If
If DdlFolioGarantia.Visible AndAlso DdlFolioGarantia.SelectedValue <> "-1" Then 'If DdlFolioGarantia.Visible AndAlso DdlFolioGarantia.SelectedValue <> "-1" Then
If Not ValidaFolioGarantia() Then Exit Sub ' If Not ValidaFolioGarantia() Then Exit Sub
End If 'End If
'------------------TERMINA VALIDACIONES------------------ '------------------TERMINA VALIDACIONES------------------
@@ -5462,10 +5458,12 @@ Partial Class Compras_Compras
Dim ListAlmacenes = (From CveAlmacen In DtInv.AsEnumerable() Where CveAlmacen.Field(Of Integer)("CveAlmacen") > 0 Select CveAlmacen.Field(Of Integer)("CveAlmacen")).Distinct().ToList Dim ListAlmacenes = (From CveAlmacen In DtInv.AsEnumerable() Where CveAlmacen.Field(Of Integer)("CveAlmacen") > 0 Select CveAlmacen.Field(Of Integer)("CveAlmacen")).Distinct().ToList
Dim indice = 0 Dim indice = 0
Dim ImporteConcepto As Decimal = 0 Dim ImporteConcepto As Decimal = 0
Dim tCveFolioGarantia As Integer = -1
Dim CveConceptoMovimiento As Integer = 2 Dim CveConceptoMovimiento As Integer = 2
'apoyo logistico/garantia 'apoyo logistico/garantia
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso DdlTipoCompra.SelectedValue = "12" Then If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso DdlTipoCompra.SelectedValue = "12" Then 'garantía
CveConceptoMovimiento = 13 CveConceptoMovimiento = 13
tCveFolioGarantia = DdlFolioGarantia.SelectedValue.ToEntero
End If End If
If (DdlTipoComprobante.SelectedValue = "Fac" AndAlso CveCompraRefacturacion <= 0) OrElse CveConceptoMovimiento = 13 Then If (DdlTipoComprobante.SelectedValue = "Fac" AndAlso CveCompraRefacturacion <= 0) OrElse CveConceptoMovimiento = 13 Then
@@ -5478,7 +5476,7 @@ Partial Class Compras_Compras
Dim fecha As Date = TxtFecha.Text.ToDate Dim fecha As Date = TxtFecha.Text.ToDate
If Not UsuarioActual.Empresa.UsaAC Then fecha = Now If Not UsuarioActual.Empresa.UsaAC Then fecha = Now
CveMovimientoInventario = ObjInventario.AddMovimiento(tCveAlmacen, CveConceptoMovimiento, 1, fecha, 0, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, TipoCambio:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, TipoCambioGuardar), Modulo:="Comp/G2") CveMovimientoInventario = ObjInventario.AddMovimiento(tCveAlmacen, CveConceptoMovimiento, 1, fecha, 0, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, TipoCambio:=If(DdlMoneda.SelectedValue.ToEntero = 1, -1, TipoCambioGuardar), CveFolioGarantia:=tCveFolioGarantia, Modulo:="Comp/G2")
If CveMovimientoInventario <= 0 Then If CveMovimientoInventario <= 0 Then
ErrorMovInv = True ErrorMovInv = True
@@ -13500,18 +13498,6 @@ Partial Class Compras_Compras
Dim IdPolizaAnterior = -1 Dim IdPolizaAnterior = -1
Dim TotalRefact As Decimal = 0 Dim TotalRefact As Decimal = 0
'SI NO TIENE POLIZA NI PAGOS NO HACE NADA
'If ObjCompra.GetCompras(CveCompraRefacturacion, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
' If ObjCompra.DtResultados IsNot Nothing AndAlso ObjCompra.DtResultados.Rows.Count = 1 Then
' Dim drc As DataRow = ObjCompra.DtResultados.Rows(0)
' TotalRefact = drc("Total").ToString.ToDecimal
' If drc("IdPoliza").ToString.ToEntero <= 0 AndAlso drc("Saldo").ToString.ToDecimal = drc("Total").ToString.ToDecimal AndAlso drc("CveMovimiento").ToString.ToEntero <= 0 Then
' Alert("La factura a refacturar no esta contabilizada ni tiene pagos ni movimientos de almacen. No se puede refacturar, debera eliminar la factura anterior y agregar esta factura de forma normal.", TipoMensaje.MsgAdvertencia)
' Return True
' End If
' End If
'End If
'GUARDA ADJUNTOS Y LIGA EN BITACORA (RELACION DE FACTURA NUEVA Y VIEJA) 'GUARDA ADJUNTOS Y LIGA EN BITACORA (RELACION DE FACTURA NUEVA Y VIEJA)
ErrorBitacora = GuardaRefacturacionBitacora(ObjCompra, ObjEventos) ErrorBitacora = GuardaRefacturacionBitacora(ObjCompra, ObjEventos)
@@ -17232,6 +17218,9 @@ Partial Class Compras_Compras
If DrPS IsNot Nothing Then If DrPS IsNot Nothing Then
Row("PSCodigo") = If(PSCodigo = "", DrPS("PSCodigo").ToString, PSCodigo) Row("PSCodigo") = If(PSCodigo = "", DrPS("PSCodigo").ToString, PSCodigo)
Row("CveMetodoInventario") = DrPS("Inv_CveMetodoInventario").ToString.ToEntero Row("CveMetodoInventario") = DrPS("Inv_CveMetodoInventario").ToString.ToEntero
If DdlTipoCompra.SelectedValue = "12" AndAlso DrPS("AplicaSerie").ToString = "True" Then
Row("CveMetodoInventario") = "1"
End If
Else Else
Row("PSCodigo") = PSCodigo Row("PSCodigo") = PSCodigo
Row("CveMetodoInventario") = 0 Row("CveMetodoInventario") = 0
@@ -17278,8 +17267,6 @@ Partial Class Compras_Compras
End Try End Try
Dim DecimalesPermitidos = 6 Dim DecimalesPermitidos = 6
Row("CveConcepto") = TmpDT.Rows.Count + 1 Row("CveConcepto") = TmpDT.Rows.Count + 1
@@ -17323,8 +17310,6 @@ Partial Class Compras_Compras
Row("IVAPorcentaje") = PorcentajeIVA Row("IVAPorcentaje") = PorcentajeIVA
End If End If
Row("RetIVA") = Math.Round(RetIVA, DecimalesPermitidos) Row("RetIVA") = Math.Round(RetIVA, DecimalesPermitidos)
Row("RetIVAPorcentaje") = PorcentajeRetIVA Row("RetIVAPorcentaje") = PorcentajeRetIVA
Row("RetISR") = Math.Round(RetISR, DecimalesPermitidos) Row("RetISR") = Math.Round(RetISR, DecimalesPermitidos)
@@ -19517,6 +19502,17 @@ Partial Class Compras_Compras
Protected Sub DdlTipoCompra_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlTipoCompra_SelectedIndexChanged(sender As Object, e As EventArgs)
If DdlTipoCompra.SelectedValue.ToEntero.Contiene(9, 10, 12) Then 'Al seleccionar apoyo logístico se cargan los amancenes de devoculcion proveedor para dar entrada If DdlTipoCompra.SelectedValue.ToEntero.Contiene(9, 10, 12) Then 'Al seleccionar apoyo logístico se cargan los amancenes de devoculcion proveedor para dar entrada
If DdlTipoCompra.SelectedValue = "12" AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") Then 'cuando es emp acumuladora
divFolioGarantia.Visible = True
Using objAcum As New ClsAcumuladores
If objAcum.FoliosGarantiaGet(-1, UsuarioActual.Empresa.CveEmpresa, Estatus:=2, TipoFolio:="-1", Area:=-1, CveSubProyecto:=-1) Then
DdlFolioGarantia.DataSource = objAcum.DtResultados.FiltraParametros("", "FechaIng DESC")
DdlFolioGarantia.DataBind()
End If
End Using
End If
'cambia si hay ps con uso de serie 'cambia si hay ps con uso de serie
For Each dr As DataRow In TmpDT.Rows For Each dr As DataRow In TmpDT.Rows
dr("CveMetodoInventario") = 1 dr("CveMetodoInventario") = 1
@@ -19547,6 +19543,8 @@ Partial Class Compras_Compras
Dim ExistenciasPSGarantia As New Dictionary(Of Integer, Decimal) Dim ExistenciasPSGarantia As New Dictionary(Of Integer, Decimal)
Dim PSFaltantes As New Dictionary(Of Integer, Decimal) Dim PSFaltantes As New Dictionary(Of Integer, Decimal)
Dim DtGarantia As New DataTable Dim DtGarantia As New DataTable
TxtDescripcion.Text = DdlFolioGarantia.SelectedItem.Text
UpParametros.Update()
'Agrupa los CvePS iguales y suma sus cantidades 'Agrupa los CvePS iguales y suma sus cantidades
For Each row In TmpDT.AsEnumerable() For Each row In TmpDT.AsEnumerable()
@@ -19564,7 +19562,7 @@ Partial Class Compras_Compras
DtGarantia = ObjAcum.DtResultados DtGarantia = ObjAcum.DtResultados
ExistenciasPSGarantia = DtGarantia.AsEnumerable().ToDictionary(Function(row) row.Field(Of Integer)("CvePS"), Function(row) row.Field(Of Decimal)("CantidadDisponible")) ExistenciasPSGarantia = DtGarantia.AsEnumerable().ToDictionary(Function(row) row.Field(Of Integer)("CvePS"), Function(row) row.Field(Of Decimal)("CantidadDisponible"))
Else Else
Alert($"Ocurrió un error al obtener la información de la garantía.</br> CveUsuario={UsuarioActual.CveUsuario}</br> CveFolioGarantia={DdlFolioGarantia.SelectedValue}", TipoMensaje.MsgError) Alert($"Ocurrió un error al obtener la información de la garantía.</br> CveU={UsuarioActual.CveUsuario}</br> CveFG={DdlFolioGarantia.SelectedValue}", TipoMensaje.MsgError)
Return False Return False
End If End If
End Using End Using
@@ -19587,13 +19585,34 @@ Partial Class Compras_Compras
Select New With {.CvePS = Producto.Key, .NombrePS = row.Field(Of String)("PS"), .CantidadFaltante = Producto.Value} Select New With {.CvePS = Producto.Key, .NombrePS = row.Field(Of String)("PS"), .CantidadFaltante = Producto.Value}
If PSFaltantes.Count > 0 Then If PSFaltantes.Count > 0 Then
Dim mensaje As String = "Los siguientes productos no tienen suficientes existencias en la garantía seleccionada:</br></br>" Dim mensaje As String = "Los siguientes productos no fueron registrados en la garantía seleccionada:</br></br>"
For Each Producto In IEnumPSFaltantes For Each Producto In IEnumPSFaltantes
mensaje += $"Falta: &times;&hairsp;<b>{Producto.CantidadFaltante:0.##}</b>&emsp;{Producto.NombrePS}</br>" mensaje += $"Falta: &times;&hairsp;<b>{Producto.CantidadFaltante:0.##}</b>&emsp;{Producto.NombrePS}</br>"
Next Next
'eliminar los registros
Dim tImporteAjuste As Decimal = 0
Dim PSS = (From c In IEnumPSFaltantes Select c.CvePS).Distinct.ToList
For Each Producto In PSS
Dim drr As DataRow() = TmpDT.Select($"CvePS = {Producto}")
For Each drt As DataRow In drr
If TmpDT.Rows.Count > 1 Then 'valida que exista cuando menos un registro
tImporteAjuste += drt("Total").ToString.ToDecimal
TmpDT.Rows.Remove(drt)
End If
Next
TmpDT.AcceptChanges()
Next
If tImporteAjuste > 0 Then AjustaImporteUltimoConcepto(tImporteAjuste)
GvPS.DataSource = TmpDT
GvPS.DataBind()
CalculaTotales(True)
CargaGvInv()
If MsgExito Then Alert(mensaje, TipoMensaje.MsgAdvertencia) Else Alert(mensaje, TipoMensaje.MsgError) If MsgExito Then Alert(mensaje, TipoMensaje.MsgAdvertencia) Else Alert(mensaje, TipoMensaje.MsgError)
Else Else
If MsgExito Then Alert("Todos los productos seleccionados están disponibles en el Folio de Garantía.") If MsgExito Then Alert("Todos los productos seleccionados están registrados en el Folio de Garantía.")
Return True Return True
End If End If
Else Else
@@ -20251,10 +20270,8 @@ Partial Class Compras_Compras
End If End If
End If End If
End Sub End Sub
Protected Sub BtnFolioGarantiaRestantes_Click(sender As Object, e As EventArgs) Protected Sub BtnFolioGarantiaRestantes_Click(sender As Object, e As EventArgs)
Using ObjAcum As New ClsAcumuladores Using ObjAcum As New ClsAcumuladores
@@ -20339,8 +20356,6 @@ Partial Class Compras_Compras
ErrorCompra = True ErrorCompra = True
Exit For Exit For
End If End If
Next Next
End If End If
@@ -20351,36 +20366,20 @@ Partial Class Compras_Compras
Dim SBEliminacionCompra As New StringBuilder Dim SBEliminacionCompra As New StringBuilder
SBEliminacionCompra.Append($"Serie-Folio: {TxtSerie.Text}-{TxtFolio.Text}, Proveedor: {HplProveedor.Text}, Descripción: {TxtDescripcion.Text}, SubTotal: {TxtSubTotal2.Text}, ") SBEliminacionCompra.Append($"Serie-Folio: {TxtSerie.Text}-{TxtFolio.Text}, Proveedor: {HplProveedor.Text}, Descripción: {TxtDescripcion.Text}, SubTotal: {TxtSubTotal2.Text}, ")
If TxtIVA.Text.Trim.ToDecimal > 0 Then If TxtIVA.Text.Trim.ToDecimal > 0 Then SBEliminacionCompra.Append($"IVA: { TxtIVA.Text},")
SBEliminacionCompra.Append($"IVA: { TxtIVA.Text},")
End If
If TxtRetISR.Text.Trim.ToDecimal > 0 Then SBEliminacionCompra.Append($"Ret. ISR: { TxtRetISR.Text}, ")
If TxtRetISR.Text.Trim.ToDecimal > 0 Then If TxtRetIVA.Text.Trim.ToDecimal > 0 Then SBEliminacionCompra.Append($"Ret. IVA: { TxtRetIVA.Text}, ")
SBEliminacionCompra.Append($"Ret. ISR: { TxtRetISR.Text}, ")
End If
If TxtRetIVA.Text.Trim.ToDecimal > 0 Then
SBEliminacionCompra.Append($"Ret. IVA: { TxtRetIVA.Text}, ")
End If
If TxtIEPS.Text.Trim.ToDecimal > 0 Then
SBEliminacionCompra.Append($"IEPS: { TxtIEPS.Text}, ")
End If
If TxtIEPS.Text.Trim.ToDecimal > 0 Then SBEliminacionCompra.Append($"IEPS: { TxtIEPS.Text}, ")
SBEliminacionCompra.Append($"Total: {TxtTotal.Text}, ") SBEliminacionCompra.Append($"Total: {TxtTotal.Text}, ")
SBEliminacionCompra.Append($"Moneda: {DdlMoneda.SelectedItem.Text}, ") SBEliminacionCompra.Append($"Moneda: {DdlMoneda.SelectedItem.Text}, ")
If TxtOC.Text.Trim.Length > 0 Then If TxtOC.Text.Trim.Length > 0 Then SBEliminacionCompra.Append($"OC: {TxtOC.Text }, ")
SBEliminacionCompra.Append($"OC: {TxtOC.Text }, ")
End If
SBEliminacionCompra.Append($"Fecha {TxtFecha.Text}, ") SBEliminacionCompra.Append($"Fecha {TxtFecha.Text}, ")
SBEliminacionCompra.Append($"Capturó: {LblUsuarioCaptura.Text}, ") SBEliminacionCompra.Append($"Capturó: {LblUsuarioCaptura.Text}, ")
@@ -20394,7 +20393,6 @@ Partial Class Compras_Compras
If Not ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, CveCompra, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, If Not ObjGral.AddHistorialBitacora(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, CveCompra, Nothing, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1,
TxtModalEliminarCompraDescripcion.Text, "Compras", SBEliminacionCompra.ToString) Then TxtModalEliminarCompraDescripcion.Text, "Compras", SBEliminacionCompra.ToString) Then
ErrorCompra = True ErrorCompra = True
End If End If
If Not ErrorCompra Then If Not ErrorCompra Then

View File

@@ -1542,7 +1542,7 @@ Partial Class General_SaldosIniciales
End If End If
'Compra 'Compra
If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, Folio2, CveProveedor.ToEntero(), SubTotal, 0, 0, IVA, RetIVA, RetISR, IEPS, 0, 0, Total, Fecha, CveMoneda, TipoCambio.ToDouble, FechaVencimiento, If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, Folio2, CveProveedor.ToEntero(), SubTotal, 0, 0, IVA, RetIVA, RetISR, IEPS, 0, 0, Total, Fecha, CveMoneda, TipoCambio.ToDecimal, FechaVencimiento,
False, CodProvee, 1, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorSucursal:=CveProveedorSucursal, False, CodProvee, 1, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorSucursal:=CveProveedorSucursal,
NumeroReembolso:=Transaccion, PorcentajeIVA:=PorcentajeIVA.ToDecimal, TotalOriginal:=Total) Then NumeroReembolso:=Transaccion, PorcentajeIVA:=PorcentajeIVA.ToDecimal, TotalOriginal:=Total) Then
ErrorCompras = True ErrorCompras = True

View File

@@ -278,7 +278,10 @@
<asp:HyperLink ID="HypAsistencia" NavigateUrl="/RH/Asistencias.aspx" runat="server"><i class="fa fa-list" aria-hidden="true"></i>Ir a asistencia</asp:HyperLink> <asp:HyperLink ID="HypAsistencia" NavigateUrl="/RH/Asistencias.aspx" runat="server"><i class="fa fa-list" aria-hidden="true"></i>Ir a asistencia</asp:HyperLink>
</li> </li>
<li> <li>
<asp:LinkButton ID="LnkFormatoTabular" Visible="false" OnClick="LnkFormatoTabular_Click" CssClass="" runat="server"><i class="fa fa-download"></i> Nómina tabular</asp:LinkButton> <asp:LinkButton ID="LnkFormatoTabular" Visible="false" OnClick="LnkFormatoTabular_Click" CssClass="" runat="server"><i class="fa fa-file-excel"></i> Nómina tabular</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkFormatoFiscal" Visible="false" OnClick="LnkFormatoFiscal_Click" CssClass="" runat="server"><i class="fa fa-file-excel"></i> Nómina Fiscal</asp:LinkButton>
</li> </li>
<li> <li>
<asp:LinkButton ID="LnkSimulador" OnClick="LnkSimulador_Click" runat="server"><i class="fa fa-calculator"></i> Simulador</asp:LinkButton> <asp:LinkButton ID="LnkSimulador" OnClick="LnkSimulador_Click" runat="server"><i class="fa fa-calculator"></i> Simulador</asp:LinkButton>
@@ -300,6 +303,7 @@
<Triggers> <Triggers>
<asp:PostBackTrigger ControlID="LnkListaRaya" /> <asp:PostBackTrigger ControlID="LnkListaRaya" />
<asp:PostBackTrigger ControlID="LnkFormatoTabular" /> <asp:PostBackTrigger ControlID="LnkFormatoTabular" />
<asp:PostBackTrigger ControlID="LnkFormatoFiscal" />
</Triggers> </Triggers>
</asp:UpdatePanel> </asp:UpdatePanel>

View File

@@ -259,7 +259,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
{ {
if (!IsPostBack) if (!IsPostBack)
{ {
enviarCorreoEnTimbrado = (UsuarioActual.CveEmpresa == 141 ? true : true); enviarCorreoEnTimbrado = (UsuarioActual.CveEmpresa == 141 ? true : true);
LnkCargaNetos.Visible = (UsuarioActual.Empresa.Funcionalidad(267) == "1") || (UsuarioActual.CveRol == 1); LnkCargaNetos.Visible = (UsuarioActual.Empresa.Funcionalidad(267) == "1") || (UsuarioActual.CveRol == 1);
if (UsuarioActual.CveEmpresa == 141) { ddlfiniquito.SelectedValueExist("2"); } if (UsuarioActual.CveEmpresa == 141) { ddlfiniquito.SelectedValueExist("2"); }
@@ -567,6 +567,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
LnkAsistenciaIncidencias.Visible = true; LnkAsistenciaIncidencias.Visible = true;
LnkFormatoTabular.Visible = true; LnkFormatoTabular.Visible = true;
LnkFormatoFiscal.Visible = (UsuarioActual.CveEmpresa == 141 || UsuarioActual.CveRol == 1);
HypPDFSTimbrados.Visible = true; HypPDFSTimbrados.Visible = true;
if (objnom.GetNominaEmpleado(FiltCveProyecto, FiltCveSubProyecto, FiltCveTurno, FiltCvePeriodo, CveEmpresa, FiltAgrupador, DdlRegimenContratacion.SelectedValue.ToEntero(), CveTipoTrabajador: CveTipoTrabajador, Neto: ddlfiniquito.SelectedValue.ToEntero()) && objnom.DTSetResultados.Tables.Count > 4) if (objnom.GetNominaEmpleado(FiltCveProyecto, FiltCveSubProyecto, FiltCveTurno, FiltCvePeriodo, CveEmpresa, FiltAgrupador, DdlRegimenContratacion.SelectedValue.ToEntero(), CveTipoTrabajador: CveTipoTrabajador, Neto: ddlfiniquito.SelectedValue.ToEntero()) && objnom.DTSetResultados.Tables.Count > 4)
{ {
@@ -2837,7 +2838,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
using (ClsRH objpersonal = new ClsRH()) using (ClsRH objpersonal = new ClsRH())
{ {
if (objpersonal.GetAsistencias(SRCvePersonal, -1, -1, -1, -1, -1,-1, FechaInicioPeriodo, FechaFinPeriodo, UsuarioActual.CveEmpresa)) if (objpersonal.GetAsistencias(SRCvePersonal, -1, -1, -1, -1, -1, -1, FechaInicioPeriodo, FechaFinPeriodo, UsuarioActual.CveEmpresa))
{ GVAsistencia.DataSource = objpersonal.DtResultados.FiltraParametros("Fecha IS NOT NULL"); } { GVAsistencia.DataSource = objpersonal.DtResultados.FiltraParametros("Fecha IS NOT NULL"); }
else else
{ {
@@ -5040,6 +5041,274 @@ public partial class Nomina_Nomina2 : ClsPaginas
} }
} }
protected void LnkFormatoFiscal_Click(object sender, EventArgs e)
{
DataTable dtnominas = null;
using (ClsNominas onom = new ClsNominas())
{
if (onom.GetNom_Nominas(-1, -1, CvePeriodoSeleccionado, -1, UsuarioActual.CveEmpresa))
{
dtnominas = onom.DtResultados;
}
}
try
{
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
var libro = wb.AddWorksheet("Nomina");
int column = 1;
int filainicio = 3;
libro.Cell(filainicio + 1, column).Value = " ";
libro.Cell(filainicio + 2, column).Value = "Codigo";
libro.Cell(filainicio + 3, column).Value = " ";
column++;
libro.Cell(filainicio + 1, column).Value = " ";
libro.Cell(filainicio + 2, column).Value = "Empleado";
libro.Cell(filainicio + 3, column).Value = " ";
column++;
libro.Cell(filainicio + 1, column).Value = " ";
libro.Cell(filainicio + 2, column).Value = "Folio Fiscal";
libro.Cell(filainicio + 3, column).Value = " ";
libro.Column(column).Width = 35;
libro.Cell(1, 1).Value = "Empresa";
libro.Range(1, 2, 1, 4).Merge().Value = UsuarioActual.Empresa.Empresa;
libro.Cell(2, 1).Value = "período";
string periodo = DdlPeriodo.SelectedItem.Text;
periodo = periodo.Substring(0, (periodo.Length > 27 ? 27 : periodo.Length));
libro.Range(2, 2, 2, 4).Merge().Value = periodo;
int iniciotipe = column;
foreach (DataRow row in dtConceptos.FiltraParametros("Tipo ='P' AND EsPadre = 1 ").Rows)
{
column++;
libro.Cell(filainicio + 2, column).Value = row["Concepto"].ToString();
libro.Cell(filainicio + 3, column).Value = row["Codigo"].ToString();
libro.Column(column).Width = 15;
if ((dtempleados.SUM(string.Format("[V_{0}]", row["CveConcepto"].ToString())) == 0))
{
libro.Column(column).Hide();
}
}
column++;
libro.Range(filainicio + 2, column, filainicio + 3, column).Merge().Value = "Percepciones";
libro.Column(column).Width = 15;
if (iniciotipe < column)
{
libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Merge().Value = "Percepciones";
}
iniciotipe = column;
foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'D' AND EsPadre = 1 ").Rows)
{
column++;
libro.Cell(filainicio + 2, column).Value = row["Concepto"].ToString();
libro.Cell(filainicio + 3, column).Value = row["Codigo"].ToString();
libro.Column(column).Width = 15;
if ((dtempleados.SUM(string.Format("[V_{0}]", row["CveConcepto"].ToString())) == 0))
{
libro.Column(column).Hide();
}
}
column++;
libro.Range(filainicio + 2, column, filainicio + 3, column).Merge().Value = "Deducciones";
libro.Column(column).Width = 15;
if (iniciotipe < column)
{
libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Merge().Value = "Deducciones";
}
column++;
libro.Cell(filainicio + 1, column).Value = " ";
libro.Range(filainicio + 2, column, filainicio + 3, column).Merge().Value = "Total";
libro.Column(column).Width = 15;
iniciotipe = column;
foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'O' AND EsPadre = 1 ").Rows)
{
column++;
libro.Cell(filainicio + 2, column).Value = row["Concepto"].ToString();
libro.Cell(filainicio + 3, column).Value = row["Codigo"].ToString();
libro.Column(column).Width = 15;
if ((dtempleados.SUM(string.Format("[V_{0}]", row["CveConcepto"].ToString())) == 0))
{
libro.Column(column).Hide();
}
}
column++;
libro.Range(filainicio + 2, column, filainicio + 3, column).Merge().Value = "Obligaciones";
libro.Column(column).Width = 15;
if (iniciotipe < column)
{
libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
libro.Range(filainicio + 1, iniciotipe + 1, filainicio + 1, column).Merge().Value = "Obligaciones";
}
//libro.Row(1).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
//libro.Row(2).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
//libro.Row(3).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
//libro.Row(1).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(177, 160, 199));
//libro.Row(2).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
//libro.Row(3).Cell(1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
//libro.Row(3).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
int maxnocolumn = column;
int Fila = filainicio + 3;
int cveSupProyecto = -5;
string subproyecto = "";
int oldcveSupProyecto = -5;
bool newsubproyecto = false;
bool newsubproyectoTitulo = false;
DataTable dtsr = dtempleados.FiltraParametros("", "CveSubProyecto");
dtsr.Rows.Add(dtsr.NewRow());
foreach (DataRow erow in dtsr.Rows)
{
Fila++;
newsubproyecto = false; newsubproyectoTitulo = false;
if (cveSupProyecto != erow["CveSubProyecto"].ToString().ToEntero())
{
if (oldcveSupProyecto != -5) { Fila += 2; newsubproyecto = true; }
oldcveSupProyecto = cveSupProyecto;
cveSupProyecto = erow["CveSubProyecto"].ToString().ToEntero();
subproyecto = erow["SubProyecto"].ToString();
if (cveSupProyecto != -5 && oldcveSupProyecto != -5) { Fila++; newsubproyectoTitulo = true; }
}
column = 1;
libro.Cell(Fila, column).Value = string.Format("'{0}", erow["Codigo"]);
column++;
if (newsubproyectoTitulo)
{
libro.Cell(Fila - 1, column).Value = subproyecto;
libro.Range(Fila - 1, 1, Fila - 1, maxnocolumn).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(155, 194, 230));
}
if (newsubproyecto)
{
libro.Cell(Fila - 3, column).Value = "Total";
libro.Range(Fila - 3, 1, Fila - 3, maxnocolumn).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(155, 194, 230));
}
libro.Cell(Fila, column).Value = erow["Nombre"];
column++;
if (dtnominas != null)
{
DataRow drw = dtnominas.FiltroPrimero(string.Format("CvePersonal = {0}", erow["CvePersonal"].ToString().ToEntero()));
if (drw != null)
{
libro.Cell(Fila, column).Value = drw["FolioFiscal"];
}
}
foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'P' AND EsPadre = 1 ").Rows)
{
column++;
string Concepto = string.Format("V_{0}", row["CveConcepto"]);
libro.Cell(Fila, column).Value = erow[Concepto];
if (newsubproyecto)
{
libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
}
}
column++;
libro.Cell(Fila, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(166, 166, 166));
libro.Cell(Fila, column).Value = erow["SumaPercepciones"];
if (newsubproyecto)
{
libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaPercepciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
}
foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'D' AND EsPadre = 1 ").Rows)
{
column++;
string Concepto = string.Format("V_{0}", row["CveConcepto"]);
libro.Cell(Fila, column).Value = erow[Concepto];
if (newsubproyecto)
{
libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
}
}
column++;
libro.Cell(Fila, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(166, 166, 166));
libro.Cell(Fila, column).Value = erow["SumaDeducciones"];
if (newsubproyecto)
{
libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaDeducciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
}
column++;
libro.Cell(Fila, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(166, 166, 166));
libro.Cell(Fila, column).Value = erow["Total"];
if (newsubproyecto)
{
libro.Cell(Fila - 3, column).Value = dtempleados.SUM("Total", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
}
foreach (DataRow row in dtConceptos.FiltraParametros("Tipo = 'O' AND EsPadre = 1 ").Rows)
{
column++;
string Concepto = string.Format("V_{0}", row["CveConcepto"]);
libro.Cell(Fila, column).Value = erow[Concepto];
if (newsubproyecto)
{
libro.Cell(Fila - 3, column).Value = dtempleados.SUM(Concepto, string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
}
}
column++;
libro.Cell(Fila, column).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(166, 166, 166));
libro.Cell(Fila, column).Value = erow["SumaObligaciones"];
if (newsubproyecto)
{
libro.Cell(Fila - 3, column).Value = dtempleados.SUM("SumaObligaciones", string.Format("CveSubProyecto ={0} AND CvePersonal > 0 ", oldcveSupProyecto));
}
}
libro.Range(filainicio + 1, 1, filainicio + 4, maxnocolumn).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
libro.Range(filainicio + 1, 1, filainicio + 4, maxnocolumn).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
System.IO.Stream fs = new System.IO.MemoryStream();
wb.SaveAs(fs);
fs.Position = 0;
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
using (System.IO.Stream input = fs)
{
input.CopyTo(memoryStream);
}
memoryStream.Position = 0;
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", string.Format("attachment;filename={0} {1}.xlsx", "Nomina Fiscal", periodo));
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
}
catch (Exception ex)
{
Alert("Ocurrio un error al generar el Formato de nominas" + ex.ToString());
}
}
protected void LnkConceptoD_Click(object sender, EventArgs e) protected void LnkConceptoD_Click(object sender, EventArgs e)
{ {
@@ -6843,7 +7112,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
bool continuar = true; bool continuar = true;
int chkImporte = 1; int chkImporte = 1;
int chkImporteGravado = 1; int chkImporteGravado = 0;
int chkImporteValor = 1; int chkImporteValor = 1;
string[] getcolumnas = new string[] { "CvePersonal", "Nombre", "CveMetodoPago", "SumaPercepciones", "Total", "SalarioDiario", "SalarioDiarioIMSS", "SalarioDiarioIntegrado", "DiasLaborados", "DiasFaltados", "DiasVacaciones", "DiasIncapacidad" }; string[] getcolumnas = new string[] { "CvePersonal", "Nombre", "CveMetodoPago", "SumaPercepciones", "Total", "SalarioDiario", "SalarioDiarioIMSS", "SalarioDiarioIntegrado", "DiasLaborados", "DiasFaltados", "DiasVacaciones", "DiasIncapacidad" };
@@ -7006,7 +7275,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
} }
RegistraScript("$('#DModalCargaASistenciaMasiva').modal();"); RegistraScript("$('#DModalCargaASistenciaMasiva').modal();");
} }
@@ -7111,7 +7380,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
} }
using (ClsRH objpersonal = new ClsRH()) using (ClsRH objpersonal = new ClsRH())
{ {
if (objpersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1,-1, fecha, fecha, UsuarioActual.CveEmpresa)) if (objpersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, -1, fecha, fecha, UsuarioActual.CveEmpresa))
{ {
if (objpersonal.DtResultados.Rows.Count > 0) if (objpersonal.DtResultados.Rows.Count > 0)
{ {

View File

@@ -49,6 +49,7 @@ Partial Class Nomina_ReportePTU
DdlEjercicios.DataBind() DdlEjercicios.DataBind()
If (DdlEjercicios.Items.Count > 0) Then If (DdlEjercicios.Items.Count > 0) Then
DdlEjercicios.SelectedIndex = 0 DdlEjercicios.SelectedIndex = 0
DdlEjercicios.SelectedValueExist(DateTime.Now.Year.ToString())
DdlEjercicios_SelectedIndexChanged(Nothing, Nothing) DdlEjercicios_SelectedIndexChanged(Nothing, Nothing)
End If End If
End If End If
@@ -71,7 +72,7 @@ Partial Class Nomina_ReportePTU
Private Sub CargaPeriodos() Private Sub CargaPeriodos()
Dim ObjPeriodos As New ClsNominas() Dim ObjPeriodos As New ClsNominas()
If ObjPeriodos.GetPeriodos(-1, UsuarioActual.CveEmpresa, DdlEjercicios.SelectedValue.ToEntero(), -1, -1) Then If ObjPeriodos.GetPeriodos(-1, UsuarioActual.CveEmpresa, -1, -1, -1) Then
dtPeriodos = ObjPeriodos.DtResultados.FiltraParametros("Estatus IN (0,1)") dtPeriodos = ObjPeriodos.DtResultados.FiltraParametros("Estatus IN (0,1)")
End If End If
ObjPeriodos.Dispose() ObjPeriodos.Dispose()