Funcionalidad para limite de credito y restricciones de venta
This commit is contained in:
@@ -2243,7 +2243,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
CargaClasificaciones()
|
CargaClasificaciones()
|
||||||
CargaPS(-1, DdlPS)
|
CargaPS(-1, DdlPS)
|
||||||
CargaPSRemision(-1, DdlPSRemision)
|
'CargaPSRemision(-1, DdlPSRemision)
|
||||||
CargaPSPyME(-1, DdlPSPyME)
|
CargaPSPyME(-1, DdlPSPyME)
|
||||||
|
|
||||||
CreaDTVentas()
|
CreaDTVentas()
|
||||||
@@ -5181,7 +5181,8 @@ Partial Class Ventas
|
|||||||
AgregarProductoServicio(dr("Cantidad").ToString().ToDecimal, dr("CveUM").ToString().ToEntero(), dr("UM").ToString(), dr("CveClasificacion").ToString().ToEntero(), dr("Clasificacion").ToString(),
|
AgregarProductoServicio(dr("Cantidad").ToString().ToDecimal, dr("CveUM").ToString().ToEntero(), dr("UM").ToString(), dr("CveClasificacion").ToString().ToEntero(), dr("Clasificacion").ToString(),
|
||||||
dr("CvePS").ToString().ToEntero(), dr("PS").ToString(), dr("Obs").ToString(), dr("PU").ToString().ToDecimal, dr("Descuento").ToString().ToDecimal,
|
dr("CvePS").ToString().ToEntero(), dr("PS").ToString(), dr("Obs").ToString(), dr("PU").ToString().ToDecimal, dr("Descuento").ToString().ToDecimal,
|
||||||
dr("CveProyecto").ToString().ToEntero(), dr("Proyecto").ToString(), dr("CveSubProyecto").ToString().ToEntero(), dr("SubProyecto").ToString(),
|
dr("CveProyecto").ToString().ToEntero(), dr("Proyecto").ToString(), dr("CveSubProyecto").ToString().ToEntero(), dr("SubProyecto").ToString(),
|
||||||
CveContratoDetalle:=dr("CveContratoDetalle").ToString().ToEntero(), CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero(), RegeneraIEPS:=False, SeActualiza:=True)
|
CveContratoDetalle:=dr("CveContratoDetalle").ToString().ToEntero(), CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero(),
|
||||||
|
CveVentaDetalle:=dr("CveVentaDetalle").ToString().ToEntero(), RegeneraIEPS:=False, SeActualiza:=True)
|
||||||
|
|
||||||
|
|
||||||
Next
|
Next
|
||||||
@@ -5595,15 +5596,11 @@ Partial Class Ventas
|
|||||||
ViewState("Vendedor") = ObjCliente.Vendedor
|
ViewState("Vendedor") = ObjCliente.Vendedor
|
||||||
ViewState("CtaContable") = ObjCliente.CuentaContable
|
ViewState("CtaContable") = ObjCliente.CuentaContable
|
||||||
ViewState("IdCtaContClientes") = ObjCliente.IdCtaContClientes
|
ViewState("IdCtaContClientes") = ObjCliente.IdCtaContClientes
|
||||||
ViewState("CveCuentaClientes") = ObjCliente.CveCuentaClientes
|
|
||||||
ViewState("IdCtaContMonedaExtranjera") = ObjCliente.IdCtaContMonedaExtranjera
|
ViewState("IdCtaContMonedaExtranjera") = ObjCliente.IdCtaContMonedaExtranjera
|
||||||
ViewState("IdCtaContComplementaria") = ObjCliente.IdCtaContComplementaria
|
ViewState("IdCtaContComplementaria") = ObjCliente.IdCtaContComplementaria
|
||||||
ViewState("IdCtaContAnticipos") = ObjCliente.IdCtaContAnticipos
|
ViewState("IdCtaContAnticipos") = ObjCliente.IdCtaContAnticipos
|
||||||
ViewState("CveCuentaAnticipos") = ObjCliente.CveCuentaAnticipos
|
|
||||||
ViewState("IdCtaContRetIVA") = ObjCliente.IdCtaContRetIVA
|
ViewState("IdCtaContRetIVA") = ObjCliente.IdCtaContRetIVA
|
||||||
ViewState("CveCuentaRetIVA") = ObjCliente.CveCuentaRetIVA
|
|
||||||
ViewState("IdCtaContRetISR") = ObjCliente.IdCtaContRetISR
|
ViewState("IdCtaContRetISR") = ObjCliente.IdCtaContRetISR
|
||||||
ViewState("CveCuentaRetISR") = ObjCliente.CveCuentaRetISR
|
|
||||||
ViewState("CodCliente") = ObjCliente.Codigo
|
ViewState("CodCliente") = ObjCliente.Codigo
|
||||||
|
|
||||||
ViewState("CvePrecioLista") = ObjCliente.CvePrecioLista
|
ViewState("CvePrecioLista") = ObjCliente.CvePrecioLista
|
||||||
@@ -6148,25 +6145,10 @@ Partial Class Ventas
|
|||||||
End Sub
|
End Sub
|
||||||
Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1)
|
Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1)
|
||||||
|
|
||||||
'RMF. validacion temporal
|
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595)
|
||||||
'verifica si tiene autorizaciones de Nota de crédito autorizadas
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then ' si es empresa de acumuladores
|
|
||||||
Dim ObjVentas As New ClsVentas
|
|
||||||
|
|
||||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, CveEstatus:=1) Then
|
|
||||||
Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="TipoAutorizacion")
|
|
||||||
|
|
||||||
If RowAutorizacion IsNot Nothing Then
|
|
||||||
DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos")
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
ObjVentas.Dispose()
|
|
||||||
End If
|
|
||||||
|
|
||||||
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO
|
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO
|
||||||
If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1 Then
|
If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta <= 0 Then
|
||||||
RBLPago.SelectedValue = "2"
|
RBLPago.SelectedValue = "2"
|
||||||
RBLPago.Items(0).Enabled = False
|
RBLPago.Items(0).Enabled = False
|
||||||
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||||
@@ -6187,209 +6169,153 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
UPCondicionesPago.Update()
|
UPCondicionesPago.Update()
|
||||||
'CARGAR CREDITO DISPONIBLE AL GENERAR UNA FACTURA
|
'CARGAR CREDITO DISPONIBLE AL GENERAR UNA FACTURA
|
||||||
ElseIf UsuarioActual.Empresa.Funcionalidad(596) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then
|
End If
|
||||||
RBLPago.SelectedValue = "1"
|
|
||||||
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
|
||||||
UPCondicionesPago.Update()
|
|
||||||
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
|
||||||
|
|
||||||
If CreditoDispo > 0 Then
|
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta <= 0 AndAlso RBLPago.SelectedValue = "1" AndAlso PermiteCredito Then
|
||||||
TrCreditoDisponible.Visible = True
|
If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then
|
||||||
LblCreditoDisponible.Text = CreditoDispo.FormatoNumero
|
RBLPago.SelectedValue = "1"
|
||||||
If PorcentajeCredito > 80 Then TrPorcentajeCredito.Visible = True : LblPorcentajeCredito.Text = $"{PorcentajeCredito.FormatoNumero}%"
|
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||||
If UsuarioActual.Empresa.Funcionalidad(597) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") Then
|
UPCondicionesPago.Update()
|
||||||
|
|
||||||
|
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
||||||
|
|
||||||
Dim Vta As New ClsVentas
|
If CreditoDispo > 0 Then
|
||||||
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
|
TrCreditoDisponible.Visible = True
|
||||||
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
|
LblCreditoDisponible.Text = CreditoDispo.FormatoNumero
|
||||||
Vta.Dispose()
|
If PorcentajeCredito > 80 Then TrPorcentajeCredito.Visible = True : LblPorcentajeCredito.Text = $"{PorcentajeCredito.FormatoNumero}%"
|
||||||
If Opcion > 0 Then
|
|
||||||
'si la cotización no debe de existir este canddado
|
|
||||||
If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
|
||||||
'RBLPago.SelectedValue = "2"
|
|
||||||
'RBLPago.Items(0).Enabled = False
|
|
||||||
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
|
||||||
UPCondicionesPago.Update()
|
|
||||||
DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
|
|
||||||
DdlTipoComprobante.SelectedValue = "PA"
|
|
||||||
TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString
|
|
||||||
'si llegó por la opción de cotización no debe de restringuir
|
|
||||||
If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot"
|
|
||||||
'quito remisión y factura
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
|
|
||||||
If Not UsuarioActual.TienePermisoProceso(325) Then
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
|
|
||||||
End If
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
|
|
||||||
If Opcion = 1 Then
|
|
||||||
BtnEmitirImprimir.Visible = False
|
|
||||||
BtnsFacturar.Visible = False
|
|
||||||
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
|
||||||
BtnGenerarRemision.Visible = False
|
|
||||||
LnkPedido2SinFacturar.Visible = False
|
|
||||||
LnkCotizaciones.Visible = False
|
|
||||||
LnkOCs.Visible = False
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
' el cliente tiene crédito disponible, no tiene bloqueo
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("PA"))
|
|
||||||
|
|
||||||
If UsuarioActual.TienePermisoProceso(60) Then DdlTipoComprobante.SelectedValueExistInsert("Ing", "Ingresos") 'puede facturar
|
If Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") Then
|
||||||
If UsuarioActual.TienePermisoProceso(199) Then DdlTipoComprobante.SelectedValueExistInsert("Rem", "Remisión") ' puede remisionar
|
|
||||||
DdlTipoComprobante.SelectedValueExist(UsuarioActual.CveTipoDocumento)
|
|
||||||
|
|
||||||
TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString
|
|
||||||
End If
|
|
||||||
|
|
||||||
'Else
|
|
||||||
' 'que no de crédito, solo contado
|
|
||||||
' RBLPago.SelectedValue = "2"
|
|
||||||
' RBLPago.Items(0).Enabled = False
|
|
||||||
'End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
'GENERAR AUTORIZACION SI TIENE EXCEDIO EL LIMITE DE CREDITO
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(595) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then
|
|
||||||
|
|
||||||
'VERIFICAR CANDADOS DE VENTA, REMISIONES SIN FACTURAR, FACTURAS QUE NO TENGAN VENCIDAS
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(597) = "1" Then
|
|
||||||
Dim Vta As New ClsVentas
|
Dim Vta As New ClsVentas
|
||||||
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
|
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
|
||||||
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
|
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
|
||||||
Vta.Dispose()
|
Vta.Dispose()
|
||||||
If Opcion > 0 Then
|
If Opcion > 0 Then
|
||||||
If Opcion = 1 Then
|
'si la cotización no debe de existir este canddado
|
||||||
BtnEmitirImprimir.Visible = False
|
|
||||||
End If
|
|
||||||
If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
||||||
Else
|
'RBLPago.SelectedValue = "2"
|
||||||
If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
'RBLPago.Items(0).Enabled = False
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
'RBLPago.SelectedValue = "2"
|
|
||||||
'RBLPago.Items(0).Enabled = False
|
|
||||||
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
|
||||||
UPCondicionesPago.Update()
|
|
||||||
DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
|
|
||||||
DdlTipoComprobante.SelectedValue = "PA"
|
|
||||||
TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString
|
|
||||||
'si llegó por la opción de cotización no debe de restringuir
|
|
||||||
If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot"
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
|
|
||||||
If Not UsuarioActual.TienePermisoProceso(325) Then
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
|
|
||||||
End If
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
|
|
||||||
BtnsFacturar.Visible = False
|
|
||||||
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
|
||||||
BtnGenerarRemision.Visible = False
|
|
||||||
LnkPedido2SinFacturar.Visible = False
|
|
||||||
LnkCotizaciones.Visible = False
|
|
||||||
LnkOCs.Visible = False
|
|
||||||
|
|
||||||
Else
|
|
||||||
'RMF. codigo temporal para pruebas
|
|
||||||
If Alertas AndAlso UsuarioActual.CveEmpresa = 140 AndAlso UsuarioActual.CveUsuario.Contiene(100, 1937, 2275) AndAlso Now.Hour > 5 AndAlso Now.Hour < 9 Then
|
|
||||||
Dim Vta As New ClsVentas
|
|
||||||
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
|
|
||||||
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
|
|
||||||
Vta.Dispose()
|
|
||||||
If Opcion > 0 Then
|
|
||||||
LnkSolicitarCredito.Visible = True
|
|
||||||
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
|
||||||
RBLPago.SelectedValue = "2"
|
|
||||||
RBLPago.Items(0).Enabled = False
|
|
||||||
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||||
UPCondicionesPago.Update()
|
UPCondicionesPago.Update()
|
||||||
Else
|
DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
|
||||||
'este codigo no es temporal
|
DdlTipoComprobante.SelectedValue = "PA"
|
||||||
If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString
|
||||||
If UsuarioActual.CveEmpresa = 140 Then
|
'si llegó por la opción de cotización no debe de restringuir
|
||||||
LnkSolicitarCredito.Visible = True
|
If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot"
|
||||||
DdlTipoAutorizacion.SelectedValueExist("1")
|
'quito remisión y factura
|
||||||
|
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
|
||||||
|
If Not UsuarioActual.TienePermisoProceso(325) Then
|
||||||
|
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
|
||||||
End If
|
End If
|
||||||
End If
|
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
|
||||||
|
If Opcion = 1 Then
|
||||||
|
BtnEmitirImprimir.Visible = False
|
||||||
End If
|
BtnsFacturar.Visible = False
|
||||||
End If
|
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
||||||
End If
|
BtnGenerarRemision.Visible = False
|
||||||
UPPCreditoDisponible.Update()
|
LnkPedido2SinFacturar.Visible = False
|
||||||
'Si tiene credito disponible, Verificar limites de (verificar candados de venta, remisiones sin facturar, facturas que no tengan vencidas)
|
LnkCotizaciones.Visible = False
|
||||||
ElseIf UsuarioActual.Empresa.Funcionalidad(597) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso CveVenta > 0 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Pd2", "Cot") Or (DdlTipoComprobante.SelectedValue = "Rem" And ModalidadEdicion And ViewState("CveClienteAnterior").ToString().ToEntero() > 0 And LblRFC.Text.Trim <> "XAXX010101000")) Then
|
LnkOCs.Visible = False
|
||||||
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
|
||||||
If CreditoDispo > 0 Then
|
|
||||||
Dim Vta As New ClsVentas
|
|
||||||
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
|
|
||||||
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
|
|
||||||
Vta.Dispose()
|
|
||||||
If Opcion > 0 Then
|
|
||||||
If ModalidadEdicion AndAlso ViewState("CveCliente").ToString().ToEntero() <> ViewState("CveClienteAnterior").ToString().ToEntero() And DdlTipoComprobante.SelectedValue = "Rem" And ViewState("CveClienteAnterior").ToString().ToEntero() > 0 And LblRFC.Text.Trim <> "XAXX010101000" Then
|
|
||||||
ViewState("CveCliente") = ViewState("CveClienteAnterior").ToString().ToEntero()
|
|
||||||
|
|
||||||
CargaCliente(ViewState("CveCliente").ToString().ToEntero())
|
|
||||||
If Opcion > 0 Then
|
|
||||||
If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
|
||||||
Else
|
|
||||||
If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
|
||||||
End If
|
|
||||||
BtnEmitirImprimir.Visible = False
|
|
||||||
BtnVistaPrevia.Visible = False
|
|
||||||
UpFacturar.Update()
|
|
||||||
Exit Sub
|
|
||||||
ElseIf DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso EsCreaApartirDe Then
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
|
|
||||||
If Not UsuarioActual.TienePermisoProceso(325) Then
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
|
|
||||||
End If
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Pd2"))
|
|
||||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs"))
|
|
||||||
BtnGenerarRemision.Visible = False
|
|
||||||
BtnGenerarOS.Visible = False
|
|
||||||
BtnEmitirImprimir.Visible = True
|
|
||||||
BtnsFacturar.Visible = False
|
|
||||||
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
|
||||||
Else
|
|
||||||
If DdlTipoComprobante.SelectedValue.Contiene("Pd2") Then
|
|
||||||
BtnGeneraAutorizacion.Visible = If(CveEstatus <> 21, True, False)
|
|
||||||
End If
|
|
||||||
BtnGenerarRemision.Visible = False
|
|
||||||
BtnGenerarOS.Visible = False
|
|
||||||
BtnEmitirImprimir.Visible = False
|
|
||||||
BtnsFacturar.Visible = False
|
|
||||||
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
|
||||||
If ViewState("CveCliente").ToString().ToEntero() <> ViewState("CveClienteAnterior").ToString().ToEntero() Then
|
|
||||||
If Opcion > 0 Then
|
|
||||||
If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
|
||||||
Else
|
|
||||||
If Alertas Then Alert("El cliente tiene límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
' el cliente tiene crédito disponible, no tiene bloqueo
|
||||||
|
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("PA"))
|
||||||
|
|
||||||
|
If UsuarioActual.TienePermisoProceso(60) Then DdlTipoComprobante.SelectedValueExistInsert("Ing", "Ingresos") 'puede facturar
|
||||||
|
If UsuarioActual.TienePermisoProceso(199) Then DdlTipoComprobante.SelectedValueExistInsert("Rem", "Remisión") ' puede remisionar
|
||||||
|
DdlTipoComprobante.SelectedValueExist(UsuarioActual.CveTipoDocumento)
|
||||||
|
|
||||||
|
TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
BtnGeneraAutorizacion.Visible = False
|
'GENERAR AUTORIZACION SI TIENE EXCEDIO EL LIMITE DE CREDITO
|
||||||
If DdlTipoComprobante.SelectedValue.Contiene("Pd2") Then
|
Select Case ValorAutorizacion
|
||||||
If UsuarioActual.TienePermisoProceso(199) Then
|
Case "1" 'CREAR DOCUMENTO DE AUTORIZACION PA
|
||||||
BtnGenerarRemision.Visible = If(CveEstatus <> 21, True, False)
|
If Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then
|
||||||
Else
|
|
||||||
BtnGenerarRemision.Visible = False
|
'VERIFICAR CANDADOS DE VENTA, REMISIONES SIN FACTURAR, FACTURAS QUE NO TENGAN VENCIDAS
|
||||||
End If
|
Dim Vta As New ClsVentas
|
||||||
End If
|
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
|
||||||
End If
|
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
|
||||||
Else
|
Vta.Dispose()
|
||||||
BtnGenerarRemision.Visible = False
|
If Opcion > 0 Then
|
||||||
If DdlTipoComprobante.SelectedValue.Contiene("Pd2") Then
|
If Opcion = 1 Then
|
||||||
BtnGeneraAutorizacion.Visible = If(CveEstatus <> 21, True, False)
|
BtnEmitirImprimir.Visible = False
|
||||||
|
End If
|
||||||
|
If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
||||||
|
Else
|
||||||
|
If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
|
||||||
|
'RBLPago.SelectedValue = "2"
|
||||||
|
'RBLPago.Items(0).Enabled = False
|
||||||
|
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||||
|
UPCondicionesPago.Update()
|
||||||
|
DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización")
|
||||||
|
DdlTipoComprobante.SelectedValue = "PA"
|
||||||
|
TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString
|
||||||
|
'si llegó por la opción de cotización no debe de restringuir
|
||||||
|
If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot"
|
||||||
|
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing"))
|
||||||
|
If Not UsuarioActual.TienePermisoProceso(325) Then
|
||||||
|
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
|
||||||
|
End If
|
||||||
|
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
|
||||||
|
BtnsFacturar.Visible = False
|
||||||
|
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
||||||
|
BtnGenerarRemision.Visible = False
|
||||||
|
LnkPedido2SinFacturar.Visible = False
|
||||||
|
LnkCotizaciones.Visible = False
|
||||||
|
LnkOCs.Visible = False
|
||||||
|
End If
|
||||||
|
Case "2" 'Autorizacion desde una solicitud del catalogo de autorizaciones
|
||||||
|
'RMF. validacion temporal
|
||||||
|
'verifica si tiene autorizaciones de Nota de crédito autorizadas
|
||||||
|
Dim ObjVentas As New ClsVentas
|
||||||
|
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, CveEstatus:=1) Then
|
||||||
|
Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="TipoAutorizacion")
|
||||||
|
If RowAutorizacion IsNot Nothing Then
|
||||||
|
DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
Case Else 'SI NO TIENE NINGUN TIPO DE AUTORIZACION CONFIGURADO
|
||||||
|
'RMF. codigo temporal para pruebas
|
||||||
|
If Alertas AndAlso UsuarioActual.CveEmpresa = 140 AndAlso UsuarioActual.CveUsuario.Contiene(100, 1937, 2275) AndAlso Now.Hour > 5 AndAlso Now.Hour < 9 Then
|
||||||
|
Dim Vta As New ClsVentas
|
||||||
|
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
|
||||||
|
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
|
||||||
|
Vta.Dispose()
|
||||||
|
If Opcion > 0 Then
|
||||||
|
LnkSolicitarCredito.Visible = True
|
||||||
|
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
||||||
|
RBLPago.SelectedValue = "2"
|
||||||
|
RBLPago.Items(0).Enabled = False
|
||||||
|
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||||
|
UPCondicionesPago.Update()
|
||||||
|
Else
|
||||||
|
'este codigo no es temporal
|
||||||
|
If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
||||||
|
If UsuarioActual.CveEmpresa = 140 Then
|
||||||
|
LnkSolicitarCredito.Visible = True
|
||||||
|
DdlTipoAutorizacion.SelectedValueExist("1")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
End Select
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
UPPCreditoDisponible.Update()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Puede hacer pedido
|
'Puede hacer pedido
|
||||||
@@ -6556,49 +6482,45 @@ Partial Class Ventas
|
|||||||
End Sub
|
End Sub
|
||||||
Private Function CargaCreditoDisponible(tCveCliente As Integer, tCveSucursalCliente As Integer, Optional ByRef ObjVentas As ClsVentas = Nothing) As Decimal
|
Private Function CargaCreditoDisponible(tCveCliente As Integer, tCveSucursalCliente As Integer, Optional ByRef ObjVentas As ClsVentas = Nothing) As Decimal
|
||||||
Dim Retorno As Decimal = 0
|
Dim Retorno As Decimal = 0
|
||||||
If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then
|
Dim ObjVentasAplciar As ClsVentas = Nothing
|
||||||
|
If ObjVentas IsNot Nothing Then
|
||||||
|
ObjVentasAplciar = ObjVentas
|
||||||
|
Else
|
||||||
|
ObjVentasAplciar = New ClsVentas
|
||||||
|
End If
|
||||||
|
|
||||||
Dim ObjVentasAplciar As ClsVentas = Nothing
|
If ObjVentasAplciar.ObtenerCreditoRestante(tCveCliente, tCveSucursalCliente) Then
|
||||||
If ObjVentas IsNot Nothing Then
|
If ObjVentasAplciar.DtResultados.Rows.Count > 0 Then
|
||||||
ObjVentasAplciar = ObjVentas
|
|
||||||
Else
|
|
||||||
ObjVentasAplciar = New ClsVentas
|
|
||||||
End If
|
|
||||||
|
|
||||||
If ObjVentasAplciar.ObtenerCreditoRestante(tCveCliente, tCveSucursalCliente) Then
|
If tCveSucursalCliente > 0 Then
|
||||||
If ObjVentasAplciar.DtResultados.Rows.Count > 0 Then
|
|
||||||
|
|
||||||
If tCveSucursalCliente > 0 Then
|
Dim LimiteRestanteSucursal As Decimal = ObjVentasAplciar.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal
|
||||||
|
Dim PorcentajeSaldoSucursal As Decimal = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoSucursal").ToString().ToDecimal
|
||||||
|
|
||||||
Dim LimiteRestanteSucursal As Decimal = ObjVentasAplciar.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal
|
Dim LimiteRestanteCliente As Decimal = ObjVentasAplciar.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal
|
||||||
Dim PorcentajeSaldoSucursal As Decimal = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoSucursal").ToString().ToDecimal
|
Dim PorcentajeSaldoCliente As Decimal = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoCliente").ToString().ToDecimal
|
||||||
|
|
||||||
Dim LimiteRestanteCliente As Decimal = ObjVentasAplciar.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal
|
'SI EL LIMITE DE LA SUCURSAL ES MAYOR AL DEL CLIENTE DEBE LIMITAR AL DEL CLIENTE
|
||||||
Dim PorcentajeSaldoCliente As Decimal = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoCliente").ToString().ToDecimal
|
If LimiteRestanteSucursal > LimiteRestanteCliente Then
|
||||||
|
Retorno = LimiteRestanteCliente
|
||||||
'SI EL LIMITE DE LA SUCURSAL ES MAYOR AL DEL CLIENTE DEBE LIMITAR AL DEL CLIENTE
|
PorcentajeCredito = PorcentajeSaldoCliente
|
||||||
If LimiteRestanteSucursal > LimiteRestanteCliente Then
|
ElseIf LimiteRestanteSucursal < LimiteRestanteCliente Then
|
||||||
Retorno = LimiteRestanteCliente
|
Retorno = LimiteRestanteSucursal
|
||||||
PorcentajeCredito = PorcentajeSaldoCliente
|
PorcentajeCredito = PorcentajeSaldoSucursal
|
||||||
ElseIf LimiteRestanteSucursal < LimiteRestanteCliente Then
|
ElseIf LimiteRestanteSucursal = LimiteRestanteCliente Then
|
||||||
Retorno = LimiteRestanteSucursal
|
Retorno = LimiteRestanteSucursal
|
||||||
PorcentajeCredito = PorcentajeSaldoSucursal
|
PorcentajeCredito = PorcentajeSaldoSucursal
|
||||||
ElseIf LimiteRestanteSucursal = LimiteRestanteCliente Then
|
|
||||||
Retorno = LimiteRestanteSucursal
|
|
||||||
PorcentajeCredito = PorcentajeSaldoSucursal
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
|
||||||
Retorno = ObjVentasAplciar.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal
|
|
||||||
PorcentajeCredito = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoCliente").ToString().ToDecimal
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
Retorno = ObjVentasAplciar.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal
|
||||||
|
PorcentajeCredito = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoCliente").ToString().ToDecimal
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
If ObjVentas Is Nothing Then
|
If ObjVentas Is Nothing Then
|
||||||
ObjVentasAplciar.Dispose()
|
ObjVentasAplciar.Dispose()
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
@@ -7635,38 +7557,38 @@ Partial Class Ventas
|
|||||||
|
|
||||||
'No exceder el limite de credito, Si no tiene contrato limita el credito, si tiene no hace nada. Si no tiene remisiones tampoco hace nada.
|
'No exceder el limite de credito, Si no tiene contrato limita el credito, si tiene no hace nada. Si no tiene remisiones tampoco hace nada.
|
||||||
If (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then
|
If (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then
|
||||||
If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then
|
'If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then
|
||||||
Dim ObjVentas As New ClsVentas
|
Dim ObjVentas As New ClsVentas
|
||||||
|
|
||||||
If ObjVentas.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Then
|
If ObjVentas.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Then
|
||||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||||
|
|
||||||
If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then
|
If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then
|
||||||
If ObjVentas.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then
|
If ObjVentas.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then
|
||||||
ObjVentas.Dispose()
|
ObjVentas.Dispose()
|
||||||
Alert("Se está excediendo el límite de credito permitido de la Sucursal del Cliente.", TipoMensaje.MsgInformacion)
|
Alert("Se está excediendo el límite de credito permitido de la Sucursal del Cliente.", TipoMensaje.MsgInformacion)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
|
||||||
Else
|
|
||||||
If ObjVentas.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then
|
|
||||||
ObjVentas.Dispose()
|
|
||||||
Alert("Se está excediendo el límite de credito permitido del Cliente.", TipoMensaje.MsgInformacion)
|
|
||||||
Exit Sub
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
ObjVentas.Dispose()
|
If ObjVentas.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then
|
||||||
Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError)
|
ObjVentas.Dispose()
|
||||||
Exit Sub
|
Alert("Se está excediendo el límite de credito permitido del Cliente.", TipoMensaje.MsgInformacion)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
ObjVentas.Dispose()
|
ObjVentas.Dispose()
|
||||||
Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError)
|
Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
ObjVentas.Dispose()
|
ObjVentas.Dispose()
|
||||||
|
Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError)
|
||||||
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
'End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
@@ -8239,15 +8161,17 @@ Partial Class Ventas
|
|||||||
Dim DtMovDetalles As DataTable = Nothing
|
Dim DtMovDetalles As DataTable = Nothing
|
||||||
If ObjInventario.GetSaldoVentaDetalle(CveDevolucion, UsuarioActual.CveEmpresa) Then
|
If ObjInventario.GetSaldoVentaDetalle(CveDevolucion, UsuarioActual.CveEmpresa) Then
|
||||||
DtMovDetalles = ObjInventario.DtResultados.Copy()
|
DtMovDetalles = ObjInventario.DtResultados.Copy()
|
||||||
|
Else
|
||||||
|
ErrorList.Add("No se pudo verificar los movimientos de almacen de la factura")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If DtMovDetalles IsNot Nothing Then
|
If DtMovDetalles IsNot Nothing Then
|
||||||
For Each Row As DataRow In DtMovDetalles.Rows
|
For Each Row As DataRow In DtMovDetalles.Rows
|
||||||
Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToEntero()
|
Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToDecimal()
|
||||||
If SaldoAlmacen < 0 Then
|
If SaldoAlmacen < 0 Then
|
||||||
ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalleNueva").ToString().ToEntero(), 1)
|
If Not ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalleNueva").ToString().ToEntero(), 1) Then
|
||||||
ElseIf SaldoAlmacen = 0 Then
|
ErrorList.Add("No se pudo actualizar el movimiento de almacen de la factura")
|
||||||
ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalleNueva").ToString().ToEntero(), 0)
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
@@ -14158,6 +14082,9 @@ Partial Class Ventas
|
|||||||
saldo = e.Row.DataKey("SaldoSubTotal").ToString().ToDecimal
|
saldo = e.Row.DataKey("SaldoSubTotal").ToString().ToDecimal
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
e.Row.FCLiteral("LtlAnticipos").Text = saldo.FormatoNumero
|
||||||
|
ElseIf CveVenta > 0 AndAlso e.Row.DBCampo("Tipo").ToString() = "Ant" Then
|
||||||
|
saldo = e.Row.DataKey("SaldoConImpuestos").ToString().ToDecimal
|
||||||
e.Row.FCLiteral("LtlAnticipos").Text = saldo.FormatoNumero
|
e.Row.FCLiteral("LtlAnticipos").Text = saldo.FormatoNumero
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -15019,7 +14946,6 @@ Partial Class Ventas
|
|||||||
|
|
||||||
If IdCtaContRetIVA <> 0 Then
|
If IdCtaContRetIVA <> 0 Then
|
||||||
IdCtaContable = IdCtaContRetIVA
|
IdCtaContable = IdCtaContRetIVA
|
||||||
CveCuenta = CveCuentaRetIVA
|
|
||||||
Else
|
Else
|
||||||
If ObjConta.GetRetCuenta(8, UsuarioActual.CveEmpresa) Then
|
If ObjConta.GetRetCuenta(8, UsuarioActual.CveEmpresa) Then
|
||||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||||
@@ -20592,9 +20518,9 @@ Partial Class Ventas
|
|||||||
DdlMetodoPago33.Enabled = False
|
DdlMetodoPago33.Enabled = False
|
||||||
|
|
||||||
If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) Then
|
If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) Then
|
||||||
|
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
|
||||||
DdlFormaPago33.Enabled = False
|
DdlFormaPago33.Enabled = False
|
||||||
DdlFormaPago33.SelectedValueExist("20")
|
DdlFormaPago33.SelectedValueExist("20")
|
||||||
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
@@ -20978,7 +20904,7 @@ Partial Class Ventas
|
|||||||
Dim AmortizacionNC As Decimal = 0
|
Dim AmortizacionNC As Decimal = 0
|
||||||
|
|
||||||
'SI ES AMORTIZACION POR NOTA DE CREDITO DEBE SUMAR LA TOTALIDAD PARA COMPARAR EL PAGO
|
'SI ES AMORTIZACION POR NOTA DE CREDITO DEBE SUMAR LA TOTALIDAD PARA COMPARAR EL PAGO
|
||||||
If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
|
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
|
||||||
For Each gvr As GridViewRow In GVAnticipos.Rows
|
For Each gvr As GridViewRow In GVAnticipos.Rows
|
||||||
If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then
|
If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then
|
||||||
AmortizacionNC += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal
|
AmortizacionNC += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal
|
||||||
@@ -25198,53 +25124,58 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Me.TmpDTRNCBonificacionesSeleccionadas = Nothing
|
Me.TmpDTRNCBonificacionesSeleccionadas = Nothing
|
||||||
|
|
||||||
Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
|
If DtNC IsNot Nothing Then
|
||||||
Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
|
Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
|
||||||
Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal))
|
Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
|
||||||
Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
|
Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal))
|
||||||
|
Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
|
||||||
|
|
||||||
If CargarBonificaciones Then
|
If CargarBonificaciones Then
|
||||||
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
|
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
|
||||||
CargaBonificaciones(-1, True)
|
CargaBonificaciones(-1, True)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If CargarSoloGarantias Then
|
If CargarSoloGarantias Then
|
||||||
GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True")
|
GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True")
|
||||||
Else
|
Else
|
||||||
GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
|
GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
|
||||||
End If
|
End If
|
||||||
GvRemisionesNC.DataBind()
|
GvRemisionesNC.DataBind()
|
||||||
|
|
||||||
'GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas
|
'GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas
|
||||||
'GvRemisionesNCBon.DataBind()
|
'GvRemisionesNCBon.DataBind()
|
||||||
|
|
||||||
If CveVentaUsado > 0 Then
|
If CveVentaUsado > 0 Then
|
||||||
DivSMU.Visible = True
|
|
||||||
Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa)
|
|
||||||
Dim SaldoMaximoUsados As Decimal = FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal() + FacUsado.DtDetalle.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
|
|
||||||
HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
|
|
||||||
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsados)
|
|
||||||
Else
|
|
||||||
Dim ObjAcum As New ClsAcumuladores
|
|
||||||
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
|
|
||||||
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
|
|
||||||
DivSMU.Visible = True
|
DivSMU.Visible = True
|
||||||
|
Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa)
|
||||||
|
Dim SaldoMaximoUsados As Decimal = FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal() + FacUsado.DtDetalle.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
|
||||||
|
HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
|
||||||
|
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsados)
|
||||||
|
Else
|
||||||
|
Dim ObjAcum As New ClsAcumuladores
|
||||||
|
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
|
||||||
|
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
|
||||||
|
DivSMU.Visible = True
|
||||||
|
|
||||||
|
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
||||||
|
If SaldoMaximo > 0 Then
|
||||||
|
HdnSaldoMaximoUsados.Value = RowUsadosNC("ValorConImpuestos").ToString()
|
||||||
|
LtlSMU.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
|
||||||
|
Else
|
||||||
|
HdnSaldoMaximoUsados.Value = "0"
|
||||||
|
LtlSMU.Text = "0"
|
||||||
|
End If
|
||||||
|
|
||||||
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
|
|
||||||
If SaldoMaximo > 0 Then
|
|
||||||
HdnSaldoMaximoUsados.Value = RowUsadosNC("ValorConImpuestos").ToString()
|
|
||||||
LtlSMU.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
|
|
||||||
Else
|
Else
|
||||||
|
'DivSMU.Visible = False
|
||||||
HdnSaldoMaximoUsados.Value = "0"
|
HdnSaldoMaximoUsados.Value = "0"
|
||||||
LtlSMU.Text = "0"
|
LtlSMU.Text = "0"
|
||||||
End If
|
End If
|
||||||
|
ObjAcum.Dispose()
|
||||||
Else
|
|
||||||
'DivSMU.Visible = False
|
|
||||||
HdnSaldoMaximoUsados.Value = "0"
|
|
||||||
LtlSMU.Text = "0"
|
|
||||||
End If
|
End If
|
||||||
ObjAcum.Dispose()
|
Else
|
||||||
|
HdnSaldoMaximoUsados.Value = "0"
|
||||||
|
LtlSMU.Text = "0"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
UpModalRemisionesNC.Update()
|
UpModalRemisionesNC.Update()
|
||||||
@@ -25261,26 +25192,31 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Me.TmpDTRNCBonificacionesSeleccionadas = Nothing
|
Me.TmpDTRNCBonificacionesSeleccionadas = Nothing
|
||||||
|
|
||||||
Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
|
If DtNC IsNot Nothing Then
|
||||||
Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
|
Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
|
||||||
Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal))
|
Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
|
||||||
Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
|
Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal))
|
||||||
|
Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
|
||||||
|
|
||||||
If CargarBonificaciones Then
|
If CargarBonificaciones Then
|
||||||
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
|
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
|
||||||
CargaBonificacionesDesc("-1", True)
|
CargaBonificacionesDesc("-1", True)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If CargarSoloGarantias Then
|
If CargarSoloGarantias Then
|
||||||
GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True")
|
GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True")
|
||||||
|
Else
|
||||||
|
GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
|
||||||
|
End If
|
||||||
|
GvDescNCCargos.DataBind()
|
||||||
|
|
||||||
|
Dim SaldoMaximoUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
|
||||||
|
HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
|
||||||
|
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsados)
|
||||||
Else
|
Else
|
||||||
GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
|
HdnSaldoMaximoUsados.Value = "0"
|
||||||
|
LblSaldoMaximoUsados.Text = "0"
|
||||||
End If
|
End If
|
||||||
GvDescNCCargos.DataBind()
|
|
||||||
|
|
||||||
Dim SaldoMaximoUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
|
|
||||||
HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
|
|
||||||
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsados)
|
|
||||||
|
|
||||||
UpDescNC.Update()
|
UpDescNC.Update()
|
||||||
End Sub
|
End Sub
|
||||||
@@ -28471,7 +28407,7 @@ Partial Class Ventas
|
|||||||
ChkRemProductos.Visible = True
|
ChkRemProductos.Visible = True
|
||||||
Else
|
Else
|
||||||
'DivPSRemision.Visible = True
|
'DivPSRemision.Visible = True
|
||||||
CargaPSRemision(-1, DdlPSRemision)
|
'CargaPSRemision(-1, DdlPSRemision)
|
||||||
ChkRemProductos.Visible = False
|
ChkRemProductos.Visible = False
|
||||||
ChkRemProductos.Checked = False
|
ChkRemProductos.Checked = False
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user