This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2022-02-10 21:00:31 -07:00
parent 95bf827bba
commit 6bac97ba62
6 changed files with 1377 additions and 386 deletions

View File

@@ -431,7 +431,7 @@ Partial Class PopUpVerFactura
Dim bcode As New BarcodeLib.Barcode() Dim bcode As New BarcodeLib.Barcode()
Dim img = bcode.Encode(BarcodeLib.TYPE.CODE128, String.Format("{0}", noPallet), 50, 10) Dim img = bcode.Encode(BarcodeLib.TYPE.CODE128, String.Format("{0}", noPallet), 500, 100)
Dim barcodebyte As Byte() Dim barcodebyte As Byte()
Using ms = New MemoryStream() Using ms = New MemoryStream()
img.Save(ms, System.Drawing.Imaging.ImageFormat.Png) img.Save(ms, System.Drawing.Imaging.ImageFormat.Png)

File diff suppressed because it is too large Load Diff

View File

@@ -8,23 +8,34 @@
text-align: left; text-align: left;
} }
.AdsCHeader .GvNominas th:nth-child(1), .GvNominas th:nth-child(1),
.AdsCHeader .GvNominas td:nth-child(1) { .GvNominas td:nth-child(1) {
width:1px;
font-size:0px;
word-break: break-all;
}
.ADSContainer .GvNominas th:nth-child(1),
.ADSContainer .GvNominas td:nth-child(1) {
/* display:none;*/
visibility:hidden;
}
.AdsCHeader .GvNominas th:nth-child(2),
.AdsCHeader .GvNominas td:nth-child(2) {
text-align: left; text-align: left;
width: 50px; width: 50px;
} }
.AdsCHeader .GvNominas th:nth-child(2), .AdsCHeader .GvNominas th:nth-child(3),
.AdsCHeader .GvNominas td:nth-child(2) { .AdsCHeader .GvNominas td:nth-child(3) {
text-align: left; text-align: left;
width: 200px; width: 200px;
} }
.GvNominas td:nth-child(n+3) { .GvNominas td:nth-child(n+4) {
text-align: center; text-align: center;
} }
.GvNominas td:nth-child(n+3) div { .GvNominas td:nth-child(n+4) div {
text-align: center; text-align: center;
} }
@@ -138,8 +149,9 @@
</div> </div>
</div> </div>
<div class="portlet-body"> <div class="portlet-body">
<asp:GridView ID="GvNominas" runat="server" OnRowDataBound="GvNominas_RowDataBound" CssClass="table table-striped table-advance table-hover mysmallbtn ScrollAD Widthall GvNominas" <asp:GridView ID="GvNominas" runat="server" OnRowDataBound="GvNominas_RowDataBound" OnRowCreated="GvNominas_RowCreated" CssClass="table table-striped table-advance table-hover mysmallbtn ScrollAD Widthall GvNominas"
Style="text-align: center;" GridLines="None" data-cols="2" data-rows="1" data-heighterror="360" ShowHeaderWhenEmpty="true" ShowHeader="true"> Style="text-align: center;" GridLines="None" data-cols="3" data-rows="1" data-heighterror="360" ShowHeaderWhenEmpty="true" ShowHeader="true"
DataKeyNames="CvePersonal,CveSubProyecto">
<Columns></Columns> <Columns></Columns>
</asp:GridView> </asp:GridView>

View File

@@ -23,13 +23,18 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
{ {
if (!IsPostBack) if (!IsPostBack)
{ {
DdlTurno.DataSource = GlobalDTTurno.FiltraParametros("CveEmpresa = " + UsuarioActual.CveEmpresa); DdlTurno.DataSource = GlobalDTTurno.FiltraParametros("CveEmpresa = " + UsuarioActual.CveEmpresa);
DdlTurno.DataBind(); DdlTurno.DataBind();
CargaTiposPeriodo(); CargaTiposPeriodo();
TxtRpdFechaInicio.Text = string.Format("{0:dd/MM/yyyy}",DateTime.Now ); TxtRpdFechaInicio.Text = string.Format("{0:dd/MM/yyyy}", DateTime.Now);
TxtRpdFechaFin.Text = string.Format("{0:dd/MM/yyyy}", DateTime.Now); TxtRpdFechaFin.Text = string.Format("{0:dd/MM/yyyy}", DateTime.Now);
if (UsuarioActual.CveEmpresa == 119)
{
TxtRpdFechaInicio.Text = string.Format("{1}{0:/MM/yyyy}", DateTime.Now,(DateTime.Now.Day>15?"16":"01"));
DdlTipoVista.SelectedValue = "2";
}
DdlTipoAsistencias.DataSource = GlobalDTAsistenciasInasistencias.FiltraParametros(string.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa)); DdlTipoAsistencias.DataSource = GlobalDTAsistenciasInasistencias.FiltraParametros(string.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa));
DdlTipoAsistencias.DataBind(); DdlTipoAsistencias.DataBind();
@@ -68,6 +73,9 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
DateTime FechaI = TxtRpdFechaInicio.Text.ToDateTime(); DateTime FechaI = TxtRpdFechaInicio.Text.ToDateTime();
DateTime FechaF = TxtRpdFechaFin.Text.ToDateTime().AddDays(1); DateTime FechaF = TxtRpdFechaFin.Text.ToDateTime().AddDays(1);
DataTable dtCon = new DataTable(); DataTable dtCon = new DataTable();
dtCon.Columns.Add(new DataColumn("CvePersonal", typeof(int)));
dtCon.Columns.Add(new DataColumn("CveSubProyecto", typeof(int)));
dtCon.Columns.Add(new DataColumn("SubProyecto", typeof(string)));
dtCon.Columns.Add(new DataColumn("Codigo", typeof(string))); dtCon.Columns.Add(new DataColumn("Codigo", typeof(string)));
dtCon.Columns.Add(new DataColumn("Empleado", typeof(string))); dtCon.Columns.Add(new DataColumn("Empleado", typeof(string)));
string strasis = "<i class='fa fa-check-square' style=\"color:green;\"></i>"; string strasis = "<i class='fa fa-check-square' style=\"color:green;\"></i>";
@@ -94,13 +102,28 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
} }
using (ClsNominas objnom = new ClsNominas()) using (ClsNominas objnom = new ClsNominas())
{ {
int CveSubProyecto = -1;
if (objnom.GetchecadorAsistencia(FechaI, FechaF, UsuarioActual.CveEmpresa)) if (objnom.GetchecadorAsistencia(FechaI, FechaF, UsuarioActual.CveEmpresa))
{ {
DataTable dtASis = objnom.DTSetResultados.Tables[0]; DataTable dtASis = objnom.DTSetResultados.Tables[0];
dtper = objnom.DTSetResultados.Tables[1]; dtper = objnom.DTSetResultados.Tables[1];
foreach (DataRow item in dtper.Rows) foreach (DataRow item in dtper.Rows)
{ {
if (CveSubProyecto != item["CveSubProyecto"].ToString().ToEntero())
{
CveSubProyecto = item["CveSubProyecto"].ToString().ToEntero();
DataRow drowsub = dtCon.NewRow();
drowsub["CveSubProyecto"] = item["CveSubProyecto"];
drowsub["SubProyecto"] = item["SubProyecto"];
drowsub["Empleado"] = item["SubProyecto"];
dtCon.Rows.Add(drowsub);
}
DataRow drow = dtCon.NewRow(); DataRow drow = dtCon.NewRow();
drow["CveSubProyecto"] = item["CveSubProyecto"];
drow["SubProyecto"] = item["SubProyecto"];
drow["CvePersonal"] = item["CvePersonal"];
drow["Codigo"] = item["Codigo"]; drow["Codigo"] = item["Codigo"];
drow["Empleado"] = item["NombreCompleto"]; drow["Empleado"] = item["NombreCompleto"];
CFecha = FechaI; CFecha = FechaI;
@@ -247,6 +270,12 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
DataTable dtCon = generateTable(); DataTable dtCon = generateTable();
GvNominas.DataSource = dtCon; GvNominas.DataSource = dtCon;
GvNominas.DataBind(); GvNominas.DataBind();
if (GvNominas.Columns.Count > 2)
{
GvNominas.Columns[0].Visible = false;
GvNominas.Columns[1].Visible = false;
GvNominas.Columns[2].Visible = false;
}
DateTime fechai = TxtRpdFechaInicio.Text.ToDateTime(); DateTime fechai = TxtRpdFechaInicio.Text.ToDateTime();
DateTime fechaf = TxtRpdFechaFin.Text.ToDateTime().AddDays(1); DateTime fechaf = TxtRpdFechaFin.Text.ToDateTime().AddDays(1);
using (ClsGenerales ObjGral = new ClsGenerales()) using (ClsGenerales ObjGral = new ClsGenerales())
@@ -275,11 +304,22 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
UpDatos.Update(); UpDatos.Update();
} }
protected void GvNominas_RowCreated(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[0].Visible = false;
e.Row.Cells[1].Visible = false;
//e.Row.Cells[2].Visible = false;
}
protected void GvNominas_RowDataBound(object sender, GridViewRowEventArgs e) protected void GvNominas_RowDataBound(object sender, GridViewRowEventArgs e)
{ {
if (e.Row.RowType == DataControlRowType.DataRow) if (e.Row.RowType == DataControlRowType.DataRow)
{ {
if (e.Row.DataKey("CvePersonal").ToEntero() <= 0)
{
e.Row.CssClass = "Totales";
}
for (int j = 0; j < e.Row.Cells.Count; j++) for (int j = 0; j < e.Row.Cells.Count; j++)
{ {
string encoded = e.Row.Cells[j].Text; string encoded = e.Row.Cells[j].Text;
@@ -537,6 +577,29 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook(); ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
var libro = wb.AddWorksheet(dtCon, "Asistencia"); var libro = wb.AddWorksheet(dtCon, "Asistencia");
var myCustomStyle = ClosedXML.Excel.XLWorkbook.DefaultStyle;
myCustomStyle.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(155, 187, 89));
//155,187,89
myCustomStyle.Font.SetBold(true);
myCustomStyle.Font.SetFontSize(14);
myCustomStyle.Font.FontColor = ClosedXML.Excel.XLColor.White;
int cfila = 2;
foreach (DataRow drow in dtCon.Rows)
{
if (drow["CvePersonal"].ToString().ToEntero() > 0)
{
}
else
{
libro.Range(cfila,1, cfila, dtCon.Columns.Count).Style = myCustomStyle;
}
cfila++;
}
libro.Column(1).Delete();
libro.Column(1).Delete();
libro.Column(1).Delete();
//string strinicio; //string strinicio;
//string strfin; //string strfin;
//ClosedXML.Excel.IXLFontBase fini; //ClosedXML.Excel.IXLFontBase fini;
@@ -604,4 +667,5 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
Response.BinaryWrite(memoryStream.ToArray()); Response.BinaryWrite(memoryStream.ToArray());
Response.End(); Response.End();
} }
} }

View File

@@ -8906,290 +8906,299 @@ Partial Class Ventas
ViewState("CveVenta") = ObjFactura.CveVenta ViewState("CveVenta") = ObjFactura.CveVenta
If Request("CveEmbarqueManifiesto") IsNot Nothing AndAlso IsNumeric(Request("CveEmbarqueManifiesto")) AndAlso Request("CveEmbarqueManifiesto").ToEntero() > 0 Then
If ObjVentas.Embarque_ManifiestoUpvta(ObjFactura.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Request("CveEmbarqueManifiesto").ToEntero()) Then
End If
End If
GVAnticipos.DataBind() GVAnticipos.DataBind()
Try Try
Dim DirectoriArchivoXML As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto) ' System.IO.Path.Combine() Dim DirectoriArchivoXML As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto) ' System.IO.Path.Combine()
If Not Directory.Exists(DirectoriArchivoXML) Then If Not Directory.Exists(DirectoriArchivoXML) Then
Directory.CreateDirectory(DirectoriArchivoXML) Directory.CreateDirectory(DirectoriArchivoXML)
End If End If
Catch ex As Exception Catch ex As Exception
End Try End Try
Dim SeTimbro As Boolean = False Dim SeTimbro As Boolean = False
Dim SeTimbroNC As Boolean = False Dim SeTimbroNC As Boolean = False
Dim EstatusSMS = 0 Dim EstatusSMS = 0
Dim MsgCancelacionRefacturacion As Modelos.Factura.MCancelacionVentaMensaje = Nothing Dim MsgCancelacionRefacturacion As Modelos.Factura.MCancelacionVentaMensaje = Nothing
'TIMBRADO Y CASO ESPECIAL NOTA DE CREDITO 'TIMBRADO Y CASO ESPECIAL NOTA DE CREDITO
If (TipoDoctoDevolucion = "" OrElse Not TipoDoctoDevolucion.Contiene("Rem", "RNC", "Cot", "Ped", "DPe", "PA", "Pd2")) Then If (TipoDoctoDevolucion = "" OrElse Not TipoDoctoDevolucion.Contiene("Rem", "RNC", "Cot", "Ped", "DPe", "PA", "Pd2")) Then
Dim DebeTimbrar As Boolean = True Dim DebeTimbrar As Boolean = True
If UsuarioActual.CveEmpresa.Contiene(1, 72, 80) Then If UsuarioActual.CveEmpresa.Contiene(1, 72, 80) Then
'si tiene anticipos seleccionados y el total es cero, que no se timbre(previo empresa72) 'si tiene anticipos seleccionados y el total es cero, que no se timbre(previo empresa72)
If LblAmortizacion.Text.ToDouble > 0 And TxtTotal.Text.ToDouble <= 0 Then If LblAmortizacion.Text.ToDouble > 0 And TxtTotal.Text.ToDouble <= 0 Then
DebeTimbrar = False DebeTimbrar = False
End If End If
End If End If
'Si es AMORTIZACIÓN ANTICIPO SOBRE FACTURA EN CERO no debe timbrar 'Si es AMORTIZACIÓN ANTICIPO SOBRE FACTURA EN CERO no debe timbrar
If DdlTipoAmortizacionAnticipo.SelectedValue = "3" Then If DdlTipoAmortizacionAnticipo.SelectedValue = "3" Then
DebeTimbrar = False DebeTimbrar = False
End If End If
If UsuarioActual.TienePermisoProceso(335) Then If UsuarioActual.TienePermisoProceso(335) Then
DebeTimbrar = False DebeTimbrar = False
End If End If
If DebeTimbrar AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant", "Dev") Then If DebeTimbrar AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant", "Dev") Then
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso (UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso (UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then
'FACTURA INGRESO/EGRESO 'FACTURA INGRESO/EGRESO
Dim FM As New Modelos.FemsaFactura Dim FM As New Modelos.FemsaFactura
Dim TmpDT7Eleven As New DataTable Dim TmpDT7Eleven As New DataTable
Dim TmpDTComplementosTimbrado As New DataTable Dim TmpDTComplementosTimbrado As New DataTable
If AplicaFEMSA Then If AplicaFEMSA Then
PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado) PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado)
End If
Dim ObjTimbrado As New Timbrado
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
Dim FolioFiscalFactura As String = ObjTimbrado.UUID
Dim MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI
ObjTimbrado = Nothing
'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
If DebeTimbrar AndAlso ListaNotasCreditoGeneradas.Count > 0 Then
Try
For Each NCGenerada In ListaNotasCreditoGeneradas
If NCGenerada.Timbre IsNot Nothing Then
NCGenerada.Timbre.CFDIRelacionados.UUID.Clear()
NCGenerada.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura)
Dim ObjTimbradoNC As New Timbrado
Dim TimbroNC = ObjTimbradoNC.TimbrarFactura(UsuarioActual, NCGenerada)
If Not TimbroNC Then
Alert(ObjTimbradoNC.MensajeErrorCFDI, TipoMensaje.MsgError)
End If
ObjTimbradoNC = Nothing
End If End If
Next
Catch ex As Exception Dim ObjTimbrado As New Timbrado
OnError("Ocurrió un error al timbrar la NC.", ex) SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
End Try Dim FolioFiscalFactura As String = ObjTimbrado.UUID
Dim MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI
ObjTimbrado = Nothing
'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
If DebeTimbrar AndAlso ListaNotasCreditoGeneradas.Count > 0 Then
Try
For Each NCGenerada In ListaNotasCreditoGeneradas
If NCGenerada.Timbre IsNot Nothing Then
NCGenerada.Timbre.CFDIRelacionados.UUID.Clear()
NCGenerada.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura)
Dim ObjTimbradoNC As New Timbrado
Dim TimbroNC = ObjTimbradoNC.TimbrarFactura(UsuarioActual, NCGenerada)
If Not TimbroNC Then
Alert(ObjTimbradoNC.MensajeErrorCFDI, TipoMensaje.MsgError)
End If
ObjTimbradoNC = Nothing
End If
Next
Catch ex As Exception
OnError("Ocurrió un error al timbrar la NC.", ex)
End Try
End If
If SeTimbro AndAlso ObjFactura.TipoDocto.Contiene("Ing") Then
EstatusSMS = EnviarSMSTimbrado(ObjEventos)
End If
If Not SeTimbro Then
Alert(MsgErrorTimbrado, TipoMensaje.MsgError)
End If
'CANCELAR FACTURA ANTERIOR
If SeTimbro AndAlso (Me.CveDevolucion > 0 AndAlso Me.NuevaFactura = 1) Then
If Me.ObjFacturaNC IsNot Nothing Then
Me.ObjFacturaNC.CveEstatusRefacturacion = 2 'MARCAR COMO REFACTURADA
MsgCancelacionRefacturacion = Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, FolioFiscalFactura)
End If
End If
End If
End If
End If End If
If SeTimbro AndAlso ObjFactura.TipoDocto.Contiene("Ing") Then 'VERIFICAR 100% AVANCE A IMPORTE Y CANTIDAD
EstatusSMS = EnviarSMSTimbrado(ObjEventos) If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso CveContrato > 0 Then
End If If ObjContr.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then
If Not SeTimbro Then If ObjContr.DtResultados.Rows.Count > 0 Then
Alert(MsgErrorTimbrado, TipoMensaje.MsgError)
End If
'CANCELAR FACTURA ANTERIOR
If SeTimbro AndAlso (Me.CveDevolucion > 0 AndAlso Me.NuevaFactura = 1) Then 'SI ES FLEXIBLE QUE NOTIFIQUE EL MONTO MAXIMO, SI NO LO ES QUE NOTIFIQUE EL PORCENTAJE ALCANZADO... FLEXIBLE = 2, NO FLEXIBLE = 1
If Me.ObjFacturaNC IsNot Nothing Then If ObjContr.DtResultados.Rows(0)("ModalidadDetalle").ToString() = "1" Then
Me.ObjFacturaNC.CveEstatusRefacturacion = 2 'MARCAR COMO REFACTURADA Dim PorcentajeAvance As Double = ObjContr.DtResultados.Rows(0)("ContratoAvance").ToString().ToDouble
MsgCancelacionRefacturacion = Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, FolioFiscalFactura)
If PorcentajeAvance >= 100 Then
EnviarNotificacionAvance(ObjContr.DtResultados.Rows(0)("NumeroContrato").ToString(), ObjContr.DtResultados.Rows(0)("DescripcionContrato").ToString(), ObjContr.DtResultados.Rows(0)("ContratoTipo").ToString(), ObjContr.DtResultados.Rows(0)("NombreComercial").ToString(), ObjContr.DtResultados.Rows(0)("CorreoVendedor").ToString())
End If
Else
Dim MontoMaximo As Double = ObjContr.DtResultados.Rows(0)("ImporteMax").ToString().ToDouble
Dim Avance As Double = ObjContr.DtResultados.Rows(0)("Avance").ToString().ToDouble
Dim PorcentajeAvance As Double = (Avance / MontoMaximo) * 100
If PorcentajeAvance >= 100 And MontoMaximo > 0 Then
EnviarNotificacionAvance(ObjContr.DtResultados.Rows(0)("NumeroContrato").ToString(), ObjContr.DtResultados.Rows(0)("DescripcionContrato").ToString(), ObjContr.DtResultados.Rows(0)("ContratoTipo").ToString(), ObjContr.DtResultados.Rows(0)("NombreComercial").ToString(), ObjContr.DtResultados.Rows(0)("CorreoVendedor").ToString(), MontoMaximo)
End If
End If
End If
End If End If
End If End If
End If
End If
End If 'MENSAJE PRINCIPAL
MensajeAlert.AppendFormat(String.Format("<br/>La {0}: <b>{1}</b> se generó correctamente.<br/><br/>", ObjFactura.TipoDocumento, ObjFactura.SerieFolio))
'VERIFICAR 100% AVANCE A IMPORTE Y CANTIDAD
If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso CveContrato > 0 Then
If ObjContr.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then
If ObjContr.DtResultados.Rows.Count > 0 Then
'SI ES FLEXIBLE QUE NOTIFIQUE EL MONTO MAXIMO, SI NO LO ES QUE NOTIFIQUE EL PORCENTAJE ALCANZADO... FLEXIBLE = 2, NO FLEXIBLE = 1 ' DESCARGA XML - SI SE TIMBRA MANDA CORREO CON FACTURA
If ObjContr.DtResultados.Rows(0)("ModalidadDetalle").ToString() = "1" Then If SeTimbro Then
Dim PorcentajeAvance As Double = ObjContr.DtResultados.Rows(0)("ContratoAvance").ToString().ToDouble Dim ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
If File.Exists(ArchivoXML) Then
If PorcentajeAvance >= 100 Then MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto)))
EnviarNotificacionAvance(ObjContr.DtResultados.Rows(0)("NumeroContrato").ToString(), ObjContr.DtResultados.Rows(0)("DescripcionContrato").ToString(), ObjContr.DtResultados.Rows(0)("ContratoTipo").ToString(), ObjContr.DtResultados.Rows(0)("NombreComercial").ToString(), ObjContr.DtResultados.Rows(0)("CorreoVendedor").ToString())
End If End If
GeneraPDFFactura(ChkEnviarFactura.Checked) 'MANDA CORREO
End If
'DESCARGA PDF
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant", "Egs", "Dev", "Pd2") Then
'If Not ImprimeAlert Then
Dim ArchivoIngPyMe As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.mrt", UsuarioActual.Empresa.Ruta))
Dim ArchivoIng As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.rdlc", UsuarioActual.Empresa.Ruta))
Dim ArchivoRem As New System.IO.FileInfo(String.Format("{0}Formatos/Remision.rdlc", UsuarioActual.Empresa.Ruta))
Dim ArchivoEgs As New System.IO.FileInfo(String.Format("{0}Formatos/NotaCredito.rdlc", UsuarioActual.Empresa.Ruta))
If ArchivoIng.Exists Or ArchivoRem.Exists Or ArchivoIngPyMe.Exists Or ArchivoEgs.Exists Then
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta)))
Else
MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ")
End If
End If
'ERROR DE NO TIMBRADO
If Not SeTimbro And (DdlTipoComprobante.SelectedValue = "Ing" Or DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Or DdlTipoComprobante.SelectedValue = "Ant") Then
MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir.")
End If
'ERROR DE NO TIMBRADO NC
If Not IsNothing(ObjNC) AndAlso ObjNC.Count > 0 AndAlso Not SeTimbroNC Then
MensajeAlert.AppendFormat("<br/>La NC <b>#{0}</b> no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir.", CType(ObjNC(0), Modelos.Factura).SerieFolio)
End If
'NOTIFICACION DE SMS
Select Case EstatusSMS
Case 1
MensajeAlert.AppendFormat("<br/><b>Notificación SMS:</b> enviado con éxito al cliente al celular: <b>{0}</b>", ObjFactura.Cliente.CobranzaTelefono)
Case 2
MensajeAlert.AppendFormat("<br/><b>Notificación SMS:</b> sin enviar. Ocurrió un error en el envío, por favor verifique la información del cliente.")
Case 3
MensajeAlert.AppendFormat("<br/><b>Notificación SMS:</b> sin enviar. No se pudo cargar el celular del cliente, por favor verifique la información del cliente.")
End Select
'AUTO DESCARGAR PDF
If UsuarioActual.CveEmpresa.Contiene(72, 1) Then
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then
RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta))}'", "Imprimir")
End If
End If
'DESCARGAR PDF DE CICOVISA
'If UsuarioActual.CveEmpresa = 72 And CveCliente = 70381 Then
' If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") Then
' MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar Formato CICOVISA</a></li></ul><br/>", Encripta(String.Format("OP=CIC&CVEVENTA={0}", CveVenta)))
' End If
'End If
If DdlTipoComprobante.SelectedValue = "Cot" Then
If Not CveEmpresaCRM > 0 Then
If CveVenta > 0 Then MensajeAlert = New StringBuilder
Dim ArchivoCotizacion As New System.IO.FileInfo(String.Format("{0}Formatos/Cotizacion.rdlc", UsuarioActual.Empresa.Ruta))
If Opcion = "Cot" And UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
MensajeAlert.AppendFormat("<b><a class='Texto' href=""Ventas.aspx?CveVenta={0}"">Facturar</a></b><br/><br/>", CveVenta)
End If
If ArchivoCotizacion.Exists Then
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=0", CveVenta)))
Else
MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ")
End If
GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO
End If
ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then
If UsuarioActual.CveEmpresa.Contiene(81, 109) Then
EnviaPDFRemision(ChkEnviarFactura.Checked)
End If
End If
'ENVIA CORREO CON DETALLE DEL CONTRATO
If DdlTipoComprobante.SelectedValue.Contiene("DPe", "Ped") Then
If Not String.IsNullOrEmpty(CorreoNotificacionPedDev) Then
EnviarCorreoDevPed()
End If
End If
'MOVIMIENTO DE ALMACEN
If ObjFactura.Inv_CveMovimiento > 0 Then
MensajeAlert.AppendFormat("<br/><br/><b><a target='_blank' class='Texto' href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"">Movimiento de Almacén</a></b><br/>", ObjFactura.Inv_CveMovimiento)
End If
If TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
MensajeAlert.AppendFormat("<br/><br/><b> Se generó una Nota de crédito Folio: {0} amortizando el anticipo </b><br/>", ObjFacturaDevolucion.Folio)
End If
If RBLPago.SelectedValue.ToEntero() = 2 And TxtCambio.Text.ToDecimal > 0 Then
MensajeAlert.AppendFormat("<br/><br/>Su cambio es de <b>${0}</b><br/>", TxtCambio.Text.ToDecimal.FormatoNumero(2))
End If
If CveVentaNCProntoPago > 0 Then
MensajeAlert.AppendFormat(String.Format("<br/>La nota de crédito <b>{0}</b> por descuento pronto pago se generó correctamente.<br/><br/>", SerieFolioNCProntoPago))
End If
If MsgCancelacionRefacturacion IsNot Nothing Then
If Not MsgCancelacionRefacturacion.HuboError Then
If MsgCancelacionRefacturacion.CveEstatus = 5 Then
MensajeAlert.AppendFormat("<br/>El folio <b>{0}</b> fue cancelado. <b><a target='_blank' class='Texto' href=""/Compras/PopUpVerFactura.aspx?P={1}"">Descargar Acuse</a></b>", Me.ObjFacturaNC.SerieFolio, Encripta(String.Format("OP=CAN&CVEVTA={0}", Me.ObjFacturaNC.CveVenta)))
ElseIf MsgCancelacionRefacturacion.CveEstatus = 20 Then
MensajeAlert.AppendFormat("<br/>El folio <b>{0}</b> esta en proceso de cancelación. <b><a target='_blank' class='Texto' href=""/Compras/PopUpVerFactura.aspx?P={1}"">Descargar Acuse</a></b>", Me.ObjFacturaNC.SerieFolio, Encripta(String.Format("OP=CAN&CVEVTA={0}", Me.ObjFacturaNC.CveVenta)))
End If
MensajeAlert.AppendFormat("&nbsp;<a target='_self' class='Texto' href=""javascript:BtnEnviarMailCancelacion({0});"">Enviar Acuse</a>.<br/><br/>", Me.ObjFacturaNC.CveVenta)
End If
End If
'MUESTA ALERT OK
' si es elrol 1165-Ventas,EMp:80, o la empresa 119, recarga ventas, para seguir registrando-.
'Dim Liga = If(UsuarioActual.CveRol = 1165 Or UsuarioActual.CveEmpresa = 119, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", If(CveEmpresaCRM > 0, $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";", $"document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";"))
'Alert(MensajeAlert.ToString(), TipoMensaje.MsgInformacion, Liga)
Dim Liga As String = ""
Dim Liga2 As String = ""
If Request("CveCliente") IsNot Nothing AndAlso Request("CveCliente").ToEntero > 0 Then
Liga = $"document.location.href=""/Ventas/Ventas.aspx?CveCliente={Request("CveCliente")}"";"
Else Else
Dim MontoMaximo As Double = ObjContr.DtResultados.Rows(0)("ImporteMax").ToString().ToDouble Liga = "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";"
Dim Avance As Double = ObjContr.DtResultados.Rows(0)("Avance").ToString().ToDouble
Dim PorcentajeAvance As Double = (Avance / MontoMaximo) * 100
If PorcentajeAvance >= 100 And MontoMaximo > 0 Then
EnviarNotificacionAvance(ObjContr.DtResultados.Rows(0)("NumeroContrato").ToString(), ObjContr.DtResultados.Rows(0)("DescripcionContrato").ToString(), ObjContr.DtResultados.Rows(0)("ContratoTipo").ToString(), ObjContr.DtResultados.Rows(0)("NombreComercial").ToString(), ObjContr.DtResultados.Rows(0)("CorreoVendedor").ToString(), MontoMaximo)
End If
End If End If
End If If CveEmpresaCRM > 0 Then
End If Liga2 = $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";"
End If Else
Liga2 = $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}"";"
End If
'MENSAJE PRINCIPAL Alert(MensajeAlert.ToString(), TipoMensaje.MsgDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2, ShowCloseButton:=False)
MensajeAlert.AppendFormat(String.Format("<br/>La {0}: <b>{1}</b> se generó correctamente.<br/><br/>", ObjFactura.TipoDocumento, ObjFactura.SerieFolio))
MensajeAlert.Clear()
' DESCARGA XML - SI SE TIMBRA MANDA CORREO CON FACTURA 'LIMPIA CONDICIONES DE PAGO - CONTADO
If SeTimbro Then RBLPago.SelectedValue = "1"
Dim ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio) LimpiaEscondeContado()
If File.Exists(ArchivoXML) Then BtnEmitirImprimir.Visible = False
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto))) ObjFactura = Nothing
End If
GeneraPDFFactura(ChkEnviarFactura.Checked) 'MANDA CORREO
End If
'DESCARGA PDF
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant", "Egs", "Dev", "Pd2") Then
'If Not ImprimeAlert Then
Dim ArchivoIngPyMe As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.mrt", UsuarioActual.Empresa.Ruta))
Dim ArchivoIng As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.rdlc", UsuarioActual.Empresa.Ruta))
Dim ArchivoRem As New System.IO.FileInfo(String.Format("{0}Formatos/Remision.rdlc", UsuarioActual.Empresa.Ruta))
Dim ArchivoEgs As New System.IO.FileInfo(String.Format("{0}Formatos/NotaCredito.rdlc", UsuarioActual.Empresa.Ruta))
If ArchivoIng.Exists Or ArchivoRem.Exists Or ArchivoIngPyMe.Exists Or ArchivoEgs.Exists Then
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta)))
Else
MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ")
End If
End If
'ERROR DE NO TIMBRADO
If Not SeTimbro And (DdlTipoComprobante.SelectedValue = "Ing" Or DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Or DdlTipoComprobante.SelectedValue = "Ant") Then
MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir.")
End If
'ERROR DE NO TIMBRADO NC
If Not IsNothing(ObjNC) AndAlso ObjNC.Count > 0 AndAlso Not SeTimbroNC Then
MensajeAlert.AppendFormat("<br/>La NC <b>#{0}</b> no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir.", CType(ObjNC(0), Modelos.Factura).SerieFolio)
End If
'NOTIFICACION DE SMS
Select Case EstatusSMS
Case 1
MensajeAlert.AppendFormat("<br/><b>Notificación SMS:</b> enviado con éxito al cliente al celular: <b>{0}</b>", ObjFactura.Cliente.CobranzaTelefono)
Case 2
MensajeAlert.AppendFormat("<br/><b>Notificación SMS:</b> sin enviar. Ocurrió un error en el envío, por favor verifique la información del cliente.")
Case 3
MensajeAlert.AppendFormat("<br/><b>Notificación SMS:</b> sin enviar. No se pudo cargar el celular del cliente, por favor verifique la información del cliente.")
End Select
'AUTO DESCARGAR PDF
If UsuarioActual.CveEmpresa.Contiene(72, 1) Then
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then
RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta))}'", "Imprimir")
End If
End If
'DESCARGAR PDF DE CICOVISA
'If UsuarioActual.CveEmpresa = 72 And CveCliente = 70381 Then
' If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") Then
' MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar Formato CICOVISA</a></li></ul><br/>", Encripta(String.Format("OP=CIC&CVEVENTA={0}", CveVenta)))
' End If
'End If
If DdlTipoComprobante.SelectedValue = "Cot" Then
If Not CveEmpresaCRM > 0 Then
If CveVenta > 0 Then MensajeAlert = New StringBuilder
Dim ArchivoCotizacion As New System.IO.FileInfo(String.Format("{0}Formatos/Cotizacion.rdlc", UsuarioActual.Empresa.Ruta))
If Opcion = "Cot" And UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
MensajeAlert.AppendFormat("<b><a class='Texto' href=""Ventas.aspx?CveVenta={0}"">Facturar</a></b><br/><br/>", CveVenta)
End If
If ArchivoCotizacion.Exists Then
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=0", CveVenta)))
Else Else
MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ") ObjVentas.RollBack()
End If
GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO
End If
ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then
If UsuarioActual.CveEmpresa.Contiene(81, 109) Then
EnviaPDFRemision(ChkEnviarFactura.Checked)
End If
End If
'ENVIA CORREO CON DETALLE DEL CONTRATO
If DdlTipoComprobante.SelectedValue.Contiene("DPe", "Ped") Then
If Not String.IsNullOrEmpty(CorreoNotificacionPedDev) Then
EnviarCorreoDevPed()
End If
End If
'MOVIMIENTO DE ALMACEN
If ObjFactura.Inv_CveMovimiento > 0 Then
MensajeAlert.AppendFormat("<br/><br/><b><a target='_blank' class='Texto' href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"">Movimiento de Almacén</a></b><br/>", ObjFactura.Inv_CveMovimiento)
End If
If TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
MensajeAlert.AppendFormat("<br/><br/><b> Se generó una Nota de crédito Folio: {0} amortizando el anticipo </b><br/>", ObjFacturaDevolucion.Folio)
End If
If RBLPago.SelectedValue.ToEntero() = 2 And TxtCambio.Text.ToDecimal > 0 Then
MensajeAlert.AppendFormat("<br/><br/>Su cambio es de <b>${0}</b><br/>", TxtCambio.Text.ToDecimal.FormatoNumero(2))
End If
If CveVentaNCProntoPago > 0 Then
MensajeAlert.AppendFormat(String.Format("<br/>La nota de crédito <b>{0}</b> por descuento pronto pago se generó correctamente.<br/><br/>", SerieFolioNCProntoPago))
End If
If MsgCancelacionRefacturacion IsNot Nothing Then
If Not MsgCancelacionRefacturacion.HuboError Then
If MsgCancelacionRefacturacion.CveEstatus = 5 Then
MensajeAlert.AppendFormat("<br/>El folio <b>{0}</b> fue cancelado. <b><a target='_blank' class='Texto' href=""/Compras/PopUpVerFactura.aspx?P={1}"">Descargar Acuse</a></b>", Me.ObjFacturaNC.SerieFolio, Encripta(String.Format("OP=CAN&CVEVTA={0}", Me.ObjFacturaNC.CveVenta)))
ElseIf MsgCancelacionRefacturacion.CveEstatus = 20 Then
MensajeAlert.AppendFormat("<br/>El folio <b>{0}</b> esta en proceso de cancelación. <b><a target='_blank' class='Texto' href=""/Compras/PopUpVerFactura.aspx?P={1}"">Descargar Acuse</a></b>", Me.ObjFacturaNC.SerieFolio, Encripta(String.Format("OP=CAN&CVEVTA={0}", Me.ObjFacturaNC.CveVenta)))
End If
MensajeAlert.AppendFormat("&nbsp;<a target='_self' class='Texto' href=""javascript:BtnEnviarMailCancelacion({0});"">Enviar Acuse</a>.<br/><br/>", Me.ObjFacturaNC.CveVenta)
End If
End If
'MUESTA ALERT OK
' si es elrol 1165-Ventas,EMp:80, o la empresa 119, recarga ventas, para seguir registrando-.
'Dim Liga = If(UsuarioActual.CveRol = 1165 Or UsuarioActual.CveEmpresa = 119, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", If(CveEmpresaCRM > 0, $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";", $"document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";"))
'Alert(MensajeAlert.ToString(), TipoMensaje.MsgInformacion, Liga)
Dim Liga As String = ""
Dim Liga2 As String = ""
If Request("CveCliente") IsNot Nothing AndAlso Request("CveCliente").ToEntero > 0 Then
Liga = $"document.location.href=""/Ventas/Ventas.aspx?CveCliente={Request("CveCliente")}"";"
Else
Liga = "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";"
End If
If CveEmpresaCRM > 0 Then
Liga2 = $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";"
Else
Liga2 = $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}"";"
End If
Alert(MensajeAlert.ToString(), TipoMensaje.MsgDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2, ShowCloseButton:=False)
MensajeAlert.Clear()
'LIMPIA CONDICIONES DE PAGO - CONTADO
RBLPago.SelectedValue = "1"
LimpiaEscondeContado()
BtnEmitirImprimir.Visible = False
ObjFactura = Nothing
Else
ObjVentas.RollBack()
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack() If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
For Each ErrorItem In ErrorList For Each ErrorItem In ErrorList