This commit is contained in:
rakcsle
2022-01-19 01:31:30 -07:00
29 changed files with 13784 additions and 12773 deletions

View File

@@ -724,11 +724,11 @@ Public Class ClsCRM
.Add("@CveUsuarioIng", SqlDbType.Int).Value = CveUsuarioIng .Add("@CveUsuarioIng", SqlDbType.Int).Value = CveUsuarioIng
.Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue .Add("@CveAcercamiento", SqlDbType.Int).Direction = ParameterDirection.ReturnValue
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)
_CveAcercamiento = SqlAdapter.SelectCommand.Parameters("@RETURN_VALUE").Value.ToString().ToEntero() _CveAcercamiento = SqlAdapter.SelectCommand.Parameters("@CveAcercamiento").Value.ToString().ToEntero()
Catch ex As Exception Catch ex As Exception
OnError("Ocurrió un error al agregar el Acercamiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) OnError("Ocurrió un error al agregar el Acercamiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try End Try
@@ -1096,7 +1096,7 @@ Public Class ClsCRM
#End Region #End Region
#Region "Asignar Vendedor a Prospectos" #Region "Asignar Vendedor a Prospectos"
Public Function GetProspectosPorAsignarVendedor(CveEmpresa As Integer, Optional Empresa As String = "-1", Optional CveSubProyecto As Integer = -1, Optional CveGiro As Integer = -1) As Boolean Public Function GetProspectosPorAsignarVendedor(CveEmpresa As Integer, Optional Empresa As String = "-1", Optional CveSubProyecto As Integer = -1, Optional CveGiro As Integer = -1, Optional TipoAsignacion As Integer = 0) As Boolean
Dim retorno As Boolean = False Dim retorno As Boolean = False
DataAdapter("PA_CRM_GetProspectosPorAsignarVendedor", CommandType.StoredProcedure) DataAdapter("PA_CRM_GetProspectosPorAsignarVendedor", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
@@ -1104,6 +1104,7 @@ Public Class ClsCRM
.Add("@Empresa", SqlDbType.NVarChar).Value = Empresa .Add("@Empresa", SqlDbType.NVarChar).Value = Empresa
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveGiro", SqlDbType.Int).Value = CveGiro .Add("@CveGiro", SqlDbType.Int).Value = CveGiro
.Add("@TipoAsignacion", SqlDbType.Int).Value = TipoAsignacion
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)

View File

@@ -1972,8 +1972,10 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo
Alert("El nuevo personal no se guardo debido a que actualmente se encuentra registrado", TipoMensaje.MsgAdvertencia) Alert("El nuevo personal no se guardo debido a que actualmente se encuentra registrado", TipoMensaje.MsgAdvertencia)
ElseIf Ex1.Message.Contains("Chk_RH_PersonalSalarioIMSS") Then ElseIf Ex1.Message.Contains("Chk_RH_PersonalSalarioIMSS") Then
Alert("El nuevo personal no se guardo debido a que se presento un problema al calcular el salario", TipoMensaje.MsgAdvertencia) Alert("El nuevo personal no se guardo debido a que se presento un problema al calcular el salario", TipoMensaje.MsgAdvertencia)
GuardaLog(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", "Ocurrió un error al guardar el nuevo personal.", Ex1.ToString, vbCrLf, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()))
ElseIf Ex1.Message.Contains("dbo.Vw_Val_Nom_Curps") Then ElseIf Ex1.Message.Contains("dbo.Vw_Val_Nom_Curps") Then
Alert(String.Format("El nuevo personal no se guardo, ya existe un personal con esta curp '{0}'", CURP), TipoMensaje.MsgAdvertencia) Alert(String.Format("El nuevo personal no se guardo, ya existe un personal con esta curp '{0}'", CURP), TipoMensaje.MsgAdvertencia)
GuardaLog(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", "Ocurrió un error al guardar el nuevo personal.", Ex1.ToString, vbCrLf, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()))
Else Else
Me.OnError("Ocurrió un error al guardar el nuevo personal.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) Me.OnError("Ocurrió un error al guardar el nuevo personal.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End If End If

View File

@@ -724,7 +724,7 @@ Public Class ClsVentas
Public Function UpdateEstatusFactura(Estatus As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveVenta As Integer, Public Function UpdateEstatusFactura(Estatus As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveVenta As Integer,
Optional IdPolizaCancelacion As Integer = -1, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0, Optional IdPolizaCancelacion As Integer = -1, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0,
Optional CveUsuarioCambiaEstatus As Integer = -1, Optional FechaCambioEstatus As String = "-1", Optional RFCReceptor As String = "-1", Optional CveUsuarioCambiaEstatus As Integer = -1, Optional FechaCambioEstatus As String = "-1", Optional RFCReceptor As String = "-1",
Optional CveMotivoCancelacion As Integer = -1, Optional MotivoCancelacion As String = "") As Boolean Optional CveMotivoCancelacion As Integer = -1, Optional MotivoCancelacion As String = "", Optional EstadoCancelacion As String = "") As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_VentasUpdateEstatus") DataAdapter("PA_VentasUpdateEstatus")
@@ -743,6 +743,7 @@ Public Class ClsVentas
.Add("@RFCReceptor", SqlDbType.VarChar).Value = RFCReceptor .Add("@RFCReceptor", SqlDbType.VarChar).Value = RFCReceptor
.Add("@CveMotivoCancelacion", SqlDbType.Int).Value = CveMotivoCancelacion .Add("@CveMotivoCancelacion", SqlDbType.Int).Value = CveMotivoCancelacion
.Add("@MotivoCancelacion", SqlDbType.VarChar).Value = MotivoCancelacion .Add("@MotivoCancelacion", SqlDbType.VarChar).Value = MotivoCancelacion
.Add("@EstadoCancelacion", SqlDbType.VarChar).Value = EstadoCancelacion
End With End With
Try Try
@@ -833,7 +834,7 @@ Public Class ClsVentas
Return Retorno Return Retorno
End Function End Function
Public Function UpdateCancelaVenta(CveVenta As Integer, FechaCancelacion As DateTime, SelloCancelacionSAT As String, CveEmpresa As Integer, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0) As Boolean Public Function UpdateCancelaVenta(CveVenta As Integer, FechaCancelacion As DateTime, SelloCancelacionSAT As String, CveEmpresa As Integer, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0, Optional EstadoCancelacion As String = "") As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasCancelacion") DataAdapter("PA_Vta_VentasCancelacion")
@@ -845,6 +846,7 @@ Public Class ClsVentas
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CvePAC", SqlDbType.SmallInt).Value = CvePAC .Add("@CvePAC", SqlDbType.SmallInt).Value = CvePAC
.Add("@CveEstatusRefacturacion", SqlDbType.TinyInt).Value = CveEstatusRefacturacion .Add("@CveEstatusRefacturacion", SqlDbType.TinyInt).Value = CveEstatusRefacturacion
.Add("@EstadoCancelacion", SqlDbType.VarChar).Value = EstadoCancelacion
.Add("@Cancelada", SqlDbType.SmallInt).Direction = ParameterDirection.Output .Add("@Cancelada", SqlDbType.SmallInt).Direction = ParameterDirection.Output
End With End With

View File

@@ -4763,6 +4763,7 @@ Namespace Modelos
Dim CancelacionFecha As Date Dim CancelacionFecha As Date
Dim FolioFiscal As String = ObjFactura.FolioFiscal Dim FolioFiscal As String = ObjFactura.FolioFiscal
Dim CancelacionAcuse As String = "" Dim CancelacionAcuse As String = ""
Dim EstadoCancelacion As String = ""
Dim MensajeError As String = "" Dim MensajeError As String = ""
Dim ObjCancelacion As New Timbrado Dim ObjCancelacion As New Timbrado
Dim TotalT As Decimal = ObjFactura.Total Dim TotalT As Decimal = ObjFactura.Total
@@ -4810,6 +4811,9 @@ Namespace Modelos
Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), UsuarioActual.Empresa.FacturaProduccion) Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), UsuarioActual.Empresa.FacturaProduccion)
If Vigencia IsNot Nothing Then If Vigencia IsNot Nothing Then
EstadoCancelacion = Vigencia.EsCancelable
If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
Retorno.Mensaje = "Esta factura no es cancelable." Retorno.Mensaje = "Esta factura no es cancelable."
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
@@ -5508,13 +5512,13 @@ Namespace Modelos
If CveEstatus.Contiene(4, 5) Then If CveEstatus.Contiene(4, 5) Then
If Not ObjVentas.UpdateCancelaVenta(CveVenta, CancelacionFecha, CancelacionAcuse, UsuarioActual.CveEmpresa, CvePACCancelacion, CveEstatusRefacturacion) Then If Not ObjVentas.UpdateCancelaVenta(CveVenta, CancelacionFecha, CancelacionAcuse, UsuarioActual.CveEmpresa, CvePACCancelacion, CveEstatusRefacturacion, EstadoCancelacion:=EstadoCancelacion) Then
ErrorCancelar = True ErrorCancelar = True
MensajeError = "Ocurrió un error al guardar el estatus de cancelación." MensajeError = "Ocurrió un error al guardar el estatus de cancelación."
End If End If
Else Else
If Not ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, CancelacionAcuse, CancelacionFecha, CveVenta, IDPoliza, CvePAC:=CvePACCancelacion, CveEstatusRefacturacion:=CveEstatusRefacturacion, If Not ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, CancelacionAcuse, CancelacionFecha, CveVenta, IDPoliza, CvePAC:=CvePACCancelacion, CveEstatusRefacturacion:=CveEstatusRefacturacion,
CveUsuarioCambiaEstatus:=UsuarioActual.CveUsuario, FechaCambioEstatus:=Now.ToString("yyyy-MM-dd HH:mm:ss.mmm"), CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=MotivoCancelacion) Then CveUsuarioCambiaEstatus:=UsuarioActual.CveUsuario, FechaCambioEstatus:=Now.ToString("yyyy-MM-dd HH:mm:ss.mmm"), CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=MotivoCancelacion, EstadoCancelacion:=EstadoCancelacion) Then
ErrorCancelar = True ErrorCancelar = True
MensajeError = "Ocurrió un error al guardar el estatus de cancelación." MensajeError = "Ocurrió un error al guardar el estatus de cancelación."
End If End If

View File

@@ -488,7 +488,8 @@ Public Class Timbrado
Dim UrlServicio As String = "" ' Produccion Dim UrlServicio As String = "" ' Produccion
'UrlServicio = "http://juancalderon-001-site1.ftempurl.com/timbrado.asmx?WSDL" 'UrlServicio = "http://juancalderon-001-site1.ftempurl.com/timbrado.asmx?WSDL"
UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno 'UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno
UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL"
If Not Empresa.FacturaProduccion Then If Not Empresa.FacturaProduccion Then
ArchivoLLave = $"{Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.key" ArchivoLLave = $"{Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.key"
@@ -1905,7 +1906,8 @@ Public Class Timbrado
UrlServicio = "http://generacfdi.com.mx/rvltimbrado/service1.asmx?WSDL" 'productivo UrlServicio = "http://generacfdi.com.mx/rvltimbrado/service1.asmx?WSDL" 'productivo
Case 4 Case 4
'UrlServicio = "http://juancalderon-001-site1.ftempurl.com/timbrado.asmx?WSDL" 'UrlServicio = "http://juancalderon-001-site1.ftempurl.com/timbrado.asmx?WSDL"
UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno 'UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno
UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL"
End Select End Select
If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 Then If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 Then

View File

@@ -174,6 +174,16 @@ Public Class Timbres
CartaPorte.FiguraTransporte.AutoTransporte.Vehiculo.PlacaVM = drT("Placa").ToString CartaPorte.FiguraTransporte.AutoTransporte.Vehiculo.PlacaVM = drT("Placa").ToString
CartaPorte.FiguraTransporte.AutoTransporte.Vehiculo.AnioModeloVM = drT("Anio").ToString.ToEntero CartaPorte.FiguraTransporte.AutoTransporte.Vehiculo.AnioModeloVM = drT("Anio").ToString.ToEntero
If drT("ClaveTipoRemolque1").ToString <> "" Then
Dim Rem1 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque1"), .Placa = drT("PlacaRemolque1")}
CartaPorte.FiguraTransporte.AutoTransporte.Remolques.Add(Rem1)
End If
If drT("ClaveTipoRemolque2").ToString <> "" Then
Dim Rem2 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque2"), .Placa = drT("PlacaRemolque2")}
CartaPorte.FiguraTransporte.AutoTransporte.Remolques.Add(Rem2)
End If
If drT("ClaveTipoRemolque1").ToString <> "" Then If drT("ClaveTipoRemolque1").ToString <> "" Then
Dim Rem1 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque1"), .Placa = drT("PlacaRemolque1")} Dim Rem1 As New CFDICartaPorteRemolque With {.SubTipoRemolque = drT("ClaveTipoRemolque1"), .Placa = drT("PlacaRemolque1")}

View File

@@ -667,9 +667,9 @@ Partial Class Bancos_ConciliacionesBancariasaspx
params.Add(New ReportParameter("LogoPath", "")) params.Add(New ReportParameter("LogoPath", ""))
End If End If
Dim Archivo As String = $"Empresas/{UsuarioActual.CveEmpresa}/Formatos/Conciliacion.rdlc" Dim Archivo As String = $"{UsuarioActual.Empresa.Ruta}Formatos/Conciliacion.rdlc"
If Not IO.File.Exists($"{Server.MapPath("~")}/{Archivo}") Then If Not IO.File.Exists(Archivo) Then
Archivo = "Empresas/Grales/Formatos/Conciliacion.rdlc" Archivo = "Empresas/Grales/Formatos/Conciliacion.rdlc"
End If End If

View File

@@ -389,6 +389,11 @@ public partial class CRM_Acercamiento : ClsPaginas
DdlEtapaProceso.SelectedValueExist(CveEtapaActual); DdlEtapaProceso.SelectedValueExist(CveEtapaActual);
DesactivaEdicion(); DesactivaEdicion();
if (UsuarioActual.TienePermisoProceso(336)) //permiso para editar vendedor
{
DdlVendedor.Enabled = true;
}
if (CveEtapaActual > 0) if (CveEtapaActual > 0)
{ {
//CARGAMOS BITACORA //CARGAMOS BITACORA
@@ -732,6 +737,7 @@ public partial class CRM_Acercamiento : ClsPaginas
Double Comision = TxtComision.Text.ToDouble(); Double Comision = TxtComision.Text.ToDouble();
int Prioridad = DdlPrioridad.SelectedValue.ToEntero(); int Prioridad = DdlPrioridad.SelectedValue.ToEntero();
int CveRechazoMotivo = DdlRechazoMotivo.SelectedValue.ToEntero();
int CveUsuarioIng = UsuarioActual.CveUsuario; int CveUsuarioIng = UsuarioActual.CveUsuario;
@@ -750,14 +756,19 @@ public partial class CRM_Acercamiento : ClsPaginas
AcercaminetoModel.CveUsuarioIng = UsuarioActual.CveUsuario; AcercaminetoModel.CveUsuarioIng = UsuarioActual.CveUsuario;
AcercaminetoModel.CveEncuestaAplicadaProceso = CveEncuestaAplicadaProceso; AcercaminetoModel.CveEncuestaAplicadaProceso = CveEncuestaAplicadaProceso;
AcercaminetoModel.FechaApertura = FechaApertura; AcercaminetoModel.FechaApertura = FechaApertura;
AcercaminetoModel.FechaCierre = (DateTime)FechaCierre; AcercaminetoModel.FechaCierre = FechaCierre != null? (DateTime)FechaCierre : ModExtensiones.MinFecha;
AcercaminetoModel.CvePS = DdlPS.SelectedValue.ToEntero(); AcercaminetoModel.CvePS = DdlPS.SelectedValue.ToEntero();
AcercaminetoModel.CveRechazoMotivo = CveRechazoMotivo;
if (cRMService.AcercamientoUpdate(AcercaminetoModel)) if (cRMService.AcercamientoUpdate(AcercaminetoModel))
{ {
CveEtapaActual = CveEtapaProcesoActualActualizar; CveEtapaActual = CveEtapaProcesoActualActualizar;
HdfEtapaSeleccionada.Value = CveEtapaProcesoActualActualizar.ToString(); HdfEtapaSeleccionada.Value = CveEtapaProcesoActualActualizar.ToString();
} }
else
{
Alert("No se actualizó el acercamiento.", ModExtensiones.TipoMensaje.ToastError);
}
//CARGA BITACORA //CARGA BITACORA
@@ -865,6 +876,11 @@ public partial class CRM_Acercamiento : ClsPaginas
this.RegistraScript("$('#ModalCierreMotivoRechazo').modal();"); this.RegistraScript("$('#ModalCierreMotivoRechazo').modal();");
UpCierreMotivoRechazo.Update(); UpCierreMotivoRechazo.Update();
} }
protected void EliminarFile(object sender, EventArgs e)
{
}
protected void BtnRegistrarCierreCancelacion_Click(object sender, EventArgs e) protected void BtnRegistrarCierreCancelacion_Click(object sender, EventArgs e)
{ {

View File

@@ -36,6 +36,14 @@
<div class="col-md-2"> <div class="col-md-2">
<asp:DropDownList ID="DdlGiroClasificacion" Width="100%" runat="server" DataValueField="CveClienteClasificacion" DataTextField="ClienteClasificacion" AppendDataBoundItems="true" CssClass="form-control input-sm select2me"></asp:DropDownList> <asp:DropDownList ID="DdlGiroClasificacion" Width="100%" runat="server" DataValueField="CveClienteClasificacion" DataTextField="ClienteClasificacion" AppendDataBoundItems="true" CssClass="form-control input-sm select2me"></asp:DropDownList>
</div> </div>
<label class="col-md-1 " style="width: 90px; margin-top: 5px;">Asignación a vendedor:</label>
<div class="col-md-2">
<asp:DropDownList ID="DdlAsignacion" Width="100%" runat="server" AppendDataBoundItems="true" CssClass="form-control input-sm select2me">
<asp:ListItem Value="-1" Text="Todos" Selected="True"></asp:ListItem>
<asp:ListItem Value="0" Text="Por asignar"></asp:ListItem>
<asp:ListItem Value="1" Text="Asignados"></asp:ListItem>
</asp:DropDownList>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -24,7 +24,7 @@ public partial class CRM_AsignarVendedorEnProspectos : ClsPaginas
{ {
string Empresa = (TxtNombre.Text == "" ? "-1" : TxtNombre.Text); string Empresa = (TxtNombre.Text == "" ? "-1" : TxtNombre.Text);
ClsCRM ObjCRM = new ClsCRM(); ClsCRM ObjCRM = new ClsCRM();
if (ObjCRM.GetProspectosPorAsignarVendedor(UsuarioActual.CveEmpresa, Empresa, DdlSubProyecto.SelectedValue.ToEntero(),DdlGiroClasificacion.SelectedValue.ToEntero())) if (ObjCRM.GetProspectosPorAsignarVendedor(UsuarioActual.CveEmpresa, Empresa, DdlSubProyecto.SelectedValue.ToEntero(),DdlGiroClasificacion.SelectedValue.ToEntero(), DdlAsignacion.SelectedValue.ToEntero()))
{ {
GvProspectos.DataSource = ObjCRM.DtResultados; GvProspectos.DataSource = ObjCRM.DtResultados;
} }

View File

@@ -1535,7 +1535,16 @@ public partial class CRM_EmpresaCRM : ClsPaginas
DdlVendedor.SelectedValueExist(CveVendedor); DdlVendedor.SelectedValueExist(CveVendedor);
if (CveVendedor > 0) if (CveVendedor > 0)
{
DdlVendedor.Enabled = false; DdlVendedor.Enabled = false;
DdlVendedorAsignado.Enabled = false;
}
if (UsuarioActual.TienePermisoProceso(336)) //permiso para editar vendedor
{
DdlVendedorAsignado.Enabled = true;
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -207,7 +207,7 @@
<asp:BoundField HeaderText="Docto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField HeaderText="Docto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="RFC" DataField="RFC" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField HeaderText="RFC" DataField="RFC" ItemStyle-HorizontalAlign="Center" />
<asp:HyperLinkField HeaderText="Proveedor" DataNavigateUrlFields="CveProveedor" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataTextField="RazonSocial" ControlStyle-CssClass="truncate2" /> <asp:HyperLinkField HeaderText="Proveedor" DataNavigateUrlFields="CveProveedor" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataTextField="RazonSocial" ControlStyle-CssClass="truncate2" />
<asp:BoundField HeaderText="Fecha Documento" DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField HeaderText="F.Compra" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Right" />
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveCompra" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" HeaderText="Folio" /> <asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveCompra" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" HeaderText="Folio" />
<asp:BoundField HeaderText="SubTotal 16%" DataField="valorActos1516" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="SubTotal 16%" DataField="valorActos1516" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="SubTotal 8%" DataField="valorActosImp8" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="SubTotal 8%" DataField="valorActosImp8" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
@@ -235,7 +235,7 @@
<asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="T.C.P." DataField="TipoCambioPago" DataFormatString="{0:##.####}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="T.C.P." DataField="TipoCambioPago" DataFormatString="{0:##.####}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Total ME." DataField="TotalME" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Total ME." DataField="TotalME" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="F.Compra" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Fecha Documento" DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Folio Fiscal" DataField="FolioFiscal" /> <asp:BoundField HeaderText="Folio Fiscal" DataField="FolioFiscal" />
<%-- <asp:BoundField HeaderText="IEPS 3%" DataField="IEPS3" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <%-- <asp:BoundField HeaderText="IEPS 3%" DataField="IEPS3" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2291,7 +2291,10 @@ Partial Class General_SaldosIniciales
If CvePersonal > 0 Then If CvePersonal > 0 Then
Contador = Contador + 1 Contador = Contador + 1
Else Else
If Not ObjRH.AddPersonal(Codigo, ApellidoPaterno, ApellidoMaterno, Nombre, CorreoElectronico, FechaIn, CveTipoPeriodo, NumeroSS, CBool(AltaIMSS), SalarioDiario.ToDouble, SalarioDiario.ToDouble, SDI.ToDouble, SalarioDiario.ToDouble, If SalarioDiario.ToDouble > SDI.ToDouble Then
SDI = SalarioDiario
End If
If Not ObjRH.AddPersonal(Codigo, ApellidoPaterno, ApellidoMaterno, Nombre, CorreoElectronico, FechaIn, CveTipoPeriodo, NumeroSS, CBool(AltaIMSS), SalarioDiario.ToDouble, SalarioDiario.ToDouble, SDI.ToDouble, SDI.ToDouble,
-1, -1, -1, CveMetodoPago, FechaIn, FechaFn.ToString, CveTipoContrato, Direccion, CveTurno, CvePuesto, CveDepartamento, -1, CveEscolaridad, CveEstadoCivil, CveGenero, -1, FechaBaja, CveEstatusPersonal, FechaNac, -1, -1, -1, CveMetodoPago, FechaIn, FechaFn.ToString, CveTipoContrato, Direccion, CveTurno, CvePuesto, CveDepartamento, -1, CveEscolaridad, CveEstadoCivil, CveGenero, -1, FechaBaja, CveEstatusPersonal, FechaNac,
LugarNacimiento, Direccion, "", "", "", CodigoPostal, Ciudad, CveEstado, Telefono, Celular, RFC, CURP, NombrePadre, NombreMadre, -1, CveSATRiesgoPuesto, CveSATRegimenContratacion, -1, -1, "", -1, LugarNacimiento, Direccion, "", "", "", CodigoPostal, Ciudad, CveEstado, Telefono, Celular, RFC, CURP, NombrePadre, NombreMadre, -1, CveSATRiesgoPuesto, CveSATRegimenContratacion, -1, -1, "", -1,
ClabeInterbancaria, "", CveJornada, CveJornada, "", -1, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveUsuarioNomina) Then ClabeInterbancaria, "", CveJornada, CveJornada, "", -1, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveUsuarioNomina) Then

View File

@@ -14,6 +14,9 @@
<li> <li>
<a target="_blank" class="ayuda" href="../Documentacion/DocumentacionInventarios.aspx#RecepcionAlmacen">&nbsp;</a> <a target="_blank" class="ayuda" href="../Documentacion/DocumentacionInventarios.aspx#RecepcionAlmacen">&nbsp;</a>
</li> </li>
<li>
<asp:HyperLink ID="HlAgregarExcel" NavigateUrl="#" Visible="true" data-toggle="modal" data-target="#DivCargaExcel" runat="server"><i class='fa fa-server'></i> Cargar Excel</asp:HyperLink>
</li>
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
Recepción Almacén Recepción Almacén
@@ -1087,6 +1090,74 @@
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
<div id="DivCargaExcel" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<asp:UpdatePanel ID="UpConcepto" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Cargar Conceptos</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="portlet light xspadding bordered whitoutcol" style="width: 100%;">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Cargar Plantilla </span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body formnombottom">
<%-- <div class="row">
<div class="col-md-12" align="center">
<h4>Arraste o haga click para subir el archivo Excel</h4>
</div>
</div>--%>
<div class="row">
<div class="col-md-11" style="margin-left: 30px; margin-right: 30px; margin-bottom: 20px;">
<asp:TextBox ID="TxtExcel" CssClass="ADSdropzone hidden" Text="" data-maxFile="1" runat="server"></asp:TextBox>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<div class="row">
<div class="col-md-2" style="text-align: left">
<asp:LinkButton ID="LbDescargarExcelConceptos" runat="server" CssClass="btn btn-warning" Text="Descargar Plantilla" />
</div>
<div class="col-md-10" style="text-align: center">
<asp:Button ID="BtnCargaExcel" runat="server" CssClass="btn btn-success" Text="Procesar"></asp:Button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</div>
</div>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LbDescargarExcelConceptos" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</asp:Content> </asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">

View File

@@ -5,13 +5,12 @@ Imports Microsoft.Reporting.WebForms
Imports System.Data Imports System.Data
Imports Extensiones Imports Extensiones
Imports System.IO Imports System.IO
Imports GemBox.Spreadsheet
Partial Class Inventarios_RecepcionAlmacen Partial Class Inventarios_RecepcionAlmacen
Inherits ClsPaginas Inherits ClsPaginas
#Region "PROPIEDADES" #Region "PROPIEDADES"
Private Shared missing As Object = System.Reflection.Missing.Value
Private Property EstatusInicial As String Private Property EstatusInicial As String
Get Get
EstatusInicial = ViewState("EstatusInicial").ToString EstatusInicial = ViewState("EstatusInicial").ToString
@@ -44,9 +43,6 @@ Partial Class Inventarios_RecepcionAlmacen
Else Else
Return CType(ViewState("DtInv"), DataTable) Return CType(ViewState("DtInv"), DataTable)
End If End If
End Get End Get
Set(value As DataTable) Set(value As DataTable)
ViewState("DtInv") = value ViewState("DtInv") = value
@@ -988,11 +984,15 @@ Partial Class Inventarios_RecepcionAlmacen
RecibidaCompleta = False RecibidaCompleta = False
'' carga desde excel
' HplCargaExcel.Enabled = True
Dim CargaSoloUsados As Boolean = False Dim CargaSoloUsados As Boolean = False
If ObjInventario.RecepcionAlmacenGet(pCveCompra, BuscaEntregaDirecta, -1, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then If ObjInventario.RecepcionAlmacenGet(pCveCompra, BuscaEntregaDirecta, -1, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
Dim DtRecepcion As DataTable = ObjInventario.DtResultados.Copy() Dim DtRecepcion As DataTable = ObjInventario.DtResultados.Copy()
DtInv = DtRecepcion
Dim NumUsados = ObjInventario.DtResultados.COUNT("EsUsado", "EsUsado = True").ToEntero() Dim NumUsados = ObjInventario.DtResultados.COUNT("EsUsado", "EsUsado = True").ToEntero()
Dim NumProductos = ObjInventario.DtResultados.COUNT("EsUsado", "EsUsado = False").ToEntero() Dim NumProductos = ObjInventario.DtResultados.COUNT("EsUsado", "EsUsado = False").ToEntero()
Dim CveSubProyecto As Integer Dim CveSubProyecto As Integer
@@ -4795,6 +4795,147 @@ Partial Class Inventarios_RecepcionAlmacen
#End Region #End Region
#Region "CargaExcel"
Private Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click
If TxtExcel.getfiles().Archivos.Count > 0 Then
Dim file As Archivo = TxtExcel.getfiles().Archivos(0)
Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.path
Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb", "xls"), "EXCEL", "CSV")
CargarArchivoExcel(Directorio, file.filename)
Else
Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError)
End If
End Sub
Protected Sub CargarArchivoExcel(Ruta As String, FileName As String)
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim dt As DataTable = Nothing
Dim ErrorArchivo = False
Try
dt = ReadExcelFile(Ruta + FileName, True)
Catch ex As Exception
ErrorArchivo = True
OnError("Ocurrio un error al leer el archivo <br/>" & ex.Message, ex)
End Try
If Not ErrorArchivo AndAlso dt IsNot Nothing Then
If Not dt.Columns(0).ColumnName = "Cantidad" Then
Alert("El nombre de la primera columna debe ser 'Cantidad'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(1).ColumnName = "Código" Then
Alert("El nombre de la segunda columna debe ser 'Codigo'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(2).ColumnName = "Producto" Then
Alert("El nombre de la tercera columna debe ser 'Producto'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
If Not dt.Columns(3).ColumnName = "Serie" Then
Alert("El nombre de la cuarta columna debe ser 'Serie'. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub
End If
'If Not dt.Columns(4).ColumnName = "Lote" Then
' Alert("El nombre de la cuarta columna debe ser 'Lote'. Favor de corregirlo", TipoMensaje.MsgError)
' Exit Sub
'End If
'If Not dt.Columns(5).ColumnName = "FechaCaducidad" Then
' Alert("El nombre de la cuarta columna debe ser 'Fecha Caducidad'. Favor de corregirlo", TipoMensaje.MsgError)
' Exit Sub
'End If
dt.TableName = "Datos"
Dim ProductosNoCargados As New StringBuilder()
Dim RowsCargados As Integer = 0
Dim RowsNoCargados As Integer = 0
Dim NoPSConSerie As Integer = 0
If CveCompraSurtir > 0 Then
'DtRecepcion
Try
'Dim DtPS As DataTable = GlobalDTPS(UsuarioActual.CveEmpresa)
'If(dt.Columns.Contains("PorcentajeIVA"), Round(Row("PorcentajeIVA").ToString.ToDecimal, 4), 0)
For Each RowExcel As DataRow In dt.Rows
If RowExcel("Código").ToString() <> "" Then
Dim RowPS = DtInv.FiltroPrimero(String.Format("Codigo='{0}'", RowExcel("Código").ToString()))
If RowPS IsNot Nothing AndAlso RowPS("CvePS").ToString().ToEntero() > 0 Then
Dim CveProducto As Integer = RowPS("CvePS").ToString().ToEntero()
Dim CveUnidadMedida As Integer = RowPS("CveUM").ToString().ToEntero()
Dim Cantidad As Double = RowExcel("Cantidad").ToString().ToDecimal()
Dim Serie As String = RowExcel("Serie").ToString()
Dim Lote As String '= RowExcel("Lote").ToString()
Dim FechaCaducidad As Date '= If(RowExcel("FechaCaducidad").ToString = "", MinFecha, RowExcel("FechaCaducidad").ToString.ToDate)
Dim Observaciones As String '= If(dt.Columns.Contains("Observaciones"), RowExcel("Observaciones").ToString, "").ToString
Dim Valido As Boolean = True
If RowPS("AplicaSerie").ToString() = "True" And (String.IsNullOrEmpty(Serie.Trim()) OrElse Serie = "-1") Then
Valido = False
Alert($"El producto '{RowPS("PS")}' requiere 'Serie'", TipoMensaje.MsgAdvertencia)
ProductosNoCargados.AppendFormat("{0},", RowPS("PS").ToString())
End If
If RowPS("AplicaSerie").ToString() = "True" AndAlso Not String.IsNullOrEmpty(Serie.Trim()) Then
NoPSConSerie = NoPSConSerie + 1
End If
If Valido Then
CveConsecSerie = RowPS("Consec").ToString.ToEntero
AgregaSerie(RowExcel("Serie").ToString, 1)
'AgregarPS(Cantidad, CveProducto, CveUnidadMedida, Observaciones, CveSeccionAlmacen:=DdlSeccionAlmacen.SelectedValue.ToEntero, SeccionAlmacen:=DdlSeccionAlmacen.SelectedItem.Text, Serie:=If(Not String.IsNullOrEmpty(Serie), Serie, ""), Lote:=Lote, FechaCaducidad:=FechaCaducidad, Limpia:=False)
RowsCargados = RowsCargados + 1
Else
RowsNoCargados = RowsNoCargados + 1
ProductosNoCargados.AppendFormat("{0},", RowPS("PS").ToString())
End If
Else
RowsNoCargados = RowsNoCargados + 1
ProductosNoCargados.AppendFormat("{0},", RowExcel("Producto").ToString())
End If
End If
Next
Catch ex As Exception
OnError("Ocurrió un error al cargar los productos." & ProductosNoCargados.ToString(), ex)
Finally
Dim MensajeFinal As New StringBuilder()
If RowsNoCargados = 0 AndAlso RowsCargados > 0 Then
MensajeFinal.Append("Los productos se cargaron correctamente. <br/><br/>")
End If
If RowsCargados > 0 Then
MensajeFinal.Append("Se cargaron <b>" & RowsCargados & "</b> productos correctamente.")
End If
If RowsNoCargados > 0 Then
MensajeFinal.Append("No se pudieron cargar <b>" & RowsNoCargados & "</b> productos. <br/>Los siguientes productos no se pudieron cargar: " & ProductosNoCargados.ToString())
End If
Alert(MensajeFinal.ToString())
End Try
Else
Alert("No hay seleccionada compra", TipoMensaje.MsgError)
End If
End If
End Sub
#End Region
'Protected Sub BtnGuardarDocumento_Click(sender As Object, e As EventArgs) 'Protected Sub BtnGuardarDocumento_Click(sender As Object, e As EventArgs)
' Dim Filesgral As List(Of Archivo) = TxtDocumento.getfiles().Archivos ' Dim Filesgral As List(Of Archivo) = TxtDocumento.getfiles().Archivos
@@ -4899,31 +5040,5 @@ Partial Class Inventarios_RecepcionAlmacen
End Class End Class
'Private Function GuardaDocumentoBitacora(ObjEventoBitacora As ClsOIEventos, CveMovimiento As Integer) As Boolean
' Dim Retorno = True
' Dim Archivo As System.IO.FileInfo = Nothing
' For Each Dr As DataRow In DtDocumentos.Rows
' If ObjEventoBitacora.AddEventoBitacora("Documento Relacionado", Dr("FileExtension").ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveMovimientoAlmacen:=CveMovimiento) Then
' Try
' If Dr("Documento").ToString <> "" Then
' Archivo = New System.IO.FileInfo(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, Dr("Documento").ToString))
' If Archivo.Exists() Then
' File.Move(Archivo.ToString, String.Format("{0}OI\OI{1}{2}", UsuarioActual.Empresa.Ruta, ObjEventoBitacora.CveEvento.ToString, Archivo.Extension))
' Else
' Retorno = False
' End If
' End If
' Catch ex As Exception
' Retorno = False
' Exit For
' End Try
' Else
' Retorno = False
' Exit For
' End If
' Next
' Return Retorno
'End Function
End Class End Class

View File

@@ -119,7 +119,7 @@
<div class="row"> <div class="row">
<div class="col-md-1 truncate">Proveedor</div> <div class="col-md-1 truncate">Proveedor</div>
<div class="col-md-2"> <div class="col-md-2">
<asp:DropDownList ID="DdlProveedor" runat="server" CssClass="form-control input-sm select2me" Width="100%" DataValueField="CveProveedor" DataTextField="RazonSocial"></asp:DropDownList> <ADS:DropDownLost ID="DdlProveedor" runat="server" CssStyle="width: 100%;" data-metodo="getproveedores" CssClassDdl="select2me " Width="100%" DataValueField="CveProveedor" DataTextField="RazonSocial"></ADS:DropDownLost>
</div> </div>
<div class="col-md-1 truncate">Categoría</div> <div class="col-md-1 truncate">Categoría</div>
<div class="col-md-2"> <div class="col-md-2">
@@ -240,6 +240,7 @@
</ItemTemplate> </ItemTemplate>
<ItemStyle Width="7.5%" HorizontalAlign="Right"></ItemStyle> <ItemStyle Width="7.5%" HorizontalAlign="Right"></ItemStyle>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField Visible="false" DataField="CantidadPendienteSurtir" HeaderText="Pte Surtir" DataFormatString="{0:#,###.##}" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Right"/>
<asp:TemplateField ItemStyle-HorizontalAlign="Right" HeaderText="Saldo Inicial"> <asp:TemplateField ItemStyle-HorizontalAlign="Right" HeaderText="Saldo Inicial">
<ItemTemplate> <ItemTemplate>
<asp:Label ID="lbSaldoI2" runat="server" Text='<%# If(Eval("SaldoIniImp").ToString() = "0", "-", Eval("SaldoIniImp", "{0:N2}")) %>'></asp:Label> <asp:Label ID="lbSaldoI2" runat="server" Text='<%# If(Eval("SaldoIniImp").ToString() = "0", "-", Eval("SaldoIniImp", "{0:N2}")) %>'></asp:Label>

View File

@@ -94,11 +94,15 @@ Partial Class Inventarios_ReporteEntradasSalidas
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
dvImp.Visible = TienePermisoImportes dvImp.Visible = TienePermisoImportes
GvM.Columns(10).Visible = TienePermisoImportes
GvM.Columns(11).Visible = TienePermisoImportes GvM.Columns(11).Visible = TienePermisoImportes
GvM.Columns(12).Visible = TienePermisoImportes GvM.Columns(12).Visible = TienePermisoImportes
GvM.Columns(13).Visible = TienePermisoImportes GvM.Columns(13).Visible = TienePermisoImportes
GvM.Columns(14).Visible = TienePermisoImportes GvM.Columns(14).Visible = TienePermisoImportes
GvM.Columns(15).Visible = TienePermisoImportes
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
GvM.Columns(10).Visible = TienePermisoImportes
End If
End Sub End Sub
Private Sub CargaCombos() Private Sub CargaCombos()
@@ -126,9 +130,9 @@ Partial Class Inventarios_ReporteEntradasSalidas
DdlMoneda.Items.Insert(0, New ListItem("Todos", "-1")) DdlMoneda.Items.Insert(0, New ListItem("Todos", "-1"))
'Llenar dropdownlist de proveedores 'Llenar dropdownlist de proveedores
DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) 'DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
DdlProveedor.DataBind() 'DdlProveedor.DataBind()
DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1")) 'DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1"))
'CARGA CLASIFICACIONES 'CARGA CLASIFICACIONES
Dim ObjClasificaciones As New ClsClasificaciones Dim ObjClasificaciones As New ClsClasificaciones
@@ -139,7 +143,6 @@ Partial Class Inventarios_ReporteEntradasSalidas
DdlClasificacion.DataBind() DdlClasificacion.DataBind()
DdlClasificacion.Items.Insert(0, New ListItem("Todos", "-1")) DdlClasificacion.Items.Insert(0, New ListItem("Todos", "-1"))
DdlCategoria.DataSource = GlobalDTGralCategorias(UsuarioActual.CveEmpresa) DdlCategoria.DataSource = GlobalDTGralCategorias(UsuarioActual.CveEmpresa)
DdlCategoria.DataBind() DdlCategoria.DataBind()
@@ -148,6 +151,9 @@ Partial Class Inventarios_ReporteEntradasSalidas
'Carga Productos 'Carga Productos
DdlPS.setEsWebService(True) DdlPS.setEsWebService(True)
DdlProveedor.setEsWebService(True)
DdlProveedor.SelectedText = ""
DdlProveedor.SelectedValue = "-1"
'If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then 'If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then
DdlPS.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue) DdlPS.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue)
@@ -160,7 +166,7 @@ Partial Class Inventarios_ReporteEntradasSalidas
' DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) ' DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1"))
'End If 'End If
DdlMovs.SelectedValue = "2" DdlMovs.SelectedValue = "3"
'Llenar dropdownlist de personal 'Llenar dropdownlist de personal
DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa)
@@ -179,7 +185,6 @@ Partial Class Inventarios_ReporteEntradasSalidas
CargarMarcas() CargarMarcas()
DdlTipoAlmacen.DataSource = GlobalDTTipoAlmacen(1) DdlTipoAlmacen.DataSource = GlobalDTTipoAlmacen(1)
DdlTipoAlmacen.DataBind() DdlTipoAlmacen.DataBind()
DdlTipoAlmacen.Items.Insert(0, New ListItem("Todos", "-1")) DdlTipoAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
@@ -187,7 +192,8 @@ Partial Class Inventarios_ReporteEntradasSalidas
End Sub End Sub
Protected Sub DdlCategoria_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlCategoria_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaClasificaciones() CargaClasificaciones(DdlCategoria.SelectedValue.ToEntero)
End Sub End Sub
Private Sub CargaClasificaciones(CveCategoria As Integer) Private Sub CargaClasificaciones(CveCategoria As Integer)
@@ -354,7 +360,7 @@ Partial Class Inventarios_ReporteEntradasSalidas
Dim TipoMov = If(DdlTipoMovimiento.SelectedValue = "-1", "", $"&emsp;<b>Tipo&nbsp;Movimiento:</b>&nbsp;{DdlTipoMovimiento.SelectedItem.Text}") Dim TipoMov = If(DdlTipoMovimiento.SelectedValue = "-1", "", $"&emsp;<b>Tipo&nbsp;Movimiento:</b>&nbsp;{DdlTipoMovimiento.SelectedItem.Text}")
Dim Moneda = If(DdlMoneda.SelectedValue = "-1", "", $"&emsp;<b>Moneda:</b>&nbsp;{DdlMoneda.SelectedItem.Text}") Dim Moneda = If(DdlMoneda.SelectedValue = "-1", "", $"&emsp;<b>Moneda:</b>&nbsp;{DdlMoneda.SelectedItem.Text}")
Dim SoloConMov = If(DdlMovs.SelectedValue = "-1", "", $"&emsp;<b>Solo&nbsp;Movimientos:</b>&nbsp;{DdlMovs.SelectedItem.Text}") Dim SoloConMov = If(DdlMovs.SelectedValue = "-1", "", $"&emsp;<b>Solo&nbsp;Movimientos:</b>&nbsp;{DdlMovs.SelectedItem.Text}")
Dim Proveedor = If(DdlProveedor.SelectedValue = "-1", "", $"&emsp;<b>Proveedor:</b>&nbsp;{DdlProveedor.SelectedItem.Text}") Dim Proveedor = If(DdlProveedor.SelectedValue = "-1", "", $"&emsp;<b>Proveedor:</b>&nbsp;{DdlProveedor.SelectedText}")
Dim Clasificacion = If(DdlClasificacion.SelectedValue = "-1", "", $"&emsp;<b>Clasificación:</b>&nbsp;{DdlClasificacion.SelectedItem.Text}") Dim Clasificacion = If(DdlClasificacion.SelectedValue = "-1", "", $"&emsp;<b>Clasificación:</b>&nbsp;{DdlClasificacion.SelectedItem.Text}")
Dim Familia = If(DdlCategoria.SelectedValue = "-1", "", $"&emsp;<b>Categoria:</b>&nbsp;{DdlCategoria.SelectedItem.Text}") Dim Familia = If(DdlCategoria.SelectedValue = "-1", "", $"&emsp;<b>Categoria:</b>&nbsp;{DdlCategoria.SelectedItem.Text}")
Dim SubFamilia = If(DdlSubFamilia.SelectedValue = "-1", "", $"&emsp;<b>SubFamilia:</b>&nbsp;{DdlSubFamilia.SelectedItem.Text}") Dim SubFamilia = If(DdlSubFamilia.SelectedValue = "-1", "", $"&emsp;<b>SubFamilia:</b>&nbsp;{DdlSubFamilia.SelectedItem.Text}")
@@ -419,8 +425,8 @@ Partial Class Inventarios_ReporteEntradasSalidas
GvM.Columns(3).Visible = ChkClasificacion2.Checked GvM.Columns(3).Visible = ChkClasificacion2.Checked
GvM.Columns(5).Visible = ChkSeccionAlmacen.Checked GvM.Columns(5).Visible = ChkSeccionAlmacen.Checked
GvM.Columns(15).Visible = ChkFechaUltimaCompra.Checked GvM.Columns(16).Visible = ChkFechaUltimaCompra.Checked
GvM.Columns(16).Visible = ChkFechaUltimaVenta.Checked GvM.Columns(17).Visible = ChkFechaUltimaVenta.Checked
'GvM.Columns(4).Visible = ChkSeccionAlmacen.Checked 'GvM.Columns(4).Visible = ChkSeccionAlmacen.Checked
If ChkSeccionAlmacen.Checked OrElse ChkCodigoBarras.Checked OrElse ChkCodigoAlterno.Checked Then If ChkSeccionAlmacen.Checked OrElse ChkCodigoBarras.Checked OrElse ChkCodigoAlterno.Checked Then

View File

@@ -524,7 +524,7 @@ public partial class General_RepEntregaAlmacenRuta : ClsPaginas
} }
else else
{ {
if( ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptor, RFCEmisor, CvePACCancelacion)) { if( ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptor, RFCEmisor, CvePACCancelacion,CveSATMotivoCancelacion: 3)) {
if (ObjGenerales.CancelarTimbreTimbrado(CveTimbre, DateTime.Now, CvePACCancelacion, ObjCancelacion.CancelacionAcuse, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) if (ObjGenerales.CancelarTimbreTimbrado(CveTimbre, DateTime.Now, CvePACCancelacion, ObjCancelacion.CancelacionAcuse, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
{ {

View File

@@ -945,10 +945,9 @@
<Columns> <Columns>
<asp:TemplateField HeaderText="Fecha" ItemStyle-HorizontalAlign="Center"> <asp:TemplateField HeaderText="Fecha" ItemStyle-HorizontalAlign="Center">
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("FechaIng","{0:dd-MM-yyyy}") %>'></asp:Literal> <asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("FechaIng","{0:dd-MM-yyyy}") %>'/>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="FechaIng" HeaderText="Fecha" DataFormatString="dd-MM-yyyy" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Descripcion" HeaderText="Descripción" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="Descripcion" HeaderText="Descripción" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Anterior" HeaderText="Anterior" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="Anterior" HeaderText="Anterior" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Actual" HeaderText="Actual" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="Actual" HeaderText="Actual" ItemStyle-HorizontalAlign="Left" />
@@ -3677,6 +3676,42 @@
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</asp:Panel> </asp:Panel>
<div id="ModalCancelarDocumento" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UpCancelarDocumento" class="modal-dialog rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Cancelar Documento</h4>
</div>
<div class="modal-body">
<br />
<div class="row" id="DivMotivoCancelacion" runat="server">
<div class="col-md-2">
<label>Motivo:</label>
</div>
<div class="col-md-10">
<asp:DropDownList ID="DdlMotivoCancelacion" CssClass=" form-control input-sm select2me" runat="server" Width="100%" DataTextField="MotivoCancelacion" DataValueField="CveMotivoCancelacion">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVMotivoCancelacion" runat="server" CssClass="help-block errorimput" Display="Dynamic" InitialValue="-1" ControlToValidate="DdlMotivoCancelacion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpModalCancelarDocumento"></asp:RequiredFieldValidator>
</div>
</div>
</div>
<div class="modal-footer">
<asp:UpdatePanel ID="UpFooterCancelarRemision" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<button id="BCancelarDocumento" type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
<asp:Button Text="Cancelar Documento" ID="BtnCancelarDocumento" OnClick="BtnCancelarDocumento_Click" CssClass="btn btn-primary" ValidationGroup="GrpModalCancelarDocumento" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:TextBox ID="TxtCvePeriodo" CssClass="TxtCvePeriodo hidden" runat="server"></asp:TextBox> <asp:TextBox ID="TxtCvePeriodo" CssClass="TxtCvePeriodo hidden" runat="server"></asp:TextBox>
<asp:TextBox ID="TxtCvePersonal" CssClass="TxtCvePersonal hidden" runat="server"></asp:TextBox> <asp:TextBox ID="TxtCvePersonal" CssClass="TxtCvePersonal hidden" runat="server"></asp:TextBox>
<asp:Button ID="BtnGeneratepdf" CssClass="BtnGeneratepdf hidden" OnClick="BtnGeneratepdf_Click" UseSubmitBehavior="false" runat="server" Text="Button" /> <asp:Button ID="BtnGeneratepdf" CssClass="BtnGeneratepdf hidden" OnClick="BtnGeneratepdf_Click" UseSubmitBehavior="false" runat="server" Text="Button" />

View File

@@ -193,7 +193,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
if (!IsPostBack) if (!IsPostBack)
{ {
using (ClsNominas objnom =new ClsNominas()) using (ClsNominas objnom = new ClsNominas())
{ {
objnom.GetNominasSinTimbrar(-1, UsuarioActual.CveEmpresa); objnom.GetNominasSinTimbrar(-1, UsuarioActual.CveEmpresa);
GVNominaPendiente.DataSource = objnom.DTSetResultados.Tables[0]; GVNominaPendiente.DataSource = objnom.DTSetResultados.Tables[0];
@@ -1210,13 +1210,37 @@ public partial class Nomina_Nomina2 : ClsPaginas
} }
} }
protected int CveNominaCancelar
{
get
{
if (ViewState["CveNominaCancelar"] == null) { return 0; }
else { return ViewState["CveNominaCancelar"].ToString().ToEntero(); }
}
set { ViewState["CveNominaCancelar"] = value; }
}
protected void LnkCancelar_Click(object sender, EventArgs e) protected void LnkCancelar_Click(object sender, EventArgs e)
{ {
int CveNomina = ((LinkButton)sender).CommandArgument.ToEntero(); int CveNomina = ((LinkButton)sender).CommandArgument.ToEntero();
CveNominaCancelar = CveNomina;
DdlMotivoCancelacion.DataSource = get_GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa).FiltraParametros("CveSATMotivoCancelacion IN (2,3)");
DdlMotivoCancelacion.DataBind();
UpCancelarDocumento.Update();
RegistraScript("$('#ModalCancelarDocumento').modal()");
}
protected void BtnCancelarDocumento_Click(object sender, EventArgs e)
{
int CveNomina = CveNominaCancelar;
if (CveNomina > 0) if (CveNomina > 0)
{ {
DdlMotivoCancelacion.Items.Insert(0, new ListItem("Seleccione", "-1"));
using (ClsNominas Nom = new ClsNominas()) using (ClsNominas Nom = new ClsNominas())
{ {
@@ -1229,8 +1253,14 @@ public partial class Nomina_Nomina2 : ClsPaginas
string RFCReceptor = Nom.RFC; string RFCReceptor = Nom.RFC;
string RFCEmisor = UsuarioActual.Empresa.RFC; string RFCEmisor = UsuarioActual.Empresa.RFC;
string SerieFolio = Nom.SerieFolio; string SerieFolio = Nom.SerieFolio;
DataRow rowc = get_GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa).FiltroPrimero(string.Format("CveMotivoCancelacion={0}", DdlMotivoCancelacion.SelectedValue));
int CveMotivoCancelacion = -1;
if(rowc != null)
{
CveMotivoCancelacion = rowc["CveSATMotivoCancelacion"].ToString().ToEntero();
}
if (ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, RFCEmisor, 4)) if (ObjTimbrado.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, RFCEmisor, 4, CveSATMotivoCancelacion: CveMotivoCancelacion))//,CveSATMotivoCancelacion:=
{ {
try try
{ {
@@ -1266,9 +1296,9 @@ public partial class Nomina_Nomina2 : ClsPaginas
cargaDatos(); cargaDatos();
} }
RegistraScript("$('#ModalCancelarDocumento').modal('hide')");
} }
protected void LnkModalPlantillaNomina_Click(object sender, EventArgs e) protected void LnkModalPlantillaNomina_Click(object sender, EventArgs e)
{ {
RegistraScript("$('#DModalNominas').modal();"); RegistraScript("$('#DModalNominas').modal();");
@@ -1925,7 +1955,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
using (ClsNominas objRH = new ClsNominas()) using (ClsNominas objRH = new ClsNominas())
{ {
if (objRH.GETPersonalVacaciones(UsuarioActual.CveEmpresa ,SRCvePersonal)) if (objRH.GETPersonalVacaciones(UsuarioActual.CveEmpresa, SRCvePersonal))
{ {
GvVacaciones.DataSource = objRH.DtResultados; GvVacaciones.DataSource = objRH.DtResultados;
@@ -7710,4 +7740,5 @@ public partial class Nomina_Nomina2 : ClsPaginas
} }
UpModalProrrateo.Update(); UpModalProrrateo.Update();
} }
} }

View File

@@ -2770,6 +2770,10 @@
</div> </div>
</div> </div>
<div class="portlet-body form"> <div class="portlet-body form">
<asp:UpdatePanel runat="server" ID="UPPDatosUsado" UpdateMode="Conditional">
<ContentTemplate>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<label>Tipo Servicio:</label> <label>Tipo Servicio:</label>
@@ -2832,7 +2836,8 @@
</div> </div>
</div> </div>
</div> </div>
</ContentTemplate>
</asp:UpdatePanel>
</div> </div>
</div> </div>

View File

@@ -34,7 +34,7 @@ Partial Class PV
Private Property FolioXML As String Private Property FolioXML As String
Private Property SubTotal As Decimal Private Property SubTotal As Decimal
Private Property Total As Decimal = 0 Private Property Total As Decimal = 0
Private Property Descuentos As Decimal = 0 'Private Property Descuentos As Decimal = 0
Private Property EmisorRFC As String Private Property EmisorRFC As String
Private Property ReceptorRFC As String Private Property ReceptorRFC As String
Private Property TrasladoIVA As Decimal = 0 Private Property TrasladoIVA As Decimal = 0
@@ -83,6 +83,15 @@ Partial Class PV
End Set End Set
End Property End Property
Private Property DtPorcentajeMarcas As DataTable
Get
Return If(IsNothing(ViewState("DtPorcentajeMarcas")), Nothing, CType(ViewState("DtPorcentajeMarcas"), DataTable))
End Get
Set(value As DataTable)
ViewState("DtPorcentajeMarcas") = value
End Set
End Property
Private Property RemisionesLista As List(Of Integer) Private Property RemisionesLista As List(Of Integer)
Get Get
Return If(IsNothing(ViewState("RemisionesLista")), Nothing, CType(ViewState("RemisionesLista"), List(Of Integer))) Return If(IsNothing(ViewState("RemisionesLista")), Nothing, CType(ViewState("RemisionesLista"), List(Of Integer)))
@@ -2576,6 +2585,12 @@ Partial Class PV
If Not String.IsNullOrEmpty(ObjCliente.Vendedor) Then If Not String.IsNullOrEmpty(ObjCliente.Vendedor) Then
LbVendedor.Text = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Vendedor", $"CveVendedor = {ObjCliente.Vendedor}") LbVendedor.Text = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Vendedor", $"CveVendedor = {ObjCliente.Vendedor}")
End If End If
' si es empresa acumuladores
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
CargaPorcentajeMarcas()
End If
Else Else
TrEsDistribuidor.Visible = False TrEsDistribuidor.Visible = False
End If End If
@@ -2697,6 +2712,14 @@ Partial Class PV
UPCondicionesPago.Update() UPCondicionesPago.Update()
End Sub End Sub
Private Sub CargaPorcentajeMarcas()
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPorcentajeMarcas(CveCliente) Then
DtPorcentajeMarcas = ObjPS.DtResultados.Copy()
End If
ObjPS.Dispose()
End Sub
Private Sub CambiaSucursal() Private Sub CambiaSucursal()
CargaFormatoSucursal() CargaFormatoSucursal()
CargaFolios() CargaFolios()
@@ -3744,6 +3767,10 @@ Partial Class PV
ObjFactura.ErrorList.Add("No existe un almacen configurado como 'Servicio a Domicilio' en esta sucursal.") ObjFactura.ErrorList.Add("No existe un almacen configurado como 'Servicio a Domicilio' en esta sucursal.")
End If End If
If TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.Rows.Count > 0 Then
ObjFactura.EsGarantia = True
End If
End If End If
Catch ex As Exception Catch ex As Exception
OnError("Ocurrió un error al generar la venta", ex) OnError("Ocurrió un error al generar la venta", ex)
@@ -4134,6 +4161,176 @@ Partial Class PV
UpAddVenta.Update() UpAddVenta.Update()
UPPDescuento.Update() UPPDescuento.Update()
End Sub End Sub
Partial Class Descuentos
Public ImporteDescuento As Decimal = 0
Public CvePromocionDetalle As Integer = -1
Public PU As Decimal = 0
Public EsPUModificado As Boolean = False
Public ImporteProntoPago As Decimal = 0
End Class
Private Function CalcularDescuentos(CvePS As Integer, Cantidad As Decimal, PU As Decimal) As Descuentos
Dim Descuento As Decimal = HdnDescuento.Value.ToDecimal
If HdnTipoDescuento.Value = "0" Then
Descuento = HdnDescuento.Value.ToDecimal * Cantidad
End If
Dim ValidaCondicionesComerciales As Boolean = True
'AGREGA PROMOCION EN EL DESCUENTO
Dim TipoPromo As Integer = 0
Dim TotalPromocion As Decimal = 0
Dim PromocionPorcentaje As Decimal = 0
Dim PUModificado As Decimal = 0
Dim SeAjustoPU As Boolean = False
Dim PUPromocion As Decimal = 0
Dim CantMinima As Integer = 0
Dim CveMarcaPS As Integer = 0
Dim CveClasifPS As Integer = 0
Dim CveRinTamañoPS As Integer = 0
Dim CvePromocionDetalle As Integer = 0
Dim IncluyeImpuestos As Boolean = False
Dim TipoAplicacion As Integer = 1 ' 1 - descuento, 2 en PU
Dim ObjDescuento As New Descuentos
If DdlSubProyectoDatos.SelectedValue = "11842" Then '' E141, el subproyecto: Franquicia, no proceden las promociones
Return ObjDescuento
End If
Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DrPS IsNot Nothing Then
CveMarcaPS = DrPS("CveMarca").ToString().ToEntero()
CveClasifPS = DrPS("CveClasificacion").ToString().ToEntero()
CveRinTamañoPS = DrPS("CveRinTamaño").ToString().ToEntero()
If CveClasifPS = 20636 Then
ValidaCondicionesComerciales = False
End If
End If
Dim dr As DataRow = Nothing
If DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then
dr = DtPromociones.FiltroPrimero(String.Format("CvePS = {0} AND (CveSubProyecto = {1} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {2} OR CveRinTamaño IS NULL) AND ((TipoPromocion <> 3 AND (CantidadMinima <= {3} OR CantidadMinima IS NULL)) OR (TipoPromocion = 3 AND CantidadMinima <= {3} ))", CvePS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, Cantidad), Orderby:="CantidadMinima desc ")
If dr Is Nothing Then
'verifica marca, si tiene asignada la promocion
dr = DtPromociones.FiltroPrimero(String.Format("CvePS IS NULL AND CveClasificacion = {0} AND (CveMarca = {1} OR CveMarca IS NULL) AND (CveSubProyecto = {2} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {3} OR CveRinTamaño IS NULL) AND ((TipoPromocion <> 3 AND (CantidadMinima <= {4} OR CantidadMinima IS NULL)) OR (TipoPromocion = 3 AND CantidadMinima <= {4} )) ", CveClasifPS, CveMarcaPS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, Cantidad), Orderby:="CantidadMinima desc")
End If
End If
Dim Cant As Integer = 1
If dr IsNot Nothing Then
TipoPromo = dr("TipoPromocion").ToString().ToEntero()
CantMinima = dr("CantidadMinima").ToString().ToEntero()
IncluyeImpuestos = dr("IncluyeImpuestos").ToString() = "True"
PromocionPorcentaje = dr("Promocion").ToString().ToDecimal
PUPromocion = dr("PUPromocion").ToString().ToDecimal
CvePromocionDetalle = dr("CvePromocionDetalle").ToString().ToEntero()
TipoAplicacion = dr("TipoAplicacion").ToString().ToEntero()
If CantMinima > 0 Then
Cant = Math.Floor(Cantidad / CantMinima).ToEntero()
End If
End If
Dim PorcentajeIVA As Decimal = ViewState("SubProyectoPorcentajeIVA").ToString.ToDecimal ''Math.Round(ViewState("SubProyectoPorcentajeIVA").ToString.ToDecimal, 2).ToDecimal
TotalPromocion = Math.Round(PUPromocion * Cant / (1 + If(IncluyeImpuestos, PorcentajeIVA, 0)), 6)
If TipoPromo = 1 Then 'Promocion por Importe $
If TipoAplicacion = 2 Then
Descuento = 0
SeAjustoPU = True
PUModificado = Math.Round(PUPromocion / (1 + If(IncluyeImpuestos, PorcentajeIVA, 0)), 6)
Else
Descuento = Descuento + PU - TotalPromocion
End If
ElseIf TipoPromo = 2 Then 'Promocion por %
Descuento = Descuento + ((PU * PromocionPorcentaje / 100) * Cantidad)
ElseIf TipoPromo = 3 Then 'Promocion por Cantidad
If Cantidad >= CantMinima Then
Descuento = Descuento + TotalPromocion
Else
CvePromocionDetalle = -1
End If
End If
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then
Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}")
'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA
If RowPorcentaje IsNot Nothing Then
'(AHORA LOS DESCUENTOS SON ACUMULABLES)
'Descuento = 0
Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D
Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D
Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D
Dim TotalInicial As Decimal = (Cantidad * (PU)) '- Descuento
Dim TotalFinal = TotalInicial
'SI APLICA EL PRIMER DESCUENTO
If PorcentajeProducto > 0 Then
Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2)
Dim Total2 = (TotalInicial - Descuento1)
'SI APLICA EL SEGUNDO DESCUENTO
If PorcentajeProducto2 > 0 Then
Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2)
Dim Total3 = (Total2 - Descuento2)
'SI APLICA EL TERCER DESCUENTO
If PorcentajeProducto3 > 0 Then
Dim Descuento3 As Decimal = (Total3 * PorcentajeProducto3).RoundSQL(2)
TotalFinal = Total3 - Descuento3
Else
TotalFinal = Total3
End If
Else
TotalFinal = Total2
End If
Else
TotalFinal = TotalInicial
End If
If PorcentajeProducto > 0 Then
Descuento += ((Cantidad * PU) - TotalFinal)
End If
'SI TIENE PRONTO PAGO CALCULA EL IMPORTE
If DdlTipoComprobante.SelectedValue = "Ing" AndAlso RowPorcentaje("ProntoPago").ToString().ToDecimal() > 0 Then
Dim TotalProntoPago As Decimal = (Cantidad * (PU)) - Descuento
Dim PorcentajeProntoPago = RowPorcentaje("ProntoPago").ToString().ToDecimal() / 100D
ObjDescuento.ImporteProntoPago = (TotalProntoPago * PorcentajeProntoPago).RoundSQL(2)
End If
End If
End If
End If
ObjDescuento.ImporteDescuento = Descuento
ObjDescuento.CvePromocionDetalle = CvePromocionDetalle
If SeAjustoPU Then
ObjDescuento.PU = PUModificado
ObjDescuento.EsPUModificado = True
End If
Return ObjDescuento
End Function
Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero, DdlPS) DdlPSIndexChange(DdlPS.SelectedValue.ToEntero, DdlPS)
End Sub End Sub
@@ -5114,15 +5311,22 @@ Partial Class PV
Descuento = HdnDescuento.Value.ToDecimal * TxtCantidad.Text.ToDecimal Descuento = HdnDescuento.Value.ToDecimal * TxtCantidad.Text.ToDecimal
End If End If
Dim ObjDescuento As New Descuentos
If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then
Descuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero)) ObjDescuento.ImporteDescuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero))
End If End If
ObjDescuento = CalcularDescuentos(CvePS, Cantidad, PU)
If ObjDescuento.EsPUModificado Then
PU = ObjDescuento.PU
End If
Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero
Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString
Dim Consec = AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, Dim Consec = AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
CvePS, "", TxtObsPS.Text.Trim, PU, Descuento, CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento,
CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text, CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text,
Serie:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CveVentaDetalle:=CveVentaDetalle, EsCargo:=EsCargo) Serie:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CveVentaDetalle:=CveVentaDetalle, EsCargo:=EsCargo)
@@ -6773,12 +6977,12 @@ Partial Class PV
DdlBCIAjuste.DataSource = DTBCIUsados.FiltraParametros($"CveTamaño={CveTamanio}") DdlBCIAjuste.DataSource = DTBCIUsados.FiltraParametros($"CveTamaño={CveTamanio}")
DdlBCIAjuste.DataBind() DdlBCIAjuste.DataBind()
DdlBCIAjuste.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlBCIAjuste.Items.Insert(0, New ListItem("Seleccione", "-1"))
RFVAnio.Enabled = True CVAnio.Enabled = True
If CveTamanio = 16 Then 'motobaterias If CveTamanio = 16 Then 'motobaterias
DdlBCIAjuste.Items.Insert(0, New ListItem(" - ", "0")) DdlBCIAjuste.Items.Insert(0, New ListItem(" - ", "0"))
RFVAnio.Enabled = False CVAnio.Enabled = False
End If End If
UPPDatosUsado.Update() ''refresca el RFV 'UPPDatosUsado.Update() ''refresca el RFV
Else Else
DdlBCIAjuste.Items.Insert(0, New ListItem(" - ", "0")) DdlBCIAjuste.Items.Insert(0, New ListItem(" - ", "0"))
End If End If

View File

@@ -36,25 +36,25 @@
<div class="portlet light smmallpadding traspasorow bordered"> <div class="portlet light smmallpadding traspasorow bordered">
<div class="portlet-title"> <div class="portlet-title">
<div class="caption font-green"> <div class="caption font-green">
<span class="caption-subject bold uppercase" style="line-height: 2;">Facturas Pendientes Por Respuesta</span> <span class="caption-subject bold uppercase" style="line-height: 1;">Facturas Pendientes Por Respuesta</span>
</div> </div>
<div class="actions"> <div class="actions">
<div class="btn-group"> <div class="btn-group">
</div> <div class="row" style="margin-left: 0px; text-align: right" align="left">
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body rowpadding">
<div class="row">
<div class="col-md-12">
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<div style="margin-right: 15px"> <div style="margin-right: 15px">
<input type="text" id="TxtBusqueda1" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda1','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" /> <input type="text" id="TxtBusqueda1" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda1','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div> </div>
</div> </div>
</div>
</div>
</div>
<div class="portlet-body rowpadding">
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación" <asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación"
DataKeyNames="CveVenta,CveCliente,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,RFCCliente" DataKeyNames="CveVenta,CveCliente,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,RFCCliente"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%"> CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%">
@@ -84,25 +84,24 @@
<div id="DivRefacturar" runat="server" visible="false" class="portlet light smmallpadding traspasorow bordered"> <div id="DivRefacturar" runat="server" visible="false" class="portlet light smmallpadding traspasorow bordered">
<div class="portlet-title"> <div class="portlet-title">
<div class="caption font-green"> <div class="caption font-green">
<span class="caption-subject bold uppercase" style="line-height: 2;">Facturas Pendientes Por Refacturar</span> <span class="caption-subject bold uppercase" style="line-height: 2;">Facturas Pendientes de cancelar provenientes de refacturación</span>
</div> </div>
<div class="actions"> <div class="actions">
<div class="btn-group"> <div class="btn-group">
</div> <div class="row" style="margin-left: 0px; text-align: right" align="left">
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body rowpadding">
<div class="row">
<div class="col-md-12">
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<div style="margin-right: 15px"> <div style="margin-right: 15px">
<input type="text" id="TxtBusqueda2" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvRefacturaciones.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" /> <input type="text" id="TxtBusqueda2" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvRefacturaciones.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvRefacturaciones.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvRefacturaciones.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div> </div>
</div> </div>
</div>
</div>
</div>
<div class="portlet-body rowpadding">
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvRefacturaciones" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación" <asp:GridView ID="GvRefacturaciones" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación"
DataKeyNames="CveVenta,CveCliente,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,RFCCliente,FolioFiscalSustitucion" DataKeyNames="CveVenta,CveCliente,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,RFCCliente,FolioFiscalSustitucion"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%" OnRowDataBound="GvDatos_RowDataBound"> CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%" OnRowDataBound="GvDatos_RowDataBound">
@@ -114,11 +113,9 @@
<asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Mon" DataField="Abreviatura" ItemStyle-Width="30px" /> <asp:BoundField HeaderText="Mon" DataField="Abreviatura" ItemStyle-Width="30px" />
<asp:BoundField HeaderText="Fecha Solicitud" DataField="FechaCambioEstatus" ItemStyle-Width="160px" /> <asp:BoundField HeaderText="Fecha Solicitud" DataField="FechaCambioEstatus" ItemStyle-Width="160px" />
<asp:BoundField HeaderText="Fecha Cancelacion" DataField="FechaCancelacion" ItemStyle-Width="160px" />
<asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" /> <asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" />
<asp:BoundField HeaderText="Serie Folio Nuevo" DataField="SerieFolioSustitucion" ItemStyle-Width="25%" /> <asp:HyperLinkField HeaderText="Folio Sustitución" DataTextField="SerieFolioSustitucion" DataNavigateUrlFields="CveVentaSustitucion" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
<asp:BoundField HeaderText="Folio Sustitucion" DataField="FolioFiscalSustitucion" ItemStyle-Width="25%" /> <asp:BoundField HeaderText="Motivo" DataField="MotivoCancelacion" ItemStyle-Width="25%" />
<asp:BoundField HeaderText="Motivo" DataField="MotivoCancelacion" ItemStyle-Width="25%" />
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar"> <asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
<ItemTemplate> <ItemTemplate>
<asp:LinkButton ID="LnkValidarRefac" runat="server" OnClick="BtnValidarRefacturacion_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton> <asp:LinkButton ID="LnkValidarRefac" runat="server" OnClick="BtnValidarRefacturacion_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
@@ -129,7 +126,6 @@
<asp:LinkButton ID="LnkCancelar" Visible="false" runat="server" OnClick="BtnCancelarDocumento_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea cancelar el documento?" data-btn-ok-label="si"></asp:LinkButton> <asp:LinkButton ID="LnkCancelar" Visible="false" runat="server" OnClick="BtnCancelarDocumento_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea cancelar el documento?" data-btn-ok-label="si"></asp:LinkButton>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:HyperLinkField HeaderText="Refacturación" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" />
</Columns> </Columns>
<RowStyle CssClass="Texto" /> <RowStyle CssClass="Texto" />
<HeaderStyle CssClass="Titulos" /> <HeaderStyle CssClass="Titulos" />

View File

@@ -11,6 +11,7 @@ using System.Web.UI.WebControls;
using Extensiones; using Extensiones;
using static Extensiones.ModExtensiones; using static Extensiones.ModExtensiones;
using Microsoft.Reporting.WebForms; using Microsoft.Reporting.WebForms;
using System.Net.Http;
public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
{ {
@@ -455,20 +456,20 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
{ {
if (e.Row.RowType == DataControlRowType.DataRow) if (e.Row.RowType == DataControlRowType.DataRow)
{ {
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0) //if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0)
{ //{
e.Row.Cells[14].Text = ""; // e.Row.Cells[14].Text = "";
} //}
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 1 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23) //if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 1 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23)
{ //{
e.Row.FCLinkButton("LnkValidarRefac").Visible = false; // e.Row.FCLinkButton("LnkValidarRefac").Visible = false;
} //}
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23 && e.Row.DBCampo("CveVentaSustitucion").ToEntero() > 0) if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23 && e.Row.DBCampo("CveVentaSustitucion").ToEntero() > 0)
{ {
e.Row.FCLinkButton("LnkCancelar").Visible = true; e.Row.FCLinkButton("LnkCancelar").Visible = true;
e.Row.FCLinkButton("LnkValidarRefac").Visible = false; //e.Row.FCLinkButton("LnkValidarRefac").Visible = false;
} }
} }
} }
@@ -483,6 +484,32 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
Alert("No se encontro la factura para enviar el acuse", TipoMensaje.MsgAdvertencia); Alert("No se encontro la factura para enviar el acuse", TipoMensaje.MsgAdvertencia);
} }
} }
private byte[] DescargarPDF(string Parametros)
{
var Url = new Uri(string.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", ClsPaginas.UrlSitio, Parametros));
byte[] File = null;
try
{
using (var httpClient = new HttpClient())
{
httpClient.Timeout = new TimeSpan(0, 15, 0);
using (var request = new HttpRequestMessage(HttpMethod.Get, Url))
{
request.Headers.Add("ADSToken", Encripta(string.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO={2}", UsuarioActual.CveEmpresa, DateTime.UtcNow.Ticks, UsuarioActual.CveUsuario)));
var response = httpClient.SendAsync(request).Result;
if (response.StatusCode == System.Net.HttpStatusCode.OK)
File = response.Content.ReadAsByteArrayAsync().Result;
}
}
}
catch (Exception ex)
{
File = null;
this.OnError("Ocurrió un error al descargar la factura", ex);
}
return File;
}
public void ImprimeCancelacion(int CveVenta) public void ImprimeCancelacion(int CveVenta)
{ {
@@ -491,32 +518,34 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
{ {
var ObjFactura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa); var ObjFactura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa);
string SelloCancelacion = ""; //string SelloCancelacion = "";
string FechaCancelacion = ""; //string FechaCancelacion = "";
DataTable DtDatos = null; //DataTable DtDatos = null;
using (ClsVentas ObjVentas = new ClsVentas()) //using (ClsVentas ObjVentas = new ClsVentas())
{ //{
if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa)) // if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa))
{ // {
DtDatos = ObjVentas.DtResultados.Copy(); // DtDatos = ObjVentas.DtResultados.Copy();
DataRow drv = DtDatos.Rows[0]; // DataRow drv = DtDatos.Rows[0];
SelloCancelacion = drv["SelloCancelacion"].ToString(); // SelloCancelacion = drv["SelloCancelacion"].ToString();
FechaCancelacion = drv["FechaCancelacion"].ToString().ToDateTime().ToString("dd/MM/yyyy HH:mm:ss"); // FechaCancelacion = drv["FechaCancelacion"].ToString().ToDateTime().ToString("dd/MM/yyyy HH:mm:ss");
} // }
} //}
List<ReportParameter> parametros = new List<ReportParameter>(); //List<ReportParameter> parametros = new List<ReportParameter>();
parametros.Add(new ReportParameter("FechaCancelacion", FechaCancelacion.ToString())); //parametros.Add(new ReportParameter("FechaCancelacion", FechaCancelacion.ToString()));
parametros.Add(new ReportParameter("FolioFiscal", ObjFactura.FolioFiscal)); //parametros.Add(new ReportParameter("FolioFiscal", ObjFactura.FolioFiscal));
parametros.Add(new ReportParameter("RFCEmisor", UsuarioActual.Empresa.RFC)); //parametros.Add(new ReportParameter("RFCEmisor", UsuarioActual.Empresa.RFC));
parametros.Add(new ReportParameter("SelloCancelacion", SelloCancelacion)); //parametros.Add(new ReportParameter("SelloCancelacion", SelloCancelacion));
byte[] ObjetoPDF = StreamPDF(@"Empresas\Grales\Formatos\AcuseCancelacion.rdlc", DtDatos, parametros, "AcuseCancelacion" + CveVenta); //byte[] ObjetoPDF = StreamPDF(@"Empresas\Grales\Formatos\AcuseCancelacion.rdlc", DtDatos, parametros, "AcuseCancelacion" + CveVenta);
byte[] ObjetoPDF = DescargarPDF(Encripta(String.Format("OP=CAN&CVEVTA={0}", CveVenta)));
List<ClsSisMail.ArchivoMail> LSRutasMail = new List<ClsSisMail.ArchivoMail>(); List <ClsSisMail.ArchivoMail> LSRutasMail = new List<ClsSisMail.ArchivoMail>();
string Asunto = string.Empty; string Asunto = string.Empty;
string Cuerpo = string.Empty; string Cuerpo = string.Empty;

View File

@@ -637,7 +637,7 @@
<td><b>Serie - Folio:</b></td> <td><b>Serie - Folio:</b></td>
<td> <td>
<asp:Label ID="LblSerie" runat="server"></asp:Label>- <asp:Label ID="LblSerie" runat="server"></asp:Label>-
<asp:TextBox ID="TxtFolio" runat="server" BorderStyle="None" Text="000" MaxLength="7" Width="60px" ValidationGroup="GrpEmitirImprimir" Style="text-align: left"></asp:TextBox> <asp:TextBox ID="TxtFolio" runat="server" BorderStyle="None" Text="000" MaxLength="7" Width="60px" ValidationGroup="GrpEmitirImprimir" Style="text-align: left" autopostback="true"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVFolio" runat="server" ControlToValidate="TxtFolio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpEmitirImprimir"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RFVFolio" runat="server" ControlToValidate="TxtFolio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpEmitirImprimir"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender10" runat="server" HighlightCssClass="vco" TargetControlID="RFVFolio" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender10" runat="server" HighlightCssClass="vco" TargetControlID="RFVFolio" Width="350px"></ajax:ValidatorCalloutExtender>
<asp:CompareValidator ID="CVFolio" runat="server" ControlToValidate="TxtFolio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio''</b> no tiene el formato correcto, solo formato numérico." Operator="DataTypeCheck" Type="Integer" ValidationGroup="GrpEmitirImprimir"></asp:CompareValidator> <asp:CompareValidator ID="CVFolio" runat="server" ControlToValidate="TxtFolio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio''</b> no tiene el formato correcto, solo formato numérico." Operator="DataTypeCheck" Type="Integer" ValidationGroup="GrpEmitirImprimir"></asp:CompareValidator>
@@ -5725,7 +5725,7 @@
<asp:Button ID="BtnRefacturacionConfirmarAceptacion" runat="server" ClientIDMode="Static" Text="Refacturacion Aceptacion Documento" Style="display: none;" /> <asp:Button ID="BtnRefacturacionConfirmarAceptacion" runat="server" ClientIDMode="Static" Text="Refacturacion Aceptacion Documento" Style="display: none;" />
<asp:Button ID="BtnRefrescarPagina" runat="server" ClientIDMode="Static" Text="Refrescar" Style="display: none;" /> <asp:Button ID="BtnRefrescarPagina" runat="server" ClientIDMode="Static" Text="Refrescar" Style="display: none;" />
<asp:Button ID="BtnAplicaNuevaNC" runat="server" ClientIDMode="Static" Text="AplicarNC" Style="display: none;" /> <asp:Button ID="BtnAplicaNuevaNC" runat="server" ClientIDMode="Static" Text="AplicarNC" Style="display: none;" />
<asp:HiddenField ID="HdnCveVentaAcuse" runat="server" ClientIDMode="Static" Value="0" />
<%--FLETES--%> <%--FLETES--%>
<div id="ModalFletes" class="modal ADS fade" role="dialog"> <div id="ModalFletes" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UpFletes" class="modal-dialog rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpFletes" class="modal-dialog rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
@@ -7080,10 +7080,10 @@
</div> </div>
<div class="row" id="DivRelacionadasCancelacion" runat="server" visible="false"> <div class="row" id="DivRelacionadasCancelacion" runat="server" visible="false">
<div class="col-md-6"> <div class="col-md-12">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
Facturas Padre Facturas que impiden su cancelación
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@@ -7097,9 +7097,8 @@
</asp:GridView> </asp:GridView>
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-6"> <%-- <div class="col-md-6">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
Facturas Hijo Facturas Hijo
@@ -7117,7 +7116,7 @@
</div> </div>
</div> </div>
</div> </div>--%>
</div> </div>
<br /> <br />
<div class="row" id="DivMotivoCancelacion" runat="server"> <div class="row" id="DivMotivoCancelacion" runat="server">
@@ -7803,24 +7802,54 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-12">
<label>Motivo:</label> <asp:Label ID="LbExtraRefacturacion" runat="server"></asp:Label>
</div>
<div class="col-md-10">
<asp:DropDownList ID="DdlMotivoRefacturacion" CssClass=" form-control input-sm select2me" runat="server" Width="100%" DataTextField="MotivoCancelacion" DataValueField="CveMotivoCancelacion">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDdlMotivoRefac" runat="server" CssClass="help-block errorimput" Display="Dynamic" InitialValue="-1" ControlToValidate="DdlMotivoRefacturacion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator>
</div> </div>
</div> </div>
<div class="row"> <div class="row" id="DivRelacionadasRefacturacion" runat="server" visible="false">
<div class="col-md-2"> <div class="col-md-12">
<label>Descripción:</label> <div class="row">
</div> <div class="col-md-12">
<div class="col-md-10"> Facturas que impiden su cancelación
<asp:TextBox ID="TxtMotivoRefac" runat="server" Height="100" Width="100%" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox> </div>
<asp:RequiredFieldValidator ID="RFVTxtMotivoRefac" runat="server" Display="Dynamic" CssClass="help-block errorimput" ControlToValidate="TxtMotivoRefac" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripción''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator> </div>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvFacturasPadreRefacturar" runat="server" DataKeyNames="CveVenta" CssClass="table table-striped table-hover Widthall" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="" GridLines="None">
<Columns>
<asp:HyperLinkField DataTextField="SerieFolio" HeaderText="Serie Folio" Target="_blank" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
<asp:BoundField DataField="TipoDocto" HeaderText="Tipo" />
<asp:BoundField DataField="FolioFiscal" HeaderText="Folio Fiscal" />
</Columns>
</asp:GridView>
</div>
</div>
</div> </div>
</div> </div>
<div class="row" id="DivMotivoRefacturacionTexto" runat="server">
<div class="col-md-12">
<div class="row">
<div class="col-md-2">
<label>Motivo:</label>
</div>
<div class="col-md-10">
<asp:DropDownList ID="DdlMotivoRefacturacion" CssClass=" form-control input-sm select2me" runat="server" Width="100%" DataTextField="MotivoCancelacion" DataValueField="CveMotivoCancelacion">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDdlMotivoRefac" runat="server" CssClass="help-block errorimput" Display="Dynamic" InitialValue="-1" ControlToValidate="DdlMotivoRefacturacion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row">
<div class="col-md-2">
<label>Descripción:</label>
</div>
<div class="col-md-10">
<asp:TextBox ID="TxtMotivoRefac" runat="server" Height="100" Width="100%" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtMotivoRefac" runat="server" Display="Dynamic" CssClass="help-block errorimput" ControlToValidate="TxtMotivoRefac" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripción''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator>
</div>
</div>
</div>
</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<asp:LinkButton ID="BtnMotivoRefacturacion" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpMotivo"> Refacturar</asp:LinkButton> <asp:LinkButton ID="BtnMotivoRefacturacion" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpMotivo"> Refacturar</asp:LinkButton>
@@ -9285,7 +9314,8 @@
$('#BtnMateriales').click(); $('#BtnMateriales').click();
} }
function BtnEnviarMailCancelacion() { function BtnEnviarMailCancelacion(CveVenta) {
HdnCveVentaAcuse.value = CveVenta;
$('#BtnEnviarMailCancelacion').click(); $('#BtnEnviarMailCancelacion').click();
} }
function BtnRefacturacionConfirmar() { function BtnRefacturacionConfirmar() {
@@ -9304,6 +9334,10 @@
$('#BtnAplicaNuevaNC').click(); $('#BtnAplicaNuevaNC').click();
} }
function BtnAplicaNuevaNC() {
$('#BtnAplicaNuevaNC').click();
}
$('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); }); $('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
$('.DdlPSPyME').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); }); $('.DdlPSPyME').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });

View File

@@ -1310,14 +1310,7 @@ Partial Class Ventas
ViewState("CveVentaUsadoDevolucionEfectivo") = value ViewState("CveVentaUsadoDevolucionEfectivo") = value
End Set End Set
End Property End Property
Private Property CveFormaPago33Cliente As Integer
Get
Return If(IsNothing(ViewState("CveFormaPago33Cliente")), -1, ViewState("CveFormaPago33Cliente")).ToString().ToEntero
End Get
Set(value As Integer)
ViewState("CveFormaPago33Cliente") = value
End Set
End Property
Private Property RFCReceptorVenta As String Private Property RFCReceptorVenta As String
Get Get
@@ -1887,6 +1880,31 @@ Partial Class Ventas
ViewState("CveFormaPago33Venta") = value ViewState("CveFormaPago33Venta") = value
End Set End Set
End Property End Property
Private Property CveMetodoPago33Cliente As Integer
Get
Return If(IsNothing(ViewState("CveMetodoPago33Cliente")), -1, ViewState("CveMetodoPago33Cliente")).ToString().ToEntero
End Get
Set(value As Integer)
ViewState("CveMetodoPago33Cliente") = value
End Set
End Property
Private Property CveFormaPago33Cliente As Integer
Get
Return If(IsNothing(ViewState("CveFormaPago33Cliente")), -1, ViewState("CveFormaPago33Cliente")).ToString().ToEntero
End Get
Set(value As Integer)
ViewState("CveFormaPago33Cliente") = value
End Set
End Property
Private Property CveVendedorVenta As Integer
Get
Return (IfNull(ViewState("CveVendedorVenta"), "-1", ViewState("CveVendedorVenta"))).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveVendedorVenta") = value
End Set
End Property
Private Property DiasCredito As Integer Private Property DiasCredito As Integer
Get Get
Return ViewState("DiasCredito").ToString().ToEntero() Return ViewState("DiasCredito").ToString().ToEntero()
@@ -2059,6 +2077,15 @@ Partial Class Ventas
End Set End Set
End Property End Property
Private Property EsGarantia As Boolean
Get
Return CBool(IfNull(ViewState("EsGarantia"), False, ViewState("EsGarantia")))
End Get
Set(value As Boolean)
ViewState("EsGarantia") = value
End Set
End Property
#End Region #End Region
'#Region "AuxiliarConta" '#Region "AuxiliarConta"
@@ -2149,6 +2176,8 @@ Partial Class Ventas
ViewState("ClienteRetISR") = 0 ViewState("ClienteRetISR") = 0
ViewState("CvePrecioLista") = 0 ViewState("CvePrecioLista") = 0
ViewState("CvePrecioListaCliente") = 0 ViewState("CvePrecioListaCliente") = 0
Me.CveVendedorVenta = -1
Me.EsGarantia = False
idCuentaContabilizacion = 1 idCuentaContabilizacion = 1
CveEmpresaCRM = 0 CveEmpresaCRM = 0
CveAcercamientoCRM = 0 CveAcercamientoCRM = 0
@@ -3047,6 +3076,15 @@ Partial Class Ventas
End If End If
'QUITAR ESTAS OPCIONES SI LA FACTURA VA SER CANCELADA O ESTA CANCELADA
If CveEstatus.Contiene(4, 5, 12, 13, 20, 23) Then
LBNotaCredito.Visible = False
LnkAplicarRNCDevolucion.Visible = False
HLPagar.Visible = False
HLSaldarVenta.Visible = False
HlFacturasRelaciondas.Visible = False
End If
End If End If
''EN REALIDAD SE OCUPAN ESTAS COSAS DENTRO DEL POSTABCK ??? ''EN REALIDAD SE OCUPAN ESTAS COSAS DENTRO DEL POSTABCK ???
@@ -3098,8 +3136,6 @@ Partial Class Ventas
'End If 'End If
'UNA VEZ CARGADA LAS CONDICIONES DE PAGO INICIALMENTE, NO VUELVE A SOBREESCRIBIR EL VALOR
CveFormaPago33Cliente = -1
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
trRotacion.Visible = True trRotacion.Visible = True
@@ -4187,6 +4223,8 @@ Partial Class Ventas
ViewState("CveSubProyectoVenta") = DbRowVenta("CveSubProyecto").ToString().ToEntero() ViewState("CveSubProyectoVenta") = DbRowVenta("CveSubProyecto").ToString().ToEntero()
Me.EsGarantia = CBool(DbRowVenta("EsGarantia"))
Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString().ToEntero() Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString().ToEntero()
'CargaEncabezado 'CargaEncabezado
If Not (CveRemision > 0 Or CveCotizacion > 0) Then If Not (CveRemision > 0 Or CveCotizacion > 0) Then
@@ -4214,7 +4252,7 @@ Partial Class Ventas
'End If 'End If
If Not CveEstatus.Contiene(4, 5, 12, 13, 20) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs", "Ant") AndAlso UsuarioActual.TienePermisoProceso(159) Then If Not CveEstatus.Contiene(4, 5, 12, 13, 20, 23) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs", "Ant") AndAlso UsuarioActual.TienePermisoProceso(159) Then
Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto"))) Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto")))
If TienePermiso <> "" Then If TienePermiso <> "" Then
LkRefacturacion.Visible = True LkRefacturacion.Visible = True
@@ -4571,6 +4609,17 @@ Partial Class Ventas
Me.CveMetodoPago33Venta = DbRowVenta("CveMetodoPago33").ToString().ToEntero() Me.CveMetodoPago33Venta = DbRowVenta("CveMetodoPago33").ToString().ToEntero()
Me.CveFormaPago33Venta = DbRowVenta("CveFormaPago33").ToString().ToEntero() Me.CveFormaPago33Venta = DbRowVenta("CveFormaPago33").ToString().ToEntero()
Me.CveVendedorVenta = DbRowVenta("CveVendedor").ToString().ToEntero()
'SI YA TIENE UN VALOR ASIGNADO SELECCIONA EL GUARDADO
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Me.CveVenta > 0 AndAlso Me.CveVendedorVenta > 0 Then
Dim Vendedor = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=1).FiltroPrimeroValor("Vendedor", String.Format("CveVendedor = {0}", Me.CveVendedorVenta))
'SI NO ENCUENTRA BUSCA EN LOS VENDEDORES DEL PV
If String.IsNullOrEmpty(Vendedor) Then
Vendedor = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=4).FiltroPrimeroValor("Vendedor", String.Format("CveVendedor = {0}", Me.CveVendedorVenta))
End If
DdlVendedor.SelectedValueExistInsert(Me.CveVendedorVenta, Vendedor)
End If
If DdlFormaPago33.SelectedValue <> DbRowVenta("CveFormaPago33").ToString() And DbRowVenta("CveFormaPago33").ToString() <> "" Then If DdlFormaPago33.SelectedValue <> DbRowVenta("CveFormaPago33").ToString() And DbRowVenta("CveFormaPago33").ToString() <> "" Then
'sino está seleccionada la asginada la debe de cargar 'sino está seleccionada la asginada la debe de cargar
@@ -5838,16 +5887,27 @@ Partial Class Ventas
Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero() Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero()
Me.CveMetodoPago33Cliente = ObjCliente.CveMetodoPago33
Me.CveFormaPago33Cliente = ObjCliente.CveFormaPago33 Me.CveFormaPago33Cliente = ObjCliente.CveFormaPago33
If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 OrElse ModalidadEdicion Then If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 OrElse ModalidadEdicion Then
'CveMetodoPagoCliente = ObjCliente.CveMetodoPago 'CveMetodoPagoCliente = ObjCliente.CveMetodoPago
If UsuarioActual.Empresa.Funcionalidad(589) = "1" Then
'SI EL METODO DE PAGO ES PUE, SELECCIONA CONTADO
DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33) If Me.CveMetodoPago33Cliente = 1 Then
CambiaMetodoPago33() RBLPago.SelectedValue = "2"
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33) ElseIf Me.CveMetodoPago33Cliente = 3 Then
RBLPago.SelectedValue = "1"
End If
RBLPago_SelectedIndexChanged(RBLPago, Nothing)
UPCondicionesPago.Update()
Else
DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33)
CambiaMetodoPago33()
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33)
End If
DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI) DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI)
End If End If
PlazoCobranza = ObjCliente.PlazoCobranza PlazoCobranza = ObjCliente.PlazoCobranza
@@ -6376,9 +6436,21 @@ Partial Class Ventas
If ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta <= 0) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) AndAlso RBLPago.SelectedValue = "1" AndAlso PermiteCredito Then If ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta <= 0) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) AndAlso RBLPago.SelectedValue = "1" AndAlso PermiteCredito Then
'FUNCIONALIDAD 702 - NO VERIFICAR LIMITE DE CRÉDITO Y CANDADOS DE VENTA 'FUNCIONALIDAD 702 - NO VERIFICAR LIMITE DE CRÉDITO Y CANDADOS DE VENTA
If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then
RBLPago.SelectedValue = "1" If UsuarioActual.Empresa.Funcionalidad(589) = "1" Then
RBLPago_SelectedIndexChanged(Nothing, Nothing) 'SI EL METODO DE PAGO ES PUE, SELECCIONA CONTADO
UPCondicionesPago.Update() If Me.CveMetodoPago33Cliente = 1 Then
RBLPago.SelectedValue = "2"
ElseIf Me.CveMetodoPago33Cliente = 3 Then
RBLPago.SelectedValue = "1"
End If
RBLPago_SelectedIndexChanged(RBLPago, Nothing)
UPCondicionesPago.Update()
Else
RBLPago.SelectedValue = "1"
RBLPago_SelectedIndexChanged(RBLPago, Nothing)
UPCondicionesPago.Update()
End If
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
@@ -8753,6 +8825,8 @@ Partial Class Ventas
Dim SeTimbroNC As Boolean = False Dim SeTimbroNC As Boolean = False
Dim EstatusSMS = 0 Dim EstatusSMS = 0
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
@@ -8769,12 +8843,14 @@ Partial Class Ventas
DebeTimbrar = False DebeTimbrar = False
End If End If
If UsuarioActual.TienePermisoProceso(335) Then
DebeTimbrar = False
End If
If 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
@@ -8783,64 +8859,50 @@ Partial Class Ventas
PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado) PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado)
End If End If
'DOCUMENTO ACTUAL Dim ObjTimbrado As New Timbrado
If DebeTimbrar Then SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
Dim FolioFiscalFactura As String = ObjTimbrado.UUID
Dim MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI
ObjTimbrado = Nothing
Dim ObjTimbrado As New Timbrado 'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura) If DebeTimbrar AndAlso ListaNotasCreditoGeneradas.Count > 0 Then
Dim FolioFiscalFactura As String = ObjTimbrado.UUID Try
Dim MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI For Each NCGenerada In ListaNotasCreditoGeneradas
ObjTimbrado = Nothing 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)
'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION If Not TimbroNC Then
If ListaNotasCreditoGeneradas.Count > 0 Then Alert(ObjTimbradoNC.MensajeErrorCFDI, TipoMensaje.MsgError)
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 ObjTimbradoNC = Nothing
Catch ex As Exception End If
OnError("Ocurrió un error al timbrar la NC.", ex) Next
End Try Catch ex As Exception
OnError("Ocurrió un error al timbrar la NC.", ex)
End If End Try
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
Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, FolioFiscalFactura)
End If
End If
End If End If
''NOTA DE CREDITO DE REFACTURACION If SeTimbro AndAlso ObjFactura.TipoDocto.Contiene("Ing") Then
'If RefacturacionGeneroNC Then EstatusSMS = EnviarSMSTimbrado(ObjEventos)
' If Not IsNothing(ObjNC) AndAlso ObjNC.Count > 0 Then End If
' Dim ofa As Modelos.Factura = CType(ObjNC(0), Modelos.Factura)
' SeTimbroNC = ObjTimbrado.TimbrarFactura(UsuarioActual, ofa) If Not SeTimbro Then
' End If Alert(MsgErrorTimbrado, TipoMensaje.MsgError)
'End If 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
@@ -8987,6 +9049,17 @@ Partial Class Ventas
MensajeAlert.AppendFormat(String.Format("<br/>La nota de crédito <b>{0}</b> por descuento pronto pago se generó correctamente.<br/><br/>", SerieFolioNCProntoPago)) 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 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 'MUESTA ALERT OK
' si es elrol 1165-Ventas,EMp:80, o la empresa 119, recarga ventas, para seguir registrando-. ' 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"";")) '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"";"))
@@ -10505,6 +10578,8 @@ Partial Class Ventas
ObjFactura.NuevaFactura = Me.NuevaFactura ObjFactura.NuevaFactura = Me.NuevaFactura
ObjFactura.EsGarantia = Me.EsGarantia
'ASIGNAR RFC RECEPTOR 'ASIGNAR RFC RECEPTOR
If ObjFactura.Timbre IsNot Nothing Then If ObjFactura.Timbre IsNot Nothing Then
If ObjFactura.Timbre.Receptor IsNot Nothing Then If ObjFactura.Timbre.Receptor IsNot Nothing Then
@@ -11669,7 +11744,16 @@ Partial Class Ventas
ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la Factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico") ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la Factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Exit For Exit For
Else Else
'VERIFICAR QUE EL DESCUENTO NO PASE EL 40%
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Row("CveClasificacion").ToString().ToEntero() <> 20519 AndAlso (Not Row("Obs").ToString().Contains("Descuento por garantía")) Then
Dim TotalDetalle = Math.Round((Row("Total").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6)
Dim DescuentoDetalle = Row("Descuento").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1))
Dim PorcentajeDescuento As Double = (DescuentoDetalle / TotalDetalle) * 100D
If PorcentajeDescuento > 40 Then
ErrorList.Add(String.Format("El descuento del producto/servicio {0} no puede ser mayor al 40%. Porcentaje Actual: {1}%", Row("CodigoPS"), PorcentajeDescuento.RoundSQL(2)))
Exit For
End If
End If
'Agregamos el gasto de contrato 'Agregamos el gasto de contrato
If CveContrato > 0 AndAlso factura.TipoDocto = "Rem" AndAlso AplicaGastoContrato Then If CveContrato > 0 AndAlso factura.TipoDocto = "Rem" AndAlso AplicaGastoContrato Then
@@ -16388,6 +16472,7 @@ Partial Class Ventas
TrRFC.Visible = False TrRFC.Visible = False
'RBLPago.Enabled = False 'RBLPago.Enabled = False
RBLPago.SelectedValue = "2" RBLPago.SelectedValue = "2"
RBLPago_SelectedIndexChanged(RBLPago, EventArgs.Empty)
TxtFechaVencimientoCotizacion.Text = Now.ToString() TxtFechaVencimientoCotizacion.Text = Now.ToString()
GvPS.Columns(5).Visible = True GvPS.Columns(5).Visible = True
ThTiempoEntrega.Visible = True ThTiempoEntrega.Visible = True
@@ -20352,8 +20437,66 @@ Partial Class Ventas
If Vigencia IsNot Nothing Then If Vigencia IsNot Nothing Then
If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
Alert("Esta factura no es cancelable.", TipoMensaje.MsgAdvertencia) sb.AppendFormat("<b>{0}</b> <br/>", Vigencia.EsCancelable)
Exit Sub
DivRelacionadasRefacturacion.Visible = True
BtnMotivoRefacturacion.Visible = False
DivMotivoRefacturacionTexto.Visible = False
Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion)
If Relacionados IsNot Nothing Then
Dim sbExtra As New StringBuilder()
If Relacionados.Codigo = 500 Then
sbExtra.Append("El servicio de verificación de documentos relacionados no esta disponible.")
Else
sbExtra.Append(Relacionados.Mensaje)
Dim SbHijos = New StringBuilder()
Dim SbPadres = New StringBuilder()
'If Relacionados.RelacionadosHijo IsNot Nothing Then
' For Each hijo In Relacionados.RelacionadosHijo
' SbHijos.AppendFormat("{0};", hijo.Uuid)
' Next
' If SbHijos.Length > 0 Then
' SbHijos.Remove(SbHijos.Length - 1, 1)
' End If
'End If
If Relacionados.RelacionadosPadre IsNot Nothing Then
For Each padre In Relacionados.RelacionadosPadre
SbPadres.AppendFormat("{0};", padre.Uuid)
Next
If SbPadres.Length > 0 Then
SbPadres.Remove(SbPadres.Length - 1, 1)
End If
End If
Using ObjVentas As New ClsVentas
'If SbHijos.Length > 0 Then
' If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbHijos.ToString(), UsuarioActual.CveEmpresa) Then
' GvFacturasHijosCancelar.DataSource = ObjVentas.DtResultados.Copy()
' End If
'End If
If SbPadres.Length > 0 Then
If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbPadres.ToString(), UsuarioActual.CveEmpresa) Then
GvFacturasPadreRefacturar.DataSource = ObjVentas.DtResultados.FiltraParametros($"CveVenta <> {CveVenta}")
End If
End If
End Using
'GvFacturasHijosCancelar.DataBind()
GvFacturasPadreRefacturar.DataBind()
End If
If sbExtra.Length > 0 Then
LbExtraRefacturacion.Text = $"<br><b>*{sbExtra.ToString()}</b>"
End If
End If
End If End If
If Vigencia.EsCancelable = "Cancelable sin aceptación" Then If Vigencia.EsCancelable = "Cancelable sin aceptación" Then
@@ -21028,6 +21171,12 @@ Partial Class Ventas
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
'SI ES VENTA NUEVA, ASIGNA LA DEL CLIENTE
If (Me.CveVenta <= 0 OrElse Me.EsCreaApartirDe) AndAlso Me.CveFormaPago33Cliente > 0 Then
DdlFormaPago33.SelectedValueExist(Me.CveFormaPago33Cliente)
End If
'SI ES VENTA EXISTENTE, ASIGNA LA GUARDADA
If Me.CveVenta > 0 AndAlso (Not Me.EsCreaApartirDe) AndAlso Me.CveFormaPago33Venta > 0 Then If Me.CveVenta > 0 AndAlso (Not Me.EsCreaApartirDe) AndAlso Me.CveFormaPago33Venta > 0 Then
DdlFormaPago33.SelectedValueExist(Me.CveFormaPago33Venta) DdlFormaPago33.SelectedValueExist(Me.CveFormaPago33Venta)
End If End If
@@ -21059,6 +21208,11 @@ Partial Class Ventas
End If End If
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
'SI ES VENTA NUEVA, ASIGNA LA DEL CLIENTE
If (Me.CveVenta <= 0 OrElse Me.EsCreaApartirDe) AndAlso Me.CveFormaPago33Cliente > 0 Then
DdlFormaPago33.SelectedValueExist(Me.CveFormaPago33Cliente)
End If
'SI ES VENTA EXISTENTE, ASIGNA LA GUARDADA
If Me.CveVenta > 0 AndAlso (Not Me.EsCreaApartirDe) AndAlso (Not Me.ModalidadEdicion) AndAlso Me.CveFormaPago33Venta > 0 Then If Me.CveVenta > 0 AndAlso (Not Me.EsCreaApartirDe) AndAlso (Not Me.ModalidadEdicion) AndAlso Me.CveFormaPago33Venta > 0 Then
DdlFormaPago33.SelectedValueExist(Me.CveFormaPago33Venta) DdlFormaPago33.SelectedValueExist(Me.CveFormaPago33Venta)
End If End If
@@ -22830,86 +22984,107 @@ Partial Class Ventas
#Region "Cancelar, Generar y mandar por correo el acuse de cancelación." #Region "Cancelar, Generar y mandar por correo el acuse de cancelación."
Private Sub BtnEnviarMailCancelacion_Click(sender As Object, e As EventArgs) Handles BtnEnviarMailCancelacion.Click Private Sub BtnEnviarMailCancelacion_Click(sender As Object, e As EventArgs) Handles BtnEnviarMailCancelacion.Click
ImprimeCancelacion(CveVenta) EnviarPDFCancelacion(HdnCveVentaAcuse.Value.ToEntero())
HdnCveVentaAcuse.Value = "0"
End Sub End Sub
Public Sub ImprimeCancelacion(CveVenta As Integer) Private Function DescargarPDF(Parametros As String) As Byte()
Dim ObjVentas As New ClsVentas Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", ClsPaginas.UrlSitio, Parametros))
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then Dim File As Byte() = Nothing
Dim drv As DataRow = ObjVentas.DtResultados.Rows(0) Try
Dim FolioFiscal = drv("FolioFiscal").ToString() Using httpClient = New HttpClient()
Dim SelloCancelacion = drv("SelloCancelacion").ToString() httpClient.Timeout = New TimeSpan(0, 15, 0)
Dim FechaCancelacion = drv("FechaCancelacion").ToString().ToDateTime.ToString("dd/MM/yyyy HH:mm:ss") Using request = New HttpRequestMessage(HttpMethod.Get, Url)
Dim RFC = UsuarioActual.Empresa.RFC request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO={2}", UsuarioActual.CveEmpresa, DateTime.UtcNow.Ticks, UsuarioActual.CveUsuario)))
Dim Archivo As New System.IO.FileInfo("Empresas\Grales\Formatos\AcuseCancelacion.rdlc") Dim response = httpClient.SendAsync(request).Result
Dim params As New List(Of ReportParameter) If response.StatusCode = Net.HttpStatusCode.OK Then
params.Add(New ReportParameter("FechaCancelacion", FechaCancelacion.ToString())) File = response.Content.ReadAsByteArrayAsync().Result
params.Add(New ReportParameter("FolioFiscal", FolioFiscal)) End If
params.Add(New ReportParameter("RFCEmisor", RFC)) End Using
params.Add(New ReportParameter("SelloCancelacion", SelloCancelacion)) End Using
Catch ex As Exception
File = Nothing
OnError("Ocurrió un error al descargar la factura", ex)
End Try
Dim ObjetoPDF As Byte() = StreamPDF("Empresas\Grales\Formatos\AcuseCancelacion.rdlc", ObjVentas.DtResultados, params, "AcuseCancelacion" & CveVenta) Return File
Dim ObjMail As New ClsSisMail End Function
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) Public Sub EnviarPDFCancelacion(CveVenta As Integer)
Dim Asunto As String = String.Empty
Dim Cuerpo As String = String.Empty Dim FacturaRef As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa)
Dim ResultadoMail As Integer
Dim sb As New StringBuilder() If FacturaRef IsNot Nothing Then
If UsuarioActual.CveEmpresa = 119 Then Dim ObjetoPDF As Byte() = DescargarPDF(Encripta(String.Format("OP=CAN&CVEVTA={0}", CveVenta)))
sb.Append("<!DOCTYPE html>")
sb.Append("<html>") If ObjetoPDF IsNot Nothing Then
sb.Append("<head>") Dim RFC = UsuarioActual.Empresa.RFC
sb.Append("<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8""/>") Dim ObjMail As New ClsSisMail
sb.Append(" <title>Acuse De Cancelación</title>") Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
sb.Append(" <meta charset=""utf-8"" />") Dim Asunto As String = String.Empty
sb.Append("</head>") Dim Cuerpo As String = String.Empty
sb.Append("<body>") Dim ResultadoMail As Integer
sb.Append(" <font face=""calibri"">") Dim sb As New StringBuilder()
sb.Append($" Estimado Cliente <b>{NombreCliente}</b>,<br /><br />") If UsuarioActual.CveEmpresa = 119 Then
sb.Append($" Le informamos que Agroquímicos JAM, S.A. DE C.V ha cancelado el CFDI <b>{Serie}-{Folio}</b>, el cual ha quedado sin Efectos Fiscales y encontrará adjunto en este correo el Acuse de <br />") sb.Append("<!DOCTYPE html>")
sb.Append($" cancelación del SAT.<br />") sb.Append("<html>")
sb.Append(" POR LO QUE PEDIMOS ELIMINARLO Y NO INCLUIRLO EN SU CONTABILIDAD, YA QUE PUEDE REPRESENTAR UN PROBLEMA FISCAL PARA USTED O SU EMPRESA CUANDO EL SAT REALICE UNA FUTURA AUDITORIA <br /> ") sb.Append("<head>")
sb.Append(" EN SU CONTABILIDAD. </font> ") sb.Append("<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8""/>")
sb.Append(" <font face=""calibri"" size=""2"">") sb.Append(" <title>Acuse De Cancelación</title>")
sb.Append(" <br /><br /><br /><br /><br />") sb.Append(" <meta charset=""utf-8"" />")
sb.Append(" <i>Este correo se generó automaticamente, favor de no responder este mensaje.</i>") sb.Append("</head>")
sb.Append(" </font>") sb.Append("<body>")
sb.Append("</body>") sb.Append(" <font face=""calibri"">")
sb.Append("</html>") sb.Append($" Estimado Cliente <b>{FacturaRef.Cliente.Nombre}</b>,<br /><br />")
Else sb.Append($" Le informamos que Agroquímicos JAM, S.A. DE C.V ha cancelado el CFDI <b>{FacturaRef.SerieFolio}</b>, el cual ha quedado sin Efectos Fiscales y encontrará adjunto en este correo el Acuse de <br />")
sb.Append("<!DOCTYPE html>") sb.Append($" cancelación del SAT.<br />")
sb.Append("<html>") sb.Append(" POR LO QUE PEDIMOS ELIMINARLO Y NO INCLUIRLO EN SU CONTABILIDAD, YA QUE PUEDE REPRESENTAR UN PROBLEMA FISCAL PARA USTED O SU EMPRESA CUANDO EL SAT REALICE UNA FUTURA AUDITORIA <br /> ")
sb.Append("<head>") sb.Append(" EN SU CONTABILIDAD. </font> ")
sb.Append("<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8""/>") sb.Append(" <font face=""calibri"" size=""2"">")
sb.Append(" <title>Acuse De Cancelación</title>") sb.Append(" <br /><br /><br /><br /><br />")
sb.Append(" <meta charset=""utf-8"" />") sb.Append(" <i>Este correo se generó automaticamente, favor de no responder este mensaje.</i>")
sb.Append("</head>") sb.Append(" </font>")
sb.Append("<body>") sb.Append("</body>")
sb.Append(" <font face=""calibri"">") sb.Append("</html>")
sb.Append($" Estimado Cliente <b>{NombreCliente}</b>,<br /><br />") Else
sb.Append($" A través del presente medio la Empresa <b>{UsuarioActual.Empresa.Empresa} - {RFC}</b>, canceló el documento tipo <b>{DdlTipoComprobante.SelectedItem.Text}</b> <br />") sb.Append("<!DOCTYPE html>")
sb.Append($" con folio <b>{Serie}-{Folio}</b> y el Importe de <b>${TxtTotal.Text}</b>. <br /><br />") sb.Append("<html>")
sb.Append(" Le hacemos llegar el acuse de cancelación. </font> ") sb.Append("<head>")
sb.Append(" <font face=""calibri"" size=""2"">") sb.Append("<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8""/>")
sb.Append(" <br /><br /><br /><br /><br />") sb.Append(" <title>Acuse De Cancelación</title>")
sb.Append(" <i>Este correo se generó automaticamente, favor de no responder este mensaje.</i>") sb.Append(" <meta charset=""utf-8"" />")
sb.Append(" </font>") sb.Append("</head>")
sb.Append("</body>") sb.Append("<body>")
sb.Append("</html>") sb.Append(" <font face=""calibri"">")
sb.Append($" Estimado Cliente <b>{FacturaRef.Cliente.Nombre}</b>,<br /><br />")
sb.Append($" A través del presente medio la Empresa <b>{UsuarioActual.Empresa.Empresa} - {RFC}</b>, canceló el documento tipo <b>{FacturaRef.TipodeComprobante}</b> <br />")
sb.Append($" con folio <b>{FacturaRef.SerieFolio}</b> y el Importe de <b>${FacturaRef.Total}</b>. <br /><br />")
sb.Append(" Le hacemos llegar el acuse de cancelación. </font> ")
sb.Append(" <font face=""calibri"" size=""2"">")
sb.Append(" <br /><br /><br /><br /><br />")
sb.Append(" <i>Este correo se generó automaticamente, favor de no responder este mensaje.</i>")
sb.Append(" </font>")
sb.Append("</body>")
sb.Append("</html>")
End If
Asunto = $"Acuse de Cancelación {FacturaRef.SerieFolio}"
Cuerpo = sb.ToString()
Dim DisplayName As String = ""
If UsuarioActual.CveEmpresa = 119 Then DisplayName = "Facturación Agroquímicos JAM"
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = ObjetoPDF, .NombreArchivo = $"AcuseCancelacion{FacturaRef.SerieFolio}.pdf"})
If ObjMail.SendMail(EmpresaActual, Mail, Asunto, Cuerpo, MailCC, LSRutasMail, Displayname:=DisplayName) Then
ResultadoMail = 1
Alert("El acuse de cancelación ha sido envíado correctamente.", JSBtnAceptar:="BtnRefrescarPagina();", ShowCloseButton:=False)
Else
ResultadoMail = 0
End If
sb.Clear()
FacturaRef.Dispose()
FacturaRef = Nothing
End If End If
Asunto = $"Acuse de Cancelacion {Serie}-{Folio}" Else
Cuerpo = sb.ToString() Alert("No se pudo enviar el acuse de cancelación", TipoMensaje.MsgAdvertencia)
Dim DisplayName As String = ""
If UsuarioActual.CveEmpresa = 119 Then DisplayName = "Facturación Agroquímicos JAM"
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = ObjetoPDF, .NombreArchivo = $"AcuseCancelacion{Serie}-{Folio}.pdf"})
If ObjMail.SendMail(EmpresaActual, Mail, Asunto, Cuerpo, MailCC, LSRutasMail, Displayname:=DisplayName) Then
ResultadoMail = 1
Alert("El acuse de cancelación ha sido envíado correctamente.", JSBtnAceptar:="BtnRefrescarPagina();")
Else
ResultadoMail = 0
End If
sb.Clear()
End If End If
ObjVentas.Dispose()
End Sub End Sub
Private Sub MostrarCondicionesCancelacion(Optional Extra As String = "") Private Sub MostrarCondicionesCancelacion(Optional Extra As String = "")
@@ -22936,11 +23111,6 @@ Partial Class Ventas
Private Sub LbCancelarDocumento_Click(sender As Object, e As EventArgs) Handles LbCancelarDocumento.Click Private Sub LbCancelarDocumento_Click(sender As Object, e As EventArgs) Handles LbCancelarDocumento.Click
'If VentaSaldoAlmacen <> 0 Then
' Alert("El pedido no se puede cancelar ya que tiene movimientos de almacén.<br/>Nota: Primero hay que hacer la devolución al almacén", TipoMensaje.MsgAdvertencia)
'Else
'End If
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
Dim sb As New StringBuilder() Dim sb As New StringBuilder()
@@ -22989,50 +23159,55 @@ Partial Class Ventas
Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion) Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion)
If Relacionados IsNot Nothing Then If Relacionados IsNot Nothing Then
sbExtra.Append(Relacionados.Mensaje) If Relacionados.Codigo = 500 Then
sbExtra.Append("El servicio de verificación de documentos relacionados no esta disponible.")
Else
sbExtra.Append(Relacionados.Mensaje)
Dim SbHijos = New StringBuilder() Dim SbHijos = New StringBuilder()
Dim SbPadres = New StringBuilder() Dim SbPadres = New StringBuilder()
If Relacionados.RelacionadosHijo IsNot Nothing Then 'If Relacionados.RelacionadosHijo IsNot Nothing Then
For Each hijo In Relacionados.RelacionadosHijo ' For Each hijo In Relacionados.RelacionadosHijo
SbHijos.AppendFormat("{0};", hijo.Uuid) ' SbHijos.AppendFormat("{0};", hijo.Uuid)
Next ' Next
If SbHijos.Length > 0 Then ' If SbHijos.Length > 0 Then
SbHijos.Remove(SbHijos.Length - 1, 1) ' SbHijos.Remove(SbHijos.Length - 1, 1)
End If ' End If
End If 'End If
If Relacionados.RelacionadosPadre IsNot Nothing Then If Relacionados.RelacionadosPadre IsNot Nothing Then
For Each padre In Relacionados.RelacionadosPadre For Each padre In Relacionados.RelacionadosPadre
SbPadres.AppendFormat("{0};", padre.Uuid) SbPadres.AppendFormat("{0};", padre.Uuid)
Next Next
If SbPadres.Length > 0 Then If SbPadres.Length > 0 Then
SbPadres.Remove(SbPadres.Length - 1, 1) SbPadres.Remove(SbPadres.Length - 1, 1)
End If
End If
Using ObjVentas As New ClsVentas
If SbHijos.Length > 0 Then
If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbHijos.ToString(), UsuarioActual.CveEmpresa) Then
GvFacturasHijosCancelar.DataSource = ObjVentas.DtResultados.Copy()
End If End If
End If End If
If SbPadres.Length > 0 Then Using ObjVentas As New ClsVentas
If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbPadres.ToString(), UsuarioActual.CveEmpresa) Then
GvFacturasPadreCancelar.DataSource = ObjVentas.DtResultados.Copy() 'If SbHijos.Length > 0 Then
' If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbHijos.ToString(), UsuarioActual.CveEmpresa) Then
' GvFacturasHijosCancelar.DataSource = ObjVentas.DtResultados.Copy()
' End If
'End If
If SbPadres.Length > 0 Then
If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbPadres.ToString(), UsuarioActual.CveEmpresa) Then
GvFacturasPadreCancelar.DataSource = ObjVentas.DtResultados.FiltraParametros($"CveVenta <> {CveVenta}")
End If
End If End If
End If
End Using End Using
GvFacturasHijosCancelar.DataBind() 'GvFacturasHijosCancelar.DataBind()
GvFacturasPadreCancelar.DataBind() GvFacturasPadreCancelar.DataBind()
End If
End If End If
End If End If
If String.IsNullOrEmpty(Vigencia.EsCancelable) Then If String.IsNullOrEmpty(Vigencia.EsCancelable) Then
If UsuarioActual.Empresa.FacturaProduccion AndAlso Not String.IsNullOrEmpty(FolioFiscal) Then If UsuarioActual.Empresa.FacturaProduccion AndAlso Not String.IsNullOrEmpty(FolioFiscal) Then
Alert("No se pudo encontrar el estatus de la factura en el SAT.", TipoMensaje.MsgAdvertencia) Alert("No se pudo encontrar el estatus de la factura en el SAT.", TipoMensaje.MsgAdvertencia)
@@ -23258,7 +23433,7 @@ Partial Class Ventas
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();") Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
Else Else
If resp.CveEstatus = 5 AndAlso Not EsRefacturacion Then If resp.CveEstatus = 5 AndAlso Not EsRefacturacion Then
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnEnviarMailCancelacion();", TextoConfirmacion:="&nbsp;&nbsp;&nbsp;&nbsp;Si&nbsp;&nbsp;&nbsp;&nbsp;", TextoCancelacion:="&nbsp;&nbsp;&nbsp;&nbsp;<a onclick='Recargar()'>No</>&nbsp;&nbsp;&nbsp;&nbsp;") Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:=$"BtnEnviarMailCancelacion({CveVenta});", TextoConfirmacion:="&nbsp;&nbsp;&nbsp;&nbsp;Si&nbsp;&nbsp;&nbsp;&nbsp;", TextoCancelacion:="&nbsp;&nbsp;&nbsp;&nbsp;<a onclick='Recargar()'>No</>&nbsp;&nbsp;&nbsp;&nbsp;")
Else Else
If EsRefacturacion Then If EsRefacturacion Then
If resp.CveEstatus = 20 Then If resp.CveEstatus = 20 Then
@@ -25896,7 +26071,10 @@ Partial Class Ventas
'sino tiene el permiso de peude generar NC 'sino tiene el permiso de peude generar NC
If Not UsuarioActual.TienePermisoProceso(175) Then If Not UsuarioActual.TienePermisoProceso(175) Then
Exit Sub 'sino tiene el permiso de peude generar NC no directas, solo relacionadas por proceso
If Not UsuarioActual.TienePermisoProceso(334) Then 'sino tiene el 175 y tampoco el 334, que se salga
Exit Sub
End If
End If End If
AplicaNCMasiva = True AplicaNCMasiva = True
@@ -26772,7 +26950,7 @@ Partial Class Ventas
CveVentaUsadoDevolucionEfectivo = -1 CveVentaUsadoDevolucionEfectivo = -1
DdlTipoComprobante.SelectedValue = "Egs" DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos")
Dim AplicaImpuestosLocales As Boolean = False Dim AplicaImpuestosLocales As Boolean = False
'Dim ObjCliente As New ClsClientes 'Dim ObjCliente As New ClsClientes
@@ -30795,6 +30973,11 @@ Partial Class Ventas
TxtFolio.Text = FolioFijo.ToString() TxtFolio.Text = FolioFijo.ToString()
End If End If
If EstablecioFolio AndAlso UsuarioActual.CveEmpresa = 140 Then ' CÓDIGO TEMPORAL 2022/01/17
FolioFijo = TxtFolio.Text.ToEntero()
ViewState("FolioActual") = FolioFijo
End If
Dim TipoDoctoViejo As String = DdlTipoComprobante.SelectedValue Dim TipoDoctoViejo As String = DdlTipoComprobante.SelectedValue
DdlTipoComprobante.SelectedValue = TipoDoctoNuevo DdlTipoComprobante.SelectedValue = TipoDoctoNuevo
TxtFecha.Text = Now.ToString() TxtFecha.Text = Now.ToString()
@@ -31841,6 +32024,10 @@ Partial Class Ventas
End Sub End Sub
Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura) Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura)
Try Try
If UsuarioActual.CveUsuario.Contiene(3033, 3491) Then
Exit Sub
End If
'TipoPoliza: 01 Venta, 02 Ajuste, 03 Garantía 'TipoPoliza: 01 Venta, 02 Ajuste, 03 Garantía
Dim TipoPoliza As Integer = 0 Dim TipoPoliza As Integer = 0
For Each Row As GridViewRow In GvCodigosUnicos.Rows For Each Row As GridViewRow In GvCodigosUnicos.Rows