diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb
index 3672bca91..a382bb7e6 100644
--- a/App_Code/ClsMovimientos.vb
+++ b/App_Code/ClsMovimientos.vb
@@ -1437,7 +1437,7 @@ Public Class ClsMovimientos
Optional EstatusCliente As Integer = -1, Optional CveUsuarioConsulta As Integer = -1,
Optional CveBanco As Integer = -1, Optional CveCuenta As Integer = -1,
Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = 0, Optional CveClienteClasificacion As Integer = -1,
- Optional EsDistribuidor As Integer = -1, Optional FechaAplicadoI As Date = Nothing, Optional FechaAplicadoF As Date = Nothing) As Boolean
+ Optional EsDistribuidor As Integer = -1, Optional FechaAplicadoI As Date = MinFecha, Optional FechaAplicadoF As Date = MaxFecha) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_RepRecuperacion")
With SqlAdapter.SelectCommand.Parameters
diff --git a/Bancos/DepositosCaja.aspx b/Bancos/DepositosCaja.aspx
index adbf00f56..ceae430b7 100644
--- a/Bancos/DepositosCaja.aspx
+++ b/Bancos/DepositosCaja.aspx
@@ -140,43 +140,62 @@
-
-
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -295,6 +314,26 @@
debugger;
} else {
+ //debugger;
+ }
+ }
+ var txtcomision = ToDouble($('#C_TxtIVA').val());
+ if (txtcomision != 0) {
+ var comisionNegativa = 0;
+ if (txtcomision < 0) {
+ comisionNegativa = txtcomision * -1;
+ }
+ if (comisionNegativa > saldo) {
+ $('#C_TxtIVA').val(0);
+ comision = 0;
+ descuento = 0;
+ txtcomision = 0;
+ alert("No es posible poner un importe IVA superior a lo seleccionado");
+ saldo = 0;
+ $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2));
+ debugger;
+ } else {
+
//debugger;
}
}
@@ -351,7 +390,25 @@
}
if (comisionNegativa > ValorTotalSeleccionado) {
$('#C_TxtDescuento').val(descuento)
- alert("No es posible poner una comision superior a lo seleccionado")
+ alert("No es posible poner un descuento superior a lo seleccionado")
+ } else {
+ saldo = ValorTotalSeleccionado + comision2 + comision;
+ $('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
+ descuento = ToDouble($('#C_TxtDescuento').val())
+ }
+
+ }
+
+
+ function txtSumaIVA(txt) {
+ var comision2 = ToDouble($('#C_TxtIVA').val());
+ var comisionNegativa = 0;
+ if (comision2 < 0) {
+ comisionNegativa = comision2 * -1;
+ }
+ if (comisionNegativa > ValorTotalSeleccionado) {
+ $('#C_TxtIVA').val(descuento)
+ alert("No es posible poner un IVA superior a lo seleccionado")
} else {
saldo = ValorTotalSeleccionado + comision2 + comision;
$('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
@@ -367,12 +424,16 @@
$('#divSubProyecto').css("display", "block");
$('#LblClasificacion').css("display", "block");
$('#divClasificacion').css("display", "block");
+ $('#DivIVA').css("display", "block");
+
} else {
$('#DivComision').css("display", "none");
$('#LblSubproyecto').css("display", "none");
$('#divSubProyecto').css("display", "none");
$('#LblClasificacion').css("display", "none");
$('#divClasificacion').css("display", "none");
+ $('#DivIVA').css("display", "none");
+
}
}
diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb
index ef5e7ca4e..a0f7165c5 100644
--- a/Bancos/DepositosCaja.aspx.vb
+++ b/Bancos/DepositosCaja.aspx.vb
@@ -23,6 +23,8 @@ Partial Class Bancos_DepositosCaja
txtFechaF.Text = Now.ToShortDateString
TxtComision.Attributes.Add("onKeyUp", "txtSuma(event);")
TxtDescuento.Attributes.Add("onKeyUp", "txtSumaDescuento(event);")
+ TxtIVA.Attributes.Add("onKeyUp", "txtSumaIVA(event);")
+
CargaCuentas()
ChkFaltante.Attributes.Add("onclick", "CheckFaltante(this);")
@@ -88,6 +90,7 @@ Partial Class Bancos_DepositosCaja
Dim TotalImportePrePoliza As Decimal
Dim Comision As Decimal = TxtComision.Text.ToDecimal
Dim Descuento As Decimal = TxtDescuento.Text.ToDecimal
+ Dim IVA As Decimal = TxtIVA.Text.ToDecimal
For Each Gvr As GridViewRow In GvFacturas.Rows
@@ -101,7 +104,7 @@ Partial Class Bancos_DepositosCaja
TotalImportePrePoliza = TotalImporte
If Comision <> 0 Then
- TotalImporte = TotalImporte + Comision + Descuento
+ TotalImporte = TotalImporte + Comision + Descuento + IVA
'Comision = -(Comision) ' se inverte el valor, va cargada
'Descuento = -(Descuento) ' se inverte el valor, va cargada
If DdlSubProyectoDeposito.SelectedValue.ToEntero = -1 Or DdlClasificacion.SelectedValue.ToEntero = -1 Then
@@ -166,6 +169,10 @@ Partial Class Bancos_DepositosCaja
If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Comision, DdlClasificacion.SelectedItem.Text, 51, DdlClasificacion.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, ImporteMX:=Comision * TipoCambio, CveCuenta:=CveCuentaBancariaOrigen) Then
OcurrioError = True
End If
+
+ If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, IVA, DdlClasificacion.SelectedItem.Text, 14, DdlClasificacion.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, ImporteMX:=Comision * TipoCambio, CveCuenta:=CveCuentaBancariaOrigen) Then
+ OcurrioError = True
+ End If
End If
If ChkDescuento.Checked Then
diff --git a/Compras/PopUpBuscarProveedor.aspx b/Compras/PopUpBuscarProveedor.aspx
index a32e1d000..9189373be 100644
--- a/Compras/PopUpBuscarProveedor.aspx
+++ b/Compras/PopUpBuscarProveedor.aspx
@@ -136,10 +136,15 @@
if (document.getElementById("hdnEsThickbox").value == "S") {
parent.CargaProveedor(c);
parent.tb_remove();
+ window.close();
+ parent.$('#ajax').modal('hide');
+
}
else {
window.opener.CargaProveedor(c);
window.close();
+ parent.$('#ajax').modal('hide');
+
}
}
function IrOI(c) {
diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb
index 8792861e6..7b4c0ec8f 100644
--- a/Contabilidad/RegPrePoliza.aspx.vb
+++ b/Contabilidad/RegPrePoliza.aspx.vb
@@ -1984,6 +1984,7 @@ Partial Class ContabilidadC_RegPrePoliza
Response.Flush() ' send it to the client to download
HttpContext.Current.Response.SuppressContent = True
HttpContext.Current.ApplicationInstance.CompleteRequest()
+ Response.End()
End If
result = True
diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx
index 1bc7203c1..5ad61e4f2 100644
--- a/Contabilidad/RegPrePolizaS.aspx
+++ b/Contabilidad/RegPrePolizaS.aspx
@@ -67,8 +67,7 @@
-
-
+
Cargar Excel
@@ -79,12 +78,7 @@
Imprimir Poliza
-
-
-
-
-
-
+
diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb
index 50e7e9ff7..f57d79354 100644
--- a/Contabilidad/RegPrePolizaS.aspx.vb
+++ b/Contabilidad/RegPrePolizaS.aspx.vb
@@ -201,6 +201,8 @@ Partial Class ContabilidadC_RegPrePolizaS
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
+ Tick = DateTime.Now.Ticks.ToString
+
CveMoneda = 1
ViewState("CvePrePoliza") = 0
ViewState("CvePeriodo") = "0"
@@ -439,6 +441,7 @@ Partial Class ContabilidadC_RegPrePolizaS
If dr("IdPoliza").ToString.ToEntero > 0 Then
HplContabilizada.NavigateUrl = String.Format("RegPoliza.aspx?IdPoliza={0}", dr("IdPoliza"))
divContabilizada.Visible = True
+ IdPoliza = dr("IdPoliza").ToString.ToEntero
ElseIf TxtTotalCargos.Text.ToDouble = TxtTotalAbonos.Text.ToDouble Then
'sino está contabilizada, se activa el botón
BtnContabilizar.Visible = True
@@ -515,7 +518,6 @@ Partial Class ContabilidadC_RegPrePolizaS
If CveConceptoContable.Contiene(30) Then
LnkImprimirPDF.Visible = True
- LnkComprobante.Visible = True
CveIE = e.Row.DBCampo("CveIE").ToString.ToEntero
End If
@@ -2131,6 +2133,7 @@ Partial Class ContabilidadC_RegPrePolizaS
Response.Flush() ' send it to the client to download
HttpContext.Current.Response.SuppressContent = True
HttpContext.Current.ApplicationInstance.CompleteRequest()
+ Response.End()
End If
result = True
diff --git a/Inventarios/Kardex.aspx.vb b/Inventarios/Kardex.aspx.vb
index e05724fe4..ac69f6856 100644
--- a/Inventarios/Kardex.aspx.vb
+++ b/Inventarios/Kardex.aspx.vb
@@ -369,15 +369,19 @@ Partial Class Inventarios_Kardex
Private Sub Imprimir(Optional reporte As String = "PDF")
Dim DtKardex As DataTable = Nothing
- DtKardex = CargarKardex(ddlProducto2.SelectedValue.ToEntero)
- If (Not IsNothing(DtKardex)) Then
- Dim params As New List(Of ReportParameter)
- If IO.File.Exists(String.Format("{0}/Formatos/Kardex.rdlc", UsuarioActual.Empresa.Ruta)) Then
- ImprimirPDF(String.Format("Empresas/{0}/Formatos/Kardex.rdlc", UsuarioActual.CveEmpresa), DtKardex, params, "ReporteKardex", reporte)
- Else
- ImprimirPDF("Empresas/Grales/Formatos/Kardex.rdlc", DtKardex, params, "Reporte Kardex", reporte)
+ If ddlProducto2.SelectedValue.ToEntero > 0 Then
+ DtKardex = CargarKardex(ddlProducto2.SelectedValue.ToEntero)
+ If (Not IsNothing(DtKardex)) Then
+ Dim params As New List(Of ReportParameter)
+ If IO.File.Exists(String.Format("{0}/Formatos/Kardex.rdlc", UsuarioActual.Empresa.Ruta)) Then
+ ImprimirPDF(String.Format("Empresas/{0}/Formatos/Kardex.rdlc", UsuarioActual.CveEmpresa), DtKardex, params, "ReporteKardex", reporte)
+ Else
+ ImprimirPDF("Empresas/Grales/Formatos/Kardex.rdlc", DtKardex, params, "Reporte Kardex", reporte)
+ End If
+ DtKardex.Dispose()
End If
- DtKardex.Dispose()
+ Else
+ Alert("No hay informacion cargada", TipoMensaje.MsgAdvertencia)
End If
End Sub
@@ -385,61 +389,65 @@ Partial Class Inventarios_Kardex
GenerarPDF()
End Sub
Private Sub GenerarPDF(Optional Formato As String = "PDF")
- Dim Movimientos As New ClsInventarios
- Dim CvePS As Integer = ddlProducto2.SelectedValue.ToEntero
- Dim Entrada As Boolean = cbEntrada.Checked
- Dim Salida As Boolean = cbSalida.Checked
+ If ddlProducto2.SelectedValue.ToEntero > 0 Then
+ Dim Movimientos As New ClsInventarios
+ Dim CvePS As Integer = ddlProducto2.SelectedValue.ToEntero
+ Dim Entrada As Boolean = cbEntrada.Checked
+ Dim Salida As Boolean = cbSalida.Checked
- Dim FechaI As String = If(TxtFechaI.Text <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text, "-1")
- Dim FechaF As String = If(TxtFechaF.Text <> "" AndAlso TxtFechaF.Text <> "__/__/____", TxtFechaF.Text, "-1")
- Dim CveAlmacen As Integer = ddlAlmacen.SelectedValue.ToEntero
+ Dim FechaI As String = If(TxtFechaI.Text <> "" AndAlso TxtFechaI.Text <> "__/__/____", TxtFechaI.Text, "-1")
+ Dim FechaF As String = If(TxtFechaF.Text <> "" AndAlso TxtFechaF.Text <> "__/__/____", TxtFechaF.Text, "-1")
+ Dim CveAlmacen As Integer = ddlAlmacen.SelectedValue.ToEntero
- Dim Almacen = If(ddlAlmacen.SelectedValue = "-1", "", $" Almacén: {ddlAlmacen.SelectedItem.Text}")
- Dim UM = If(DdlUnidadMedida.SelectedValue = "-1", "", $" Unidad de Medida: {DdlUnidadMedida.SelectedItem.Text}")
- Dim FechaIn As String = If(TxtFechaI.Text = "", "", $" Fecha Inicio: {TxtFechaI.Text}")
- Dim FechaFn As String = If(TxtFechaF.Text = "", "", $" Fecha Fin: {TxtFechaF.Text}")
- Dim EntradaSalida As String = ""
+ Dim Almacen = If(ddlAlmacen.SelectedValue = "-1", "", $" Almacén: {ddlAlmacen.SelectedItem.Text}")
+ Dim UM = If(DdlUnidadMedida.SelectedValue = "-1", "", $" Unidad de Medida: {DdlUnidadMedida.SelectedItem.Text}")
+ Dim FechaIn As String = If(TxtFechaI.Text = "", "", $" Fecha Inicio: {TxtFechaI.Text}")
+ Dim FechaFn As String = If(TxtFechaF.Text = "", "", $" Fecha Fin: {TxtFechaF.Text}")
+ Dim EntradaSalida As String = ""
- If cbEntrada.Checked And cbSalida.Checked Then
- EntradaSalida = " Entradas y Salidas"
- ElseIf cbEntrada.Checked And cbSalida.Checked = False Then
- EntradaSalida = " Solo Entradas"
- ElseIf cbEntrada.Checked = False And cbSalida.Checked Then
- EntradaSalida = " Solo Salidas"
- End If
+ If cbEntrada.Checked And cbSalida.Checked Then
+ EntradaSalida = " Entradas y Salidas"
+ ElseIf cbEntrada.Checked And cbSalida.Checked = False Then
+ EntradaSalida = " Solo Entradas"
+ ElseIf cbEntrada.Checked = False And cbSalida.Checked Then
+ EntradaSalida = " Solo Salidas"
+ End If
- Dim CveTiposAlmacen = ""
- For Each item As ListItem In CBLTiposAlmacen.Items
- CveTiposAlmacen += If(item.Selected, $"{item.Value},", "")
- Next
+ Dim CveTiposAlmacen = ""
+ For Each item As ListItem In CBLTiposAlmacen.Items
+ CveTiposAlmacen += If(item.Selected, $"{item.Value},", "")
+ Next
- Dim Serie As String = If(TxtSerie.Text <> "", TxtSerie.Text, "-1")
+ Dim Serie As String = If(TxtSerie.Text <> "", TxtSerie.Text, "-1")
- Dim SerieAgrupado As String = If(TxtSerie.Text = "", "", $"Existencia y costos calculada por numero de serie: {TxtSerie.Text} ")
+ Dim SerieAgrupado As String = If(TxtSerie.Text = "", "", $"Existencia y costos calculada por numero de serie: {TxtSerie.Text} ")
- If Movimientos.GetKardex(Entrada, Salida, CvePS, FechaI, FechaF, CveAlmacen, CveTiposAlmacen.Substring(0, CveTiposAlmacen.Length - 1), DdlUnidadMedida.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, ChkAgruparAlmacen.Checked, Serie) Then
+ If Movimientos.GetKardex(Entrada, Salida, CvePS, FechaI, FechaF, CveAlmacen, CveTiposAlmacen.Substring(0, CveTiposAlmacen.Length - 1), DdlUnidadMedida.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, ChkAgruparAlmacen.Checked, Serie) Then
- Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
- Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
- Dim dt As DataTable = Movimientos.DtResultados
- Dim params As New List(Of ReportParameter)
- params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
- params.Add(New ReportParameter("FechaInicio", FechaI))
- params.Add(New ReportParameter("FechaFin", FechaF))
- params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
- params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
- params.Add(New ReportParameter("Producto", ddlProducto2.SelectedText))
- params.Add(New ReportParameter("AgrupadoPor", $"Agrupado Por: {SerieAgrupado}{EntradaSalida}{Almacen}{UM}{FechaIn}{FechaFn}"))
+ Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
+ Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
+ Dim dt As DataTable = Movimientos.DtResultados
+ Dim params As New List(Of ReportParameter)
+ params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
+ params.Add(New ReportParameter("FechaInicio", FechaI))
+ params.Add(New ReportParameter("FechaFin", FechaF))
+ params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
+ params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
+ params.Add(New ReportParameter("Producto", ddlProducto2.SelectedText))
+ params.Add(New ReportParameter("AgrupadoPor", $"Agrupado Por: {SerieAgrupado}{EntradaSalida}{Almacen}{UM}{FechaIn}{FechaFn}"))
- If Imagen.Exists Then
- params.Add(New ReportParameter("LogoPath", logouri))
+ If Imagen.Exists Then
+ params.Add(New ReportParameter("LogoPath", logouri))
+ Else
+ params.Add(New ReportParameter("LogoPath", ""))
+ End If
+ ImprimirPDF("Empresas/Grales/Formatos/RepKardex.rdlc", dt, params, "ReporteKardex", Formato)
Else
- params.Add(New ReportParameter("LogoPath", ""))
+ Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If
- ImprimirPDF("Empresas/Grales/Formatos/RepKardex.rdlc", dt, params, "ReporteKardex", Formato)
Else
- Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
+ Alert("Debes seleccionar un Producto/Servicio", TipoMensaje.MsgAdvertencia)
End If
End Sub
@@ -450,7 +458,7 @@ Partial Class Inventarios_Kardex
Protected Sub LnkEditarFecha_Click(sender As Object, e As EventArgs)
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
CveMovimiento = gvRow.DataKey("CveMovimiento").ToEntero
- TxtFecha.Text = gvRow.DataKey("FechaMovto").ToDateTime.ToString("yyyy-MM-ddTHH:mm")
+ TxtFecha.Text = gvRow.DataKey("FechaMovto").ToDateTime.ToString("yyyy-MM-ddTHH: mm")
RegistraScript("$('#DModalEditarFecha').modal()")
UpModalEditarFecha.Update()
End Sub
diff --git a/Sistemas/PopUpAddUsuario.aspx.vb b/Sistemas/PopUpAddUsuario.aspx.vb
index 04d76c490..f619d911e 100644
--- a/Sistemas/PopUpAddUsuario.aspx.vb
+++ b/Sistemas/PopUpAddUsuario.aspx.vb
@@ -348,25 +348,6 @@ Partial Class Sistemas_PopUpAddUsuario
End If
End If
Next
- For Each Row As GridViewRow In GvModulosApp.Rows
- If Row.DataKey("CveProcesoAcceso") <> "" Then
- 'checo si el permiso que tiene es del rol, de ser así, nada más actualizo los denegados
- If Row.DataKey("Permitir") = "" AndAlso Row.FCCheckBox("ChkDenegar").Checked OrElse Row.DataKey("Permitir") = "0" AndAlso Row.FCCheckBox("ChkDenegar").Checked = False Then
- If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Not Row.FCCheckBox("ChkDenegar").Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
- HuboError = True
- Exit For
- End If
- End If
- Else
- 'permisos que el rol, no le está otorgando, y serán únicos para el usuario
- If Row.DataKey("Permitir") = "" AndAlso Row.FCCheckBox("ChkPermitir").Checked OrElse Row.DataKey("Permitir") = "1" AndAlso Row.FCCheckBox("ChkPermitir").Checked = False Then
- If Not ObjUsuarios.UpdateUsuariosProcesos(CveUsuario, Row.DataKey("CveProceso").ToEntero, Row.FCCheckBox("ChkPermitir").Checked, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
- HuboError = True
- Exit For
- End If
- End If
- End If
- Next
End If
ElseIf CveUsuario > 0 Then
diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb
index 444381642..162abeeab 100644
--- a/Ventas/Clientes.aspx.vb
+++ b/Ventas/Clientes.aspx.vb
@@ -994,7 +994,7 @@ Partial Class Clientes
Private Sub CargaResponsables()
Dim Dt As DataTable = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("True", "Nombre")
- DdlResponsable.DataSource = Dt.FiltraParametros("", "", {"CveUsuario", "Nombre"})
+ DdlResponsable.DataSource = Dt.FiltraParametros("Estatus = 1", "", {"CveUsuario", "Nombre"})
DdlResponsable.DataBind()
DdlResponsable.Items.Insert(0, New ListItem("Seleccione", "-1"))
diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx
index 298cbe993..c5faada5d 100644
--- a/Ventas/Ventas.aspx
+++ b/Ventas/Ventas.aspx
@@ -231,6 +231,10 @@
+
+
+
@@ -6749,6 +6753,83 @@
+ <%--APLICAR REMISIONES DE NC DE DEVOLUCION--%>
+
@@ -8932,23 +9013,23 @@
function showDivAgregarSucursal() {
$('#<%= TxtNombreSucursal.ClientID %>').val('');
- $('#<%= TxtDireccionSucursal.ClientID %>').val('');
- $('#<%= TxtNumExtSucursal.ClientID %>').val('');
- $('#<%= TxtNumIntSucursal.ClientID %>').val('');
- $('#<%= TxtCPSucursal.ClientID %>').val('');
- $('#<%= TxtColoniaSucursal.ClientID %>').val('');
- $('#<%= TxtTelefonoSucursal.ClientID %>').val('');
- $('#<%= TxtCiudadSucursal.ClientID %>').val('');
- $('#<%= TxtLocalidadSucursal.ClientID %>').val('');
- $('#<%= TxtEstadoSucursal.ClientID %>').val('');
- $('#<%= TxtPaisSucursal.ClientID %>').val('');
- $('#<%= TxtCorreoSucursal.ClientID %>').val('');
- $('#divAgregarSucursal').modal();
- }
+ $('#<%= TxtDireccionSucursal.ClientID %>').val('');
+ $('#<%= TxtNumExtSucursal.ClientID %>').val('');
+ $('#<%= TxtNumIntSucursal.ClientID %>').val('');
+ $('#<%= TxtCPSucursal.ClientID %>').val('');
+ $('#<%= TxtColoniaSucursal.ClientID %>').val('');
+ $('#<%= TxtTelefonoSucursal.ClientID %>').val('');
+ $('#<%= TxtCiudadSucursal.ClientID %>').val('');
+ $('#<%= TxtLocalidadSucursal.ClientID %>').val('');
+ $('#<%= TxtEstadoSucursal.ClientID %>').val('');
+ $('#<%= TxtPaisSucursal.ClientID %>').val('');
+ $('#<%= TxtCorreoSucursal.ClientID %>').val('');
+ $('#divAgregarSucursal').modal();
+ }
- function hideDivAgregarSucursal() {
- $('#divAgregarSucursal').modal('hide');
- }
+ function hideDivAgregarSucursal() {
+ $('#divAgregarSucursal').modal('hide');
+ }
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index b681a9e4f..66987729d 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -9403,6 +9403,15 @@ Partial Class Ventas
ObjFactura.CveVentaPadre = DtVentasNC.Rows(0)("CveVenta").ToString().ToEntero()
ObjFactura.SerieFolioPadre = DtVentasNC.Rows(0)("FolioFiscal").ToString()
End If
+
+ If DdlTipoComprobante.SelectedValue = "Dev" AndAlso ListaRemisionesNC IsNot Nothing AndAlso ListaRemisionesNC.Count > 0 Then
+ Dim ObjRNC = ListaRemisionesNC.FirstOrDefault
+ If ObjRNC IsNot Nothing Then
+ ObjFactura.CveVentaPadre = ObjRNC.CveVentaPadre
+ ObjFactura.SerieFolioPadre = ObjRNC.SerieFolioPadre
+ End If
+ End If
+
ObjFactura.CveVendedor = DdlVendedor.SelectedValue.ToEntero()
If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
DdlVendedor.Enabled = False
@@ -24798,6 +24807,11 @@ Partial Class Ventas
AplicaNCMasiva = False
AplicaNC = False
LBNotaCredito.Visible = True
+
+ If UsuarioActual.CveUsuario = 100 Then
+ LnkAplicarRNCDevolucion.Visible = True
+ End If
+
'LkNotaCredito.Visible = False
TxtNCPorcentaje.Attributes.Add("onkeyup", "CalculaImporteNC();")
@@ -24848,6 +24862,9 @@ Partial Class Ventas
AplicaNCMasiva = True
LBNotaCredito.Visible = True
+ If UsuarioActual.CveUsuario = 100 Then
+ LnkAplicarRNCDevolucion.Visible = True
+ End If
'LkNotaCredito.Visible = False
DivGvCxC.Visible = True
CargaCxC()
@@ -25391,6 +25408,12 @@ Partial Class Ventas
End If
End If
End Sub
+ Protected Sub GvRNCDevoluciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRNCDevoluciones.RowDataBound
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
+ e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
+ End If
+ End Sub
Protected Sub GvDescNCBonificaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCBonificaciones.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -25516,26 +25539,31 @@ Partial Class Ventas
End Sub
- Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False, Optional AplicoNCFacturaActual As Boolean = False)
+ Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False, Optional AplicoNCFacturaActual As Boolean = False, Optional TipoDoctoNC As String = "Egs")
Try
Me.AplicaDocumentoNuevoNC = AplicaNuevoDocumento
- Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
- If DrPS Is Nothing Then
- Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
- Exit Sub
- Else
- 'VALIDA CLAVES SAT
- If DrPS("SATClavePS").ToString() = "" Then
- Alert($"El concepto {DrPS("Codigo").ToString()}-{DrPS("PS").ToString()} no cuenta con producto SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
- If DrPS("SATClaveUnidadMedida").ToString() = "" Then
- Alert($"El concepto {DrPS("Codigo").ToString()}-{DrPS("PS").ToString()} no cuenta con Unidad Medida SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
+ Dim DrPS As DataRow = Nothing
+
+ If CvePS > 0 AndAlso TipoDoctoNC = "Egs" Then
+ DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
+ If DrPS Is Nothing Then
+ Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
Exit Sub
+ Else
+ 'VALIDA CLAVES SAT
+ If DrPS("SATClavePS").ToString() = "" Then
+ Alert($"El concepto {DrPS("Codigo").ToString()}-{DrPS("PS").ToString()} no cuenta con producto SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
+ If DrPS("SATClaveUnidadMedida").ToString() = "" Then
+ Alert($"El concepto {DrPS("Codigo").ToString()}-{DrPS("PS").ToString()} no cuenta con Unidad Medida SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
End If
End If
+
If Not AplicaImpuestosLocales Then
If TmpDTImpuestos IsNot Nothing Then
TmpDTImpuestos.Rows.Clear()
@@ -25737,7 +25765,7 @@ Partial Class Ventas
Else
If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta
- DdlTipoComprobante.SelectedValueExist("Egs")
+ DdlTipoComprobante.SelectedValueExist(TipoDoctoNC)
'verifica el total de multiples facturas
Dim Acumulado12 As Decimal = 0
Dim UltimoRenglon As Integer = 1
@@ -25768,7 +25796,10 @@ Partial Class Ventas
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
End If
+ ElseIf TipoDoctoNC = "Dev" Then
+ CrearDTNCDevolucion(ListaRemisionesNC, TmpDT, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
Else
+
For Each Dr As DataRow In DtImpuestos.Rows
Acumulado12 += Dr("ImportePU").ToString().ToDecimal.RoundSQL + Dr("ImporteIVA").ToString().ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString().ToDecimal
If UltimoRenglon = DtImpuestos.Rows.Count Then
@@ -25795,7 +25826,16 @@ Partial Class Ventas
CalculaTotalesVenta(RecalculaImpuestosLocales:=AplicaImpuestosLocales)
TrTipoRelacion.Visible = True
- DdlTiposRelacion.SelectedValueExist("1")
+ If TipoDoctoNC = "Egs" Then
+ DdlTiposRelacion.SelectedValueExist("1")
+ ElseIf TipoDoctoNC = "Dev" Then
+ If DdlTipoComprobante.Items.FindByValue("Dev") Is Nothing Then
+ DdlTipoComprobante.Items.Insert(0, New ListItem("Devolucion", "Dev"))
+ End If
+ DdlTipoComprobante.SelectedValueExist("Dev")
+ DdlTiposRelacion.SelectedValueExist("3")
+ End If
+
DdlSubProyectoDatos.Enabled = False
'condicióon, en la que se verifica que el importe total de aplicación de la nota de crédito sea igual al del total de la nota de crédito, ej. saldo de la factura 1000.01 y la nota de crédito se generó po 1000.00
@@ -25804,6 +25844,7 @@ Partial Class Ventas
If TT > TxtTotal.Text.ToDecimal Then TT = TxtTotal.Text.ToDecimal
CargaNCDT(CveVenta, TT)
End If
+
'verifica el tipo de cambio que se actualice
If DdlMoneda.SelectedValue <> "1" Then
TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString()
@@ -25812,6 +25853,7 @@ Partial Class Ventas
UpPS.Update()
LBNotaCredito.Visible = False
+ LnkAplicarRNCDevolucion.Visible = False
CambiaTipoDocto()
End If
@@ -26160,6 +26202,88 @@ Partial Class Ventas
End If
End Sub
+ Private Sub CrearDTNCDevolucion(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
+ For Each RNC In ListaNC
+ Dim UltimoRenglonRNC As Integer = 1
+ Dim TotalAcumuladoRNC As Decimal = 0
+ Dim Terminar As Boolean = False
+
+ For Each RowRNC As DataRow In RNC.DtDetalle.FiltraParametros("", Orderby:="PU").Rows
+
+ Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=RowRNC("CvePS").ToString().ToEntero()).FiltroPrimero("")
+
+ Dim Cantidad As Decimal = RowRNC("Cantidad").ToString().ToDecimal()
+
+ Dim CvePSCargo As Integer = RowRNC("CvePS").ToString().ToEntero()
+
+ Dim ImportePU = RowRNC("PU").ToString().ToDecimal
+
+ Dim Obs As String = ""
+
+ Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU)
+
+ Dim ImporteIVA = (TotalCalculableImpuestos * RowRNC("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
+ Dim ImporteIEPS = (TotalCalculableImpuestos * RowRNC("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
+ Dim ImporteRetIVA = (TotalCalculableImpuestos * RowRNC("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
+ Dim ImporteRetISR = (TotalCalculableImpuestos * RowRNC("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
+ Dim ImporteTotal = TotalCalculableImpuestos
+
+ TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR).RoundSQL
+
+ 'SI EL IMPORTE ES MAYOR REALIZA EL AJUSTE
+ If TotalAcumuladoRNC > RNC.TotalRemNCAplicado Then
+ Terminar = True
+ 'RESTA LO SUMANDO DEL ACUMULADO
+ TotalAcumuladoRNC -= (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
+
+ Dim Diferencia As Decimal = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
+
+ Dim TotalPartida As Decimal = (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
+
+ Dim PorcentajePorAplicar As Decimal = (Diferencia / TotalPartida)
+
+ Cantidad = Cantidad * PorcentajePorAplicar
+
+ TotalCalculableImpuestos = (Cantidad * ImportePU)
+ ImporteIVA = (TotalCalculableImpuestos * RowRNC("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
+ ImporteIEPS = (TotalCalculableImpuestos * RowRNC("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
+ ImporteRetIVA = (TotalCalculableImpuestos * RowRNC("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
+ ImporteRetISR = (TotalCalculableImpuestos * RowRNC("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
+
+ ImporteTotal = TotalCalculableImpuestos
+
+ TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR).RoundSQL
+ End If
+
+ 'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE
+ If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count OrElse Terminar Then
+ Dim Ajuste As Decimal = 0
+ If Math.Abs(RNC.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then
+ Ajuste = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
+
+ If ImporteIVA > 0 Then
+ ImporteIVA += Ajuste
+ ElseIf ImporteIEPS > 0 Then
+ ImporteIEPS += Ajuste
+ End If
+
+ End If
+ End If
+ UltimoRenglonRNC += 1
+
+ AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
+ DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
+ Obs, Cantidad, ImportePU, RowRNC("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowRNC("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
+ RowRNC("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowRNC("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
+ DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowRNC("CveVentaDetalle").ToString().ToEntero())
+
+ If Terminar Then
+ Exit For
+ End If
+ Next
+
+ Next
+ End Sub
Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional NivelTotal As Integer = 1, Optional AplicaNCUsado As Boolean = False) As DataTable
Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0
@@ -26367,6 +26491,7 @@ Partial Class Ventas
HplDownPDF.Visible = False
HLSaldarVenta.Visible = False
LBNotaCredito.Visible = False
+ LnkAplicarRNCDevolucion.Visible = False
LiComplementoPago.Visible = False
HlCuentaTerminal.Visible = False
LiLnkGuias.Visible = False
@@ -26743,6 +26868,7 @@ Partial Class Ventas
HplDownPDF.Visible = False
HLSaldarVenta.Visible = False
LBNotaCredito.Visible = False
+ LnkAplicarRNCDevolucion.Visible = False
LiComplementoPago.Visible = False
HlCuentaTerminal.Visible = False
LiLnkGuias.Visible = False
@@ -31150,4 +31276,68 @@ Partial Class Ventas
#End Region
-End Class
\ No newline at end of file
+ Protected Sub LnkAplicarRNCDevolucion_Click(sender As Object, e As EventArgs)
+
+ Dim DtNC As DataTable = Nothing
+
+ Dim ObjMovtos As New ClsMovimientos()
+ If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
+ DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND TipoRNC = 3 AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
+ End If
+ ObjMovtos.Dispose()
+
+ GvRNCDevoluciones.DataSource = DtNC
+ GvRNCDevoluciones.DataBind()
+
+ UpRNCDevolucion.Update()
+
+ RegistraScript("$('#ModalAplicaRNCDevolucion').modal('show');")
+ End Sub
+
+ Protected Sub BtnAplicarRNCDevoluciones_Click(sender As Object, e As EventArgs)
+ Me.AplicaRNCXDetalle = False
+
+ If ListaRemisionesNC Is Nothing Then
+ ListaRemisionesNC = New List(Of Modelos.Factura)
+ Else
+ ListaRemisionesNC.Clear()
+ End If
+
+ If ListaNCBonificacion Is Nothing Then
+ ListaNCBonificacion = New List(Of Modelos.Factura)
+ Else
+ ListaNCBonificacion.Clear()
+ End If
+
+ Dim TotalRemNCAplicado As Decimal = 0
+
+ For Each GvRow As GridViewRow In GvRNCDevoluciones.Rows
+ If GvRow.RowType = DataControlRowType.DataRow Then
+ If GvRow.FCCheckBox("ChkAplicar").Checked Then
+ Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
+ RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
+ TotalRemNCAplicado += RemNC.TotalRemNCAplicado
+
+ If RemNC.TotalRemNCAplicado <= 0 Then
+ Alert($"Debe asignar un importe en la siguiente remisión: {RemNC.SerieFolio}", TipoMensaje.MsgAdvertencia)
+ ListaRemisionesNC.Clear()
+ Exit Sub
+ End If
+
+ ListaRemisionesNC.Add(RemNC)
+ End If
+ End If
+ Next
+
+ TxtImportesRemisionesNC.Text = TotalRemNCAplicado.FormatoNumero
+ TxtNCImporte.Text = TotalRemNCAplicado.FormatoNumero
+
+ UpModalRemisionesNC.Update()
+ UpAplicarNC.Update()
+
+ AplicarNC(-1, NCDescuento:=False, EsNCAmortizacion:=False, AplicaImpuestosLocales:=True, AplicaNuevoDocumento:=True, AplicoNCFacturaActual:=True, TipoDoctoNC:="Dev")
+
+ RegistraScript("$('#ModalAplicaRNCDevolucion').modal('hide');")
+ End Sub
+End Class
+