This commit is contained in:
@@ -29,13 +29,17 @@
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkdownExcel" OnClick="LnkdownExcel_Click" runat="server"><i class="fa fa-download" aria-hidden="true"></i>Excel</asp:LinkButton>
|
||||
</li>
|
||||
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
|
||||
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkOpenModalAutoriza" OnClick="LnkOpenModalAutoriza_Click" runat="server"><i class="fa fa-check" aria-hidden="true"></i> Autoriza</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkFormatoCargaAnual" OnClick="LnkFormatoCargaAnual_Click" runat="server"><i class="fa fa-download" aria-hidden="true"></i>Formato Anual</asp:LinkButton>
|
||||
</li>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
@@ -117,7 +117,7 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
{
|
||||
|
||||
column = 1;
|
||||
libro.Cell(row, column++).Value = drow["Aplica"].ToString()=="1"?"Si":"No";
|
||||
libro.Cell(row, column++).Value = drow["Aplica"].ToString() == "1" ? "Si" : "No";
|
||||
libro.Cell(row, column++).Value = drow["causa"];
|
||||
libro.Cell(row, column++).Value = drow["Codigo"];
|
||||
libro.Cell(row, column++).Value = drow["NombreCompleto"];
|
||||
@@ -138,9 +138,9 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
}
|
||||
}
|
||||
|
||||
libro.SheetView.Freeze(initrowdata-1, 5);
|
||||
libro.SheetView.Freeze(initrowdata - 1, 5);
|
||||
libro.ColumnsUsed().AdjustToContents();
|
||||
libro.Range(initrowdata-1, 6, initrowdata-1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
|
||||
libro.Range(initrowdata - 1, 6, initrowdata - 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
|
||||
libro.Range(initrowdata, 8, row, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Right;
|
||||
libro.Range(initrowdata, 8, row, column).SetDataType(ClosedXML.Excel.XLDataType.Number);
|
||||
libro.Range(initrowdata, 8, row, column).Style.NumberFormat.Format = "$#,###,###,###,###,###,0.00";
|
||||
@@ -193,7 +193,7 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
{
|
||||
using (ClsNominas onom = new ClsNominas())
|
||||
{
|
||||
if(onom.PersonalAplicaCalculoAnual(UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, CvePersonal, 0, TxtMotivo.Text))
|
||||
if (onom.PersonalAplicaCalculoAnual(UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, CvePersonal, 0, TxtMotivo.Text))
|
||||
{
|
||||
Alert("El empleado sera omitido del calculo anual");
|
||||
RegistraScript("$('#DModalcancelarEmpleado').modal('hide');");
|
||||
@@ -204,15 +204,15 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
|
||||
protected void LnkOpenModalAutoriza_Click(object sender, EventArgs e)
|
||||
{
|
||||
using(ClsNominas onom = new ClsNominas())
|
||||
using (ClsNominas onom = new ClsNominas())
|
||||
{
|
||||
if (onom.GetConceptos(UsuarioActual.CveEmpresa, "-1", -1, -1, -1))
|
||||
{
|
||||
DdlConceptoCargo.DataSource = onom.DtResultados;
|
||||
DdlConceptoCompensar.DataSource = onom.DtResultados;
|
||||
DdlConceptoCargo.DataBind();
|
||||
DdlConceptoCompensar.DataBind();
|
||||
DataRow drow = onom.DtResultados.FiltroPrimero(string.Format("CveSistema ={0}",46));
|
||||
DdlConceptoCompensar.DataBind();
|
||||
DataRow drow = onom.DtResultados.FiltroPrimero(string.Format("CveSistema ={0}", 46));
|
||||
if (drow != null)
|
||||
{
|
||||
DdlConceptoCargo.SelectedValueExist(drow["CveConcepto"]);
|
||||
@@ -221,7 +221,7 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
if (drow != null)
|
||||
{
|
||||
DdlConceptoCompensar.SelectedValueExist(drow["CveConcepto"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RegistraScript("$('#DModalAutoriza').modal();");
|
||||
@@ -231,12 +231,12 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
protected void LnkAutoriza_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool continuar = true;
|
||||
int numpagos = TxtNumerodePagos.Text.ToEntero();
|
||||
int numpagos = TxtNumerodePagos.Text.ToEntero();
|
||||
|
||||
|
||||
System.Xml.Linq.XDocument xmlarchivos = new System.Xml.Linq.XDocument();
|
||||
XElement xfolder = new XElement("personal");
|
||||
foreach (GridViewRow item in GVCalculoISRAnual.Rows )
|
||||
foreach (GridViewRow item in GVCalculoISRAnual.Rows)
|
||||
{
|
||||
XElement xempleado = new XElement("empleado");
|
||||
xempleado.SetAttributeValue("CvePersonal", item.DataKey("CvePersonal"));
|
||||
@@ -245,8 +245,8 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
|
||||
xfolder.Add(xempleado);
|
||||
}
|
||||
xmlarchivos.Add(xfolder);
|
||||
string xmlpeople= xmlarchivos.ToString();
|
||||
xmlarchivos.Add(xfolder);
|
||||
string xmlpeople = xmlarchivos.ToString();
|
||||
|
||||
using (ClsNominas onom = new ClsNominas())
|
||||
{
|
||||
@@ -260,4 +260,77 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas
|
||||
|
||||
RegistraScript(string.Format("console.log('{0}');debugger", xmlpeople));
|
||||
}
|
||||
|
||||
protected void LnkFormatoCargaAnual_Click(object sender, EventArgs e)
|
||||
{
|
||||
int Ejercicio = DdlEjercicios.SelectedValue.ToEntero();
|
||||
string rutaformato = string.Format("{0}\\Grales\\{1}", Extensiones.ModExtensiones.DirectorioEmpresas, "FormatoCalculoAnual.xlsx").Replace("/", "\\").Replace("\\\\", "\\");
|
||||
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook(rutaformato);
|
||||
var hojaBase = wb.Worksheet(1);
|
||||
var hojaEmpleados = wb.Worksheet(2);
|
||||
hojaEmpleados.Name = "Empleados";
|
||||
// Copy the worksheet to a new sheet in this workbook
|
||||
//hojaBase.CopyTo("E1");
|
||||
hojaBase.Cell(6, 21).Value = Ejercicio;
|
||||
int index = 1;
|
||||
using (ClsNominas onom = new ClsNominas())
|
||||
{
|
||||
onom.CalculoISRAnual(Ejercicio, UsuarioActual.Empresa.CveEmpresa);
|
||||
foreach (DataRow droi in onom.DtResultados.Rows)
|
||||
{
|
||||
|
||||
//o15
|
||||
//as45
|
||||
if (droi["Aplica"].ToString() == "1")
|
||||
{
|
||||
var Choja = hojaBase.CopyTo(String.Format("E_{0:000}", index++));
|
||||
hojaEmpleados.Cell(index, 1).Value = droi["NombreCompleto"];
|
||||
hojaEmpleados.Cell(index, 1).Hyperlink = new ClosedXML.Excel.XLHyperlink(Choja.Cell(10, 9));
|
||||
|
||||
Choja.Cell(256, 9).Value = droi["NombreCompleto"];
|
||||
Choja.Cell(10, 37).Value = droi["CURP"];
|
||||
Choja.Cell(10, 6).Value = droi["RFC"];
|
||||
Choja.Cell(13, 2).Value = droi["APaterno"];
|
||||
Choja.Cell(13, 19).Value = droi["AMaterno"];
|
||||
Choja.Cell(13, 36).Value = droi["Nombres"];
|
||||
Choja.Cell(216, 15).Value = droi["BaseGravada"];
|
||||
Choja.Cell(220, 15).Value = droi["BaseExcenta"];
|
||||
Choja.Cell(224, 15).Value = droi["IngresosTotales"];
|
||||
Choja.Cell(233, 15).Value = droi["ISRRetenido"];
|
||||
|
||||
|
||||
Choja.Cell(37, 15).Value = droi["IngresosTotales"];
|
||||
Choja.Cell(48, 15).Value = droi["BaseExcenta"];
|
||||
Choja.Cell(60, 15).Value = droi["BaseGravada"];
|
||||
Choja.Cell(66, 45).Value = droi["ISRRetenido"];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
hojaBase.Delete();
|
||||
|
||||
|
||||
|
||||
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}.xlsx", "Calculo Anual"));
|
||||
Response.BinaryWrite(memoryStream.ToArray());
|
||||
Response.End();
|
||||
|
||||
}
|
||||
}
|
||||
65
Nomina/CargaArchivosNomina.aspx
Normal file
65
Nomina/CargaArchivosNomina.aspx
Normal file
@@ -0,0 +1,65 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CargaArchivosNomina.aspx.cs" Inherits="Nomina_CargaArchivosNomina" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
<asp:UpdatePanel runat="server" ID="UpDetallesDia" UpdateMode="Conditional">
|
||||
|
||||
<ContentTemplate>
|
||||
|
||||
<div class="portlet light smmallpadding bordered">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="fa fa-upload font-green"></i>
|
||||
<span class="caption-subject bold uppercase">Paso 1: cargar plantilla </span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body rowpadding ">
|
||||
<asp:Label runat="server" Text="Label">ingrese el archivo a cargar</asp:Label>
|
||||
<asp:TextBox ID="TxtArchivoXls" CssClass="ADSdropzone hidden" data-maxFilesize="100" runat="server"></asp:TextBox>
|
||||
<div class="text-right">
|
||||
<asp:LinkButton ID="LnkCargarArchivo" CssClass="btn btn-success" OnClick="LnkCargarArchivo_Click" runat="server">Cargar excel</asp:LinkButton>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="portlet light smmallpadding bordered">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="fa fa-upload font-green"></i>
|
||||
<span class="caption-subject bold uppercase">Paso 2: subirarchivo</span>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body rowpadding ">
|
||||
<asp:GridView ID="GVDatos" data-cols="6" CssClass="table table-hover table-advance ScrollAD" runat="server"></asp:GridView>
|
||||
<div class="text-right">
|
||||
<asp:LinkButton ID="LnkSubirArchivo" CssClass="btn btn-success" OnClick="LnkSubirArchivo_Click" runat="server">Subir Archivo</asp:LinkButton>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
218
Nomina/CargaArchivosNomina.aspx.cs
Normal file
218
Nomina/CargaArchivosNomina.aspx.cs
Normal file
@@ -0,0 +1,218 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using ClosedXML.Excel;
|
||||
using Extensiones;
|
||||
|
||||
public partial class Nomina_CargaArchivosNomina : System.Web.UI.Page
|
||||
{
|
||||
#region propiedades
|
||||
|
||||
private string URLFile
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ViewState["URLFile"] == null) { return ""; }
|
||||
else { return ViewState["URLFile"].ToString(); }
|
||||
}
|
||||
|
||||
set { ViewState["URLFile"] = value; }
|
||||
}
|
||||
private string extension
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ViewState["extension"] == null) { return ""; }
|
||||
else { return ViewState["extension"].ToString(); }
|
||||
}
|
||||
|
||||
set { ViewState["extension"] = value; }
|
||||
}
|
||||
|
||||
private string workname
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ViewState["workname"] == null) { return ""; }
|
||||
else { return ViewState["workname"].ToString(); }
|
||||
}
|
||||
|
||||
set { ViewState["workname"] = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void LnkCargarArchivo_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
List<Archivo> filesgral = TxtArchivoXls.getfiles().Archivos;
|
||||
//workBooks = new List<ADSWorksBooks>();
|
||||
foreach (Archivo fileItem in filesgral)
|
||||
{
|
||||
extension = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
|
||||
URLFile = fileItem.FileUrl;
|
||||
}
|
||||
using (var workbook = new XLWorkbook(URLFile))
|
||||
{
|
||||
int position = 1;
|
||||
foreach (IXLWorksheet wokitem in workbook.Worksheets)
|
||||
{
|
||||
workname = wokitem.Name;
|
||||
//workBooks.Add(new ADSWorksBooks() { Name = wokitem.Name, position = position++ });
|
||||
}
|
||||
|
||||
}
|
||||
//DdlWorkBooks.DataSource = workBooks;
|
||||
//DdlWorkBooks.DataBind();
|
||||
//if (workBooks.Count > 0)
|
||||
//{
|
||||
// DdlWorkBooks.SelectedIndex = 1;
|
||||
// DdlWorkBooks_SelectedIndexChanged(null, null);
|
||||
//}
|
||||
|
||||
DataSet ds = new DataSet();
|
||||
DataTable dtDatos = new DataTable();
|
||||
DataTable dt = GetDatosExcel();
|
||||
ds.DataSetName = "DSDatos";
|
||||
dtDatos.TableName = "TCol";
|
||||
dt.TableName = "TData";
|
||||
|
||||
dtDatos.Columns.Add(new DataColumn("Columnas", typeof(string)));
|
||||
dtDatos.Columns.Add(new DataColumn("LEN", typeof(int)));
|
||||
foreach (DataColumn item in dt.Columns)
|
||||
{
|
||||
DataRow drow = dtDatos.NewRow();
|
||||
drow["Columnas"] = item.ColumnName;
|
||||
int longitud = 0;
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
int length = dr[item.ColumnName].ToString().Length;
|
||||
|
||||
longitud = length > longitud ? length : longitud;
|
||||
}
|
||||
drow["LEN"] = longitud;
|
||||
dtDatos.Rows.Add(drow);
|
||||
}
|
||||
|
||||
ds.Tables.Add(dtDatos);
|
||||
ds.Tables.Add(dt);
|
||||
string xml = ds.GetXml();
|
||||
|
||||
using (ClsNominas objbase = new ClsNominas())
|
||||
{
|
||||
if (objbase.ExcelToBD(xml))
|
||||
{
|
||||
this.Alert("Información capturada", ModExtensiones.TipoMensaje.MsgInformacion);
|
||||
}
|
||||
}
|
||||
GVDatos.DataSource = dt;
|
||||
GVDatos.DataBind();
|
||||
|
||||
}
|
||||
public DataTable GetDatosExcel()
|
||||
{
|
||||
|
||||
DataTable dtDatos = new DataTable();
|
||||
ConcurrentDictionary<string, string> ColumnsTitles = new ConcurrentDictionary<string, string>();
|
||||
using (var workbook = new XLWorkbook(URLFile))
|
||||
{
|
||||
IXLWorksheet workSheet = workbook.Worksheet(2);
|
||||
DateTime d = new DateTime();
|
||||
bool continuarFila = true;
|
||||
string validaValor;
|
||||
|
||||
int contadorValida = 0;
|
||||
bool haveTitles = true;//chkcontieneTitulos.Checked;
|
||||
int FilaInicial = 2;// TxtInicia.Text.ToEntero() > 0 ? TxtInicia.Text.ToEntero() : 1;
|
||||
int ColumnaFinal = 62; //48;//TxtColumnas.Text.ToEntero();
|
||||
int cFila = FilaInicial;
|
||||
int cCol = 1;
|
||||
|
||||
while (cCol <= ColumnaFinal)
|
||||
{
|
||||
string Valor = cCol.ToString();
|
||||
if (haveTitles)
|
||||
{
|
||||
Valor = workSheet.Cell(cFila, cCol).Value != null && workSheet.Cell(cFila, cCol).Value.GetType() == d.GetType() ? string.Format("{0:yyyy/MM/dd}", workSheet.Cell(cFila, cCol).Value) : workSheet.Cell(cFila, cCol).Value.ToString();
|
||||
Valor = validtitle(Valor);
|
||||
}
|
||||
if (!ColumnsTitles.TryAdd(Valor, Valor))
|
||||
{
|
||||
int x = 2;
|
||||
while (!ColumnsTitles.TryAdd(string.Format("{0}_{1}", Valor, x), Valor)) { x++; }
|
||||
Valor = string.Format("{0}_{1}", Valor, x);
|
||||
}
|
||||
dtDatos.Columns.Add(new DataColumn(Valor, typeof(string)));
|
||||
cCol++;
|
||||
}
|
||||
if (haveTitles)
|
||||
{
|
||||
cFila++;
|
||||
}
|
||||
while (continuarFila)
|
||||
{
|
||||
DataRow drow = dtDatos.NewRow();
|
||||
cCol = 1;
|
||||
validaValor = "";
|
||||
while (cCol <= ColumnaFinal)
|
||||
{
|
||||
string Valor = workSheet.Cell(cFila, cCol).Value != null && workSheet.Cell(cFila, cCol).Value.GetType() == d.GetType() ? string.Format("{0:yyyy/MM/dd}", workSheet.Cell(cFila, cCol).Value) : workSheet.Cell(cFila, cCol).Value.ToString();
|
||||
validaValor = string.Format("{0}{1}", validaValor, Valor);
|
||||
drow[cCol - 1] = Valor;
|
||||
cCol++;
|
||||
}
|
||||
if (validaValor.Trim() == "")
|
||||
{
|
||||
contadorValida++;
|
||||
if (contadorValida > 30)
|
||||
{
|
||||
continuarFila = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
contadorValida = 0;
|
||||
dtDatos.Rows.Add(drow);
|
||||
}
|
||||
cFila++;
|
||||
if (cFila >= 1048576)
|
||||
{
|
||||
continuarFila = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dtDatos;
|
||||
}
|
||||
public string validtitle(string Valor)
|
||||
{
|
||||
|
||||
Valor = Valor.Replace(" ", "_");
|
||||
Valor = Valor.Replace("$$$$", "_Money_");
|
||||
Valor = Valor.Replace("$$$", "_Money_");
|
||||
Valor = Valor.Replace("$$", "_Money_");
|
||||
Valor = Valor.Replace("$", "_Money_");
|
||||
Valor = Valor.Replace(".", string.Empty);
|
||||
Regex reg = new Regex("[*'\",&#^@]");
|
||||
Valor = reg.Replace(Valor, string.Empty);
|
||||
if (Valor.Trim().Length == 0)
|
||||
{
|
||||
Valor = "Val";
|
||||
}
|
||||
return Valor;
|
||||
}
|
||||
|
||||
protected void LnkSubirArchivo_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
1248
Nomina/Nomina.aspx
1248
Nomina/Nomina.aspx
File diff suppressed because it is too large
Load Diff
@@ -215,6 +215,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
DataTable dtperinc = null;
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
objnom.GetNominasSinTimbrar(-1, UsuarioActual.CveEmpresa);
|
||||
@@ -225,6 +226,14 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
RegistraScript("$('#ModalNominaPendiente').modal();");
|
||||
}
|
||||
|
||||
if (objnom.GetConceptos(UsuarioActual.CveEmpresa))
|
||||
{
|
||||
dtNomConceptos = objnom.DtResultados;
|
||||
}
|
||||
if (objnom.PersonalIncapacidadCatalogos())
|
||||
{
|
||||
dtperinc = objnom.DtResultados;
|
||||
}
|
||||
|
||||
}
|
||||
DmodalCancelartimbre.Visible = (UsuarioActual.CveUsuario == 100);
|
||||
@@ -271,17 +280,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
PermisoEmitir = false;
|
||||
PermisoCancelarEmitido = false;
|
||||
}
|
||||
DataTable dtperinc = null;
|
||||
using (ClsNominas onom = new ClsNominas())
|
||||
using (ClsRH onom = new ClsRH())
|
||||
{
|
||||
|
||||
if (onom.GetConceptos(UsuarioActual.CveEmpresa))
|
||||
if (onom.GetRegistrosPatronales(-1, UsuarioActual.CveEmpresa, 1))
|
||||
{
|
||||
dtNomConceptos = onom.DtResultados;
|
||||
}
|
||||
if (onom.PersonalIncapacidadCatalogos())
|
||||
{
|
||||
dtperinc = onom.DtResultados;
|
||||
DdlRegistroPatronal.DataSource = onom.DtResultados;
|
||||
DdlRegistroPatronal.DataBind();
|
||||
}
|
||||
}
|
||||
if (dtperinc != null)
|
||||
@@ -1286,12 +1290,18 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
if (Nom.GetNom_Nominas(CveNomina, -1, -1, -1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
Timbrado ObjTimbrado = new Timbrado();
|
||||
|
||||
DataRow nrow = Nom.DtResultados.Rows[0];
|
||||
bool secancelo11 = false;
|
||||
bool secancelo12 = false;
|
||||
string FolioFiscal = Nom.FolioFiscal;
|
||||
decimal Total = Nom.Total.ToString().ToDecimal();
|
||||
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 FolioFiscalFiniquito = nrow["FolioFiscalFiniquito"].ToString();
|
||||
//SeTimbroFiniquito,N.FolioFiscalFiniquito
|
||||
DataRow rowc = get_GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa).FiltroPrimero(string.Format("CveMotivoCancelacion={0}", DdlMotivoCancelacion.SelectedValue));
|
||||
int CveMotivoCancelacion = -1;
|
||||
if (rowc != null)
|
||||
@@ -1318,15 +1328,57 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
Alert("Ocurrió un error al mover el archivo fiscal cancelado");
|
||||
}
|
||||
|
||||
Nom.UpdateEstatusNomNominas(2, UsuarioActual.Empresa.CvePAC, "", ("01/01/2000").ToDate(), ("01/01/2000").ToDate(), CveNomina, 0, 0, 0, 0, 0);
|
||||
|
||||
Alert($"La nómina con folio fiscal '{FolioFiscal}' fue cancelada ante el SAT", TipoMensaje.MsgInformacion);
|
||||
secancelo11 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
string.Format("Error al cancelar nomina {0}", FolioFiscal).GuardaLog();
|
||||
//ObjTimbrado.MensajeErrorCFDI.GuardaLog();
|
||||
}
|
||||
if (!SeTimbroFiniquito)
|
||||
{
|
||||
secancelo12 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
reultado = ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscalFiniquito, Total, RFCReceptor, RFCEmisor, 4, CveSATMotivoCancelacion: CveMotivoCancelacion);
|
||||
if (reultado.Verificado)//,CveSATMotivoCancelacion:=
|
||||
{
|
||||
try
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
ObjTimbrado.MensajeErrorCFDI.GuardaLog();
|
||||
secancelo12 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
string.Format("Error al cancelar nomina {0}", FolioFiscalFiniquito).GuardaLog();
|
||||
//ObjTimbrado.MensajeErrorCFDI.GuardaLog();
|
||||
}
|
||||
|
||||
}
|
||||
if (secancelo11 && secancelo12)
|
||||
{
|
||||
|
||||
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
|
||||
{
|
||||
Alert($"no se pudo cancelar el folio fiscal<br>{ObjTimbrado.MensajeErrorCFDI}", TipoMensaje.MsgAdvertencia);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2201,6 +2253,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
DdlFormapagovacaciones_SelectedIndexChanged(null, null);
|
||||
ChkVacPrimaVacacional.Checked = true;
|
||||
ChkVacCobrarIMSS.Checked = true;
|
||||
RegistraScript("$('#ModalSRVacaciones').modal()");
|
||||
}
|
||||
|
||||
protected void DdlFormapagovacaciones_SelectedIndexChanged(object sender, EventArgs e)
|
||||
@@ -2316,6 +2369,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
//CargaVacacionesResumenPeriodoActual();
|
||||
//VacacionesMandaCorreoSupervisor("Solicitud Vacaciones " + NombreCompleto, VacSupervisorCorreo, VacSupervisorNombre, NombreCompleto, fInicio, fFin);
|
||||
Alert("Las vacaciones se han solicitado");
|
||||
RegistraScript("$('#ModalSRVacaciones').modal('hide')");
|
||||
}
|
||||
}
|
||||
else { Alert("La fecha Inicial debe ser inferior a la fecha final.", TipoMensaje.MsgAdvertencia); }
|
||||
@@ -5579,6 +5633,10 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
TxtMontoLimite.Text = "";
|
||||
TxtFechaAplicacion.Text = "";
|
||||
ChkEstatus.Visible = true;
|
||||
ChkEstatus.Checked = true;
|
||||
UpMovtosPermanentesModal.Update();
|
||||
RegistraScript("$('#ModalMovtoPermanente').modal()");
|
||||
|
||||
}
|
||||
|
||||
protected void LnkAddMovto_Click(object sender, EventArgs e)
|
||||
@@ -5604,6 +5662,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
UpMovtosPermanentes.Update();
|
||||
this.Alert("Se ha agregado el movimiento permanente");
|
||||
}
|
||||
RegistraScript("$('#ModalMovtoPermanente').modal('hide')");
|
||||
|
||||
}
|
||||
|
||||
@@ -5626,7 +5685,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
}
|
||||
if (Continuar)
|
||||
{
|
||||
this.RegistraScript("$('#DModalMovtoPermanente').modal('hide');");
|
||||
this.RegistraScript("$('#ModalMovtoPermanente').modal('hide');");
|
||||
CargaMovtoPermanente();
|
||||
UpMovtosPermanentes.Update();
|
||||
this.Alert("Se ha actualizado el movimiento permanente");
|
||||
@@ -5640,7 +5699,26 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
pnlVecesAplicar.Visible = DdlTipoDescto.SelectedValue.ToEntero() < 3;
|
||||
}
|
||||
|
||||
protected void LnkEditarMovtoPermanente_Click(object sender, EventArgs e)
|
||||
protected void LnkremoveMovtoPermanente_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
CcveMovtoPermanente = gvRow.DataKey("CveMovtoPermanente").ToEntero();
|
||||
bool Continuar = false;
|
||||
using (ClsNominas ObjMovt = new ClsNominas())
|
||||
{
|
||||
Continuar = ObjMovt.RemoveMovtoPermanente(CcveMovtoPermanente);
|
||||
|
||||
}
|
||||
if (Continuar)
|
||||
{
|
||||
this.RegistraScript("$('#ModalMovtoPermanente').modal('hide');");
|
||||
CargaMovtoPermanente();
|
||||
UpMovtosPermanentes.Update();
|
||||
this.Alert("Se ha eliminadó el movimiento permanente");
|
||||
}
|
||||
}
|
||||
protected void LnkEditarMovtoPermanente_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
@@ -5685,16 +5763,16 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
DdlCtaContable.SelectedValueExist(CveCuenta);
|
||||
}
|
||||
ChkEstatus.Checked = estatus;
|
||||
this.RegistraScript("$('#DModalMovtoPermanente').modal();");
|
||||
RegistraScript("$('#ModalMovtoPermanente').modal()");
|
||||
|
||||
|
||||
pnlAddupMovto.Visible = true;
|
||||
LnkAddMovto.Visible = false;
|
||||
LnkUpMovto.Visible = true;
|
||||
UpMovtosPermanentes.Update();
|
||||
UpMovtosPermanentesModal.Update();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
protected void LnkAutorizar_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -6944,7 +7022,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
DdlSRINCcveControlIncapacidad.SelectedValueExist(cveControlIncapacidad.ToString());
|
||||
TxtSRINCdescripcion.Text = descripcion.ToString();
|
||||
LnkAgregarIncapacidad.Visible = false;
|
||||
//LnkActualizarIncapacidad.Visible = true;
|
||||
LnkActualizarIncapacidad.Visible = true;
|
||||
RegistraScript("$('#ModalSRIncapacidad').modal()");
|
||||
}
|
||||
protected void LnkshowaaddIncapacidad_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -6952,6 +7031,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
LnkAgregarIncapacidad.Visible = true;
|
||||
LnkActualizarIncapacidad.Visible = false;
|
||||
CcvePersonalIncapacidad = 0;
|
||||
RegistraScript("$('#ModalSRIncapacidad').modal()");
|
||||
}
|
||||
protected void LnkAgregarIncapacidad_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -6976,6 +7056,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
CargaPersonalIncapacidad();
|
||||
UpsrIncapacidadpersonal.Update();
|
||||
this.Alert("La incapacidad se ha agregado.", TipoMensaje.ToastInformacion);
|
||||
RegistraScript("$('#ModalSRIncapacidad').modal('hide')");
|
||||
}
|
||||
}
|
||||
protected void LnkActualizarIncapacidad_Click(object sender, EventArgs e)
|
||||
@@ -7002,6 +7083,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
CargaPersonalIncapacidad();
|
||||
UpsrIncapacidadpersonal.Update();
|
||||
this.Alert("La incapacidad se ha actualizado.", TipoMensaje.ToastInformacion);
|
||||
RegistraScript("$('#ModalSRIncapacidad').modal('hide')");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -8073,7 +8155,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
protected void CargaVacacionesEmpresas()
|
||||
{
|
||||
using (ClsRH ObjVaca = new ClsRH())
|
||||
using (ClsRH ObjVaca = new ClsRH())
|
||||
{
|
||||
ObjVaca.VacacionesEmpresasGet(UsuarioActual.CveEmpresa, -1, -1);
|
||||
GVVacacionesEmpresas.DataSource = ObjVaca.DtResultados;
|
||||
@@ -8089,12 +8171,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
int diasVacaciones = TxtVacadiasVacaciones.Text.ToEntero();
|
||||
int Cinicio = TxtVacaInicio.Text.ToEntero();
|
||||
int Cfin = TxtVacaFin.Text.ToEntero();
|
||||
int Cfin = TxtVacaFin.Text.ToEntero();
|
||||
bool Continuar = false;
|
||||
using (ClsRH ObjVaca = new ClsRH())
|
||||
{
|
||||
|
||||
Continuar = ObjVaca.VacacionesEmpresasAdd(UsuarioActual.CveEmpresa, Cinicio, Cfin, diasVacaciones);
|
||||
Continuar = ObjVaca.VacacionesEmpresasAdd(UsuarioActual.CveEmpresa, Cinicio, Cfin, diasVacaciones);
|
||||
}
|
||||
if (Continuar)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user