|
|
|
|
@@ -5897,7 +5897,7 @@ Partial Class Ventas
|
|
|
|
|
LnkCotizaciones.Visible = False
|
|
|
|
|
End If
|
|
|
|
|
UPCondicionesPago.Update()
|
|
|
|
|
ElseIf UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119, 158, 140) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then
|
|
|
|
|
ElseIf UsuarioActual.CveEmpresa.Contiene(72, 80, 119, 146, 158, 140) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then
|
|
|
|
|
RBLPago.SelectedValue = "1"
|
|
|
|
|
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
|
|
|
|
UPCondicionesPago.Update()
|
|
|
|
|
@@ -5960,7 +5960,7 @@ Partial Class Ventas
|
|
|
|
|
End If
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.CveEmpresa.Contiene(119) AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then
|
|
|
|
|
If UsuarioActual.CveEmpresa = 119 AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") 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)
|
|
|
|
|
@@ -5971,7 +5971,7 @@ Partial Class Ventas
|
|
|
|
|
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)
|
|
|
|
|
If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
'RBLPago.SelectedValue = "2"
|
|
|
|
|
@@ -10800,19 +10800,30 @@ Partial Class Ventas
|
|
|
|
|
End Try
|
|
|
|
|
|
|
|
|
|
'SI SE FACTURA UNA RNC SE MUESTRA
|
|
|
|
|
If UsuarioActual.CveEmpresa = 140 AndAlso factura.TipoDocto = "Egs" Then
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso factura.TipoDocto = "Egs" Then
|
|
|
|
|
If Row("CveVentaDetalleRNC").ToString().ToEntero() > 0 Then
|
|
|
|
|
|
|
|
|
|
If Not ObjVentas.AddVentaDetalleRNCFacturada(Row("CveVentaDetalleRNC").ToString().ToEntero(), ObjVentas.CveVentaDetalle, Row("Cantidad").ToString().ToDecimal()) Then
|
|
|
|
|
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim EsCargo As Boolean = False
|
|
|
|
|
Dim ListaRNC As List(Of Modelos.Factura) = Nothing
|
|
|
|
|
|
|
|
|
|
If NCDescuento Then
|
|
|
|
|
EsCargo = (Not ListaNCDescuento.Any(Function(RNC) RNC.Num2 = 1))
|
|
|
|
|
ListaRNC = ListaNCDescuento
|
|
|
|
|
Else
|
|
|
|
|
EsCargo = RblRNCTipo.SelectedValue = "1"
|
|
|
|
|
ListaRNC = ListaRemisionesNC
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
'SI SE FACTURAN RNC DE CARGO, SE AGREGA EL CONCEPTO DE ACREDITAMIENTO
|
|
|
|
|
If ClienteEsDistribuidor AndAlso RblRNCTipo.SelectedValue = "1" Then
|
|
|
|
|
If ListaRNC IsNot Nothing AndAlso ClienteEsDistribuidor AndAlso EsCargo Then
|
|
|
|
|
Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
|
|
|
|
|
|
|
|
|
|
Dim CvePSCargo As Integer = -1
|
|
|
|
|
For Each RNC In ListaRemisionesNC
|
|
|
|
|
For Each RNC In ListaRNC
|
|
|
|
|
CvePSCargo = RNC.DtDetalle.FiltroPrimeroValor("CvePS", $"CveVentaDetalle={Row("CveVentaDetalleRNC").ToString()}").ToEntero()
|
|
|
|
|
If CvePSCargo > 0 Then
|
|
|
|
|
Exit For
|
|
|
|
|
@@ -12853,23 +12864,23 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString(), Row2("SubProyecto").ToString())
|
|
|
|
|
IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
|
|
|
|
|
' CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
|
|
|
|
|
'If ValorInventario <> 0 Then
|
|
|
|
|
CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
|
|
|
|
|
If ValorInventario <> 0 Then
|
|
|
|
|
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then
|
|
|
|
|
OcurrioError = True
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then
|
|
|
|
|
OcurrioError = True
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
'End If
|
|
|
|
|
cont += 1
|
|
|
|
|
Next
|
|
|
|
|
End If
|
|
|
|
|
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero()
|
|
|
|
|
|
|
|
|
|
'If TotalCosto <> 0 Then
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto68, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then
|
|
|
|
|
If TotalCosto <> 0 Then
|
|
|
|
|
If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto68, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then
|
|
|
|
|
OcurrioError = True
|
|
|
|
|
End If
|
|
|
|
|
'End If
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
OcurrioError = True
|
|
|
|
|
@@ -15482,7 +15493,7 @@ Partial Class Ventas
|
|
|
|
|
UpnTools.Update()
|
|
|
|
|
tdTelefonoGen.Visible = False
|
|
|
|
|
tdTxtTelefonoGen.Visible = False
|
|
|
|
|
If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122, 145, 140) Then
|
|
|
|
|
If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122, 145) Then
|
|
|
|
|
ChkEnviarFactura.Checked = False
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
@@ -16279,7 +16290,7 @@ Partial Class Ventas
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
'SI TIENE PRONTO PAGO CALCULA EL IMPORTE
|
|
|
|
|
If RowPorcentaje("ProntoPago").ToString().ToDecimal() > 0 Then
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
@@ -17381,6 +17392,11 @@ Partial Class Ventas
|
|
|
|
|
TotalAmortizacion = 0
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim TotalRemNCAplicado As Decimal = 0
|
|
|
|
|
|
|
|
|
|
If TbDescuentosRNC.Visible AndAlso ListaNCDesc IsNot Nothing Then
|
|
|
|
|
TotalRemNCAplicado = ListaNCDesc.Sum(Function(RNC) RNC.TotalRemNCAplicado)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Total = (TotalSubTotal - TotalDescuentos - TotalAmortizacion + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
|
|
|
|
|
LblSubTotal1.Text = TotalSubTotal.FormatoNumero(2)
|
|
|
|
|
@@ -17396,6 +17412,8 @@ Partial Class Ventas
|
|
|
|
|
HdnProntoPago.Value = TotalProntoPago.ToString()
|
|
|
|
|
LblProntoPago.Text = TotalProntoPago.FormatoNumero(2)
|
|
|
|
|
|
|
|
|
|
LblTotalAPagar.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado - TotalProntoPago).FormatoNumero
|
|
|
|
|
|
|
|
|
|
LblAmort.Text = TxtSubTotal.Text
|
|
|
|
|
If CveVenta <= 0 OrElse (CveDevolucion > 0 And NuevaFactura = 1) Then
|
|
|
|
|
HdnVentaSaldo.Value = Total.ToString()
|
|
|
|
|
@@ -20116,7 +20134,7 @@ Partial Class Ventas
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
|
|
|
|
|
Dim TotalNC As Decimal = If((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0), LblTotalNC.Text.Trim().ToDecimal(), 0)
|
|
|
|
|
Dim TotalNC As Decimal = If((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0), LblTotalAPagar.Text.Trim().ToDecimal(), 0)
|
|
|
|
|
If TotalNC > 0 Then
|
|
|
|
|
If (DtPagos.SUM("Importe").ToString().ToDecimal() + AmortizacionNC + Total - TxtCambio.Text.ToDecimal) > TotalNC Then
|
|
|
|
|
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
@@ -24209,7 +24227,8 @@ Partial Class Ventas
|
|
|
|
|
Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
|
|
|
|
|
|
|
|
|
|
If CargarBonificaciones Then
|
|
|
|
|
Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
|
|
|
|
|
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
|
|
|
|
|
CargaBonificaciones(-1, True)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If CargarSoloGarantias Then
|
|
|
|
|
@@ -24217,10 +24236,10 @@ Partial Class Ventas
|
|
|
|
|
Else
|
|
|
|
|
GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
|
|
|
|
|
End If
|
|
|
|
|
GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas
|
|
|
|
|
|
|
|
|
|
GvRemisionesNC.DataBind()
|
|
|
|
|
GvRemisionesNCBon.DataBind()
|
|
|
|
|
|
|
|
|
|
'GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas
|
|
|
|
|
'GvRemisionesNCBon.DataBind()
|
|
|
|
|
|
|
|
|
|
If CveVentaUsado > 0 Then
|
|
|
|
|
DivSMU.Visible = True
|
|
|
|
|
@@ -24349,6 +24368,11 @@ Partial Class Ventas
|
|
|
|
|
Dim ChkAplicarRNC As CheckBox = DirectCast(sender, CheckBox)
|
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(ChkAplicarRNC.NamingContainer, GridViewRow)
|
|
|
|
|
|
|
|
|
|
CargaBonificacionesDesc(GvRow.DataKey("CveVenta").ToEntero(), ChkAplicarRNC.Checked)
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub CargaBonificacionesDesc(CveVentaRNCCargo As Integer, AplicarRNC As Boolean)
|
|
|
|
|
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
|
|
|
|
|
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
|
|
|
|
|
End If
|
|
|
|
|
@@ -24358,7 +24382,7 @@ Partial Class Ventas
|
|
|
|
|
Dim SbFiltro As New StringBuilder()
|
|
|
|
|
SbFiltro.Append("CveVenta IN(")
|
|
|
|
|
Using ObjAcum As New ClsAcumuladores
|
|
|
|
|
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then
|
|
|
|
|
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNCCargo) Then
|
|
|
|
|
DtBon = ObjAcum.DtResultados.Copy()
|
|
|
|
|
End If
|
|
|
|
|
End Using
|
|
|
|
|
@@ -24375,7 +24399,7 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
For Each bon In queryBonificacion
|
|
|
|
|
SbFiltro.AppendFormat("'{0}',", bon.CveVentaBonificacion)
|
|
|
|
|
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = GvRow.DataKey("CveVenta").ToEntero(), .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
|
|
|
|
|
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = CveVentaRNCCargo, .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
|
|
|
|
|
Next
|
|
|
|
|
SbFiltro.Remove(SbFiltro.Length - 1, 1)
|
|
|
|
|
SbFiltro.Append(")")
|
|
|
|
|
@@ -24389,9 +24413,9 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
|
|
|
|
|
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
|
|
|
|
|
RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero()
|
|
|
|
|
RowBonificacion("CveVentaRNCCargo") = CveVentaRNCCargo
|
|
|
|
|
|
|
|
|
|
If ChkAplicarRNC.Checked Then
|
|
|
|
|
If AplicarRNC Then
|
|
|
|
|
TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
|
|
|
|
|
Else
|
|
|
|
|
For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString())
|
|
|
|
|
@@ -24415,12 +24439,16 @@ Partial Class Ventas
|
|
|
|
|
LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal())
|
|
|
|
|
|
|
|
|
|
UpDescNC.Update()
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
Protected Sub ChkAplicarNCBon_CheckedChanged(sender As Object, e As EventArgs)
|
|
|
|
|
Dim ChkAplicarRNC As CheckBox = DirectCast(sender, CheckBox)
|
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(ChkAplicarRNC.NamingContainer, GridViewRow)
|
|
|
|
|
|
|
|
|
|
CargaBonificaciones(GvRow.DataKey("CveVenta").ToEntero(), ChkAplicarRNC.Checked)
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub CargaBonificaciones(CveVentaRNCCargo As Integer, AplicarRNC As Boolean)
|
|
|
|
|
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
|
|
|
|
|
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
|
|
|
|
|
End If
|
|
|
|
|
@@ -24430,16 +24458,18 @@ Partial Class Ventas
|
|
|
|
|
Dim SbFiltro As New StringBuilder()
|
|
|
|
|
SbFiltro.Append("CveVenta IN(")
|
|
|
|
|
Using ObjAcum As New ClsAcumuladores
|
|
|
|
|
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then
|
|
|
|
|
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNCCargo) Then
|
|
|
|
|
DtBon = ObjAcum.DtResultados.Copy()
|
|
|
|
|
End If
|
|
|
|
|
End Using
|
|
|
|
|
|
|
|
|
|
If DtBon IsNot Nothing Then
|
|
|
|
|
Dim queryBonificacion = From dr In DtBon
|
|
|
|
|
Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero
|
|
|
|
|
Where dr("CveVentaBonificacion").ToString().ToEntero > 0
|
|
|
|
|
Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero, CveVenta = dr("CveVenta").ToString().ToEntero
|
|
|
|
|
Into x = Group
|
|
|
|
|
Select New With {
|
|
|
|
|
.CveVentaRNCCargo = CveVenta,
|
|
|
|
|
.CveVentaBonificacion = CveVentaBonificacion,
|
|
|
|
|
.ImporteBonificacion = x.Sum(Function(s) s("ImporteBonificacion").ToString().ToDecimal),
|
|
|
|
|
.IVABonificacion = x.Sum(Function(s) s("IVABonificacion").ToString().ToDecimal)
|
|
|
|
|
@@ -24447,7 +24477,7 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
For Each bon In queryBonificacion
|
|
|
|
|
SbFiltro.AppendFormat("'{0}',", bon.CveVentaBonificacion)
|
|
|
|
|
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = GvRow.DataKey("CveVenta").ToEntero(), .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
|
|
|
|
|
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = bon.CveVentaRNCCargo, .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
|
|
|
|
|
Next
|
|
|
|
|
SbFiltro.Remove(SbFiltro.Length - 1, 1)
|
|
|
|
|
SbFiltro.Append(")")
|
|
|
|
|
@@ -24461,9 +24491,9 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
|
|
|
|
|
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
|
|
|
|
|
RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero()
|
|
|
|
|
RowBonificacion("CveVentaRNCCargo") = CveVentaRNCCargo
|
|
|
|
|
|
|
|
|
|
If ChkAplicarRNC.Checked Then
|
|
|
|
|
If AplicarRNC Then
|
|
|
|
|
TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
|
|
|
|
|
Else
|
|
|
|
|
For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString())
|
|
|
|
|
@@ -24487,7 +24517,6 @@ Partial Class Ventas
|
|
|
|
|
LtlSMUBon.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal())
|
|
|
|
|
|
|
|
|
|
UpModalRemisionesNC.Update()
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
Protected Sub GvDescNCCargos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCCargos.RowDataBound
|
|
|
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
|
@@ -24523,6 +24552,12 @@ Partial Class Ventas
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
Protected Sub GvRemisionesNCBon_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNCBon.RowDataBound
|
|
|
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
|
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
|
|
|
|
|
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCBonChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Protected Sub DdlNCNivelImporte_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
|
|
|
Dim ImporteReferencia As Double = 0, PorcentajeMaximo As Double = 0
|
|
|
|
|
@@ -24910,7 +24945,7 @@ Partial Class Ventas
|
|
|
|
|
Dim TotalAcumuladoRNC As Decimal = 0
|
|
|
|
|
Dim Terminar As Boolean = False
|
|
|
|
|
|
|
|
|
|
For Each RowUsado As DataRow In RNC.DtDetalle.Rows
|
|
|
|
|
For Each RowUsado As DataRow In RNC.DtDetalle.FiltraParametros("", Orderby:="PU").Rows
|
|
|
|
|
|
|
|
|
|
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal()
|
|
|
|
|
|
|
|
|
|
@@ -24994,7 +25029,7 @@ Partial Class Ventas
|
|
|
|
|
Dim TotalAcumuladoRNC As Decimal = 0
|
|
|
|
|
Dim Terminar As Boolean = False
|
|
|
|
|
|
|
|
|
|
For Each RowUsado As DataRow In Me.TmpDTRNCDetalleSelecciondas.FiltraParametros($"CveVenta={RNC.CveVenta}").Rows
|
|
|
|
|
For Each RowUsado As DataRow In Me.TmpDTRNCDetalleSelecciondas.FiltraParametros($"CveVenta={RNC.CveVenta}", Orderby:="PU").Rows
|
|
|
|
|
|
|
|
|
|
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal()
|
|
|
|
|
|
|
|
|
|
@@ -25087,7 +25122,7 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
Dim RNCCargo = ListaNC.Where(Function(f) f.CveVenta = RNCBonificacion.CveVentaRNCCargo).FirstOrDefault()
|
|
|
|
|
|
|
|
|
|
For Each RowCargo As DataRow In RNCCargo.DtDetalle.Rows
|
|
|
|
|
For Each RowCargo As DataRow In RNCCargo.DtDetalle.FiltraParametros("", Orderby:="PU").Rows
|
|
|
|
|
|
|
|
|
|
Dim PorcentajeAplicado = (RNCBonificacion.TotalRemNCAplicado / RNCBonificacion.Total)
|
|
|
|
|
|
|
|
|
|
@@ -26499,8 +26534,12 @@ Partial Class Ventas
|
|
|
|
|
If Not DtCotizaciones.Columns.Contains("Aplicado") Then
|
|
|
|
|
DtCotizaciones.Columns.Add("Aplicado", Type.GetType("System.Boolean"))
|
|
|
|
|
End If
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
|
|
|
|
GvCotPS.DataSource = DtCotizaciones.FiltraParametros("Cantidad > 0 AND EsAcumulador = False")
|
|
|
|
|
Else
|
|
|
|
|
GvCotPS.DataSource = DtCotizaciones.FiltraParametros("Cantidad > 0")
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
GvCotPS.DataSource = DtCotizaciones.FiltraParametros("Cantidad > 0")
|
|
|
|
|
End If
|
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
|
GvCotPS.DataBind()
|
|
|
|
|
@@ -26568,6 +26607,11 @@ Partial Class Ventas
|
|
|
|
|
For Each row As DataRow In DTSeleccionadas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
|
|
|
|
|
CotizacionesLista.Add(row("CveVenta").ToString().ToEntero())
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
|
|
|
|
CalculaUsadosCotizacion(Cves, DTSeleccionadas, DtCotizaciones)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
For Each row As DataRow In DTSeleccionadas.Rows
|
|
|
|
|
If CveMetodoPago <> -1 And row("CveMetodoPago33").ToString().ToEntero() <> CveMetodoPago Then
|
|
|
|
|
@@ -26612,6 +26656,74 @@ Partial Class Ventas
|
|
|
|
|
UpPS.Update()
|
|
|
|
|
UpParametros.Update()
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub CalculaUsadosCotizacion(ByRef SbVentasDetalle As StringBuilder, ByVal DTSeleccionadas As DataTable, ByVal DtCotizaciones As DataTable)
|
|
|
|
|
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then
|
|
|
|
|
|
|
|
|
|
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
|
|
|
|
|
|
|
|
|
Dim DTCvePSCostos As DataTable = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
|
|
|
|
|
|
|
|
|
|
Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray()
|
|
|
|
|
|
|
|
|
|
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
|
|
|
|
|
|
|
|
|
DTPSTemp.Columns.Add("CveVenta", GetType(Integer))
|
|
|
|
|
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
|
|
|
|
|
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
|
|
|
|
|
DTPSTemp.Columns.Add("PU", GetType(Decimal))
|
|
|
|
|
|
|
|
|
|
For Each DrowPartidas As DataRow In TmpDTCalculo
|
|
|
|
|
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString().ToEntero()
|
|
|
|
|
Dim CveVenta As Integer = DrowPartidas("CveVenta").ToString().ToEntero()
|
|
|
|
|
|
|
|
|
|
If CveTamanioTemp > 0 Then
|
|
|
|
|
|
|
|
|
|
Dim DTTamanioTemp As New DataTable
|
|
|
|
|
Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString().ToEntero()
|
|
|
|
|
|
|
|
|
|
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
|
|
|
|
|
|
|
|
|
|
If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
|
|
|
|
|
|
|
|
|
|
For Each dRowUpdate As DataRow In DTPSTemp.Rows
|
|
|
|
|
|
|
|
|
|
If (dRowUpdate("CvePS").ToString().ToEntero() = CvePsTemp) Then
|
|
|
|
|
dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString().ToDecimal + DrowPartidas("Cantidad").ToString().ToDecimal
|
|
|
|
|
dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString().ToDecimal + ImporteCargo
|
|
|
|
|
dRowUpdate("CveVenta") = CveVenta
|
|
|
|
|
End If
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
DTPSTemp.AcceptChanges()
|
|
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
|
|
|
|
|
|
|
|
|
|
dRowNuevo("CvePS") = CvePsTemp
|
|
|
|
|
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString().ToDecimal
|
|
|
|
|
dRowNuevo("PU") = Cargo
|
|
|
|
|
dRowNuevo("CveVenta") = CveVenta
|
|
|
|
|
|
|
|
|
|
DTPSTemp.Rows.Add(dRowNuevo)
|
|
|
|
|
DTPSTemp.AcceptChanges()
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
|
|
|
|
|
|
|
|
|
|
If drowPsTamaños("PU").ToString().ToDecimal > 0 Then
|
|
|
|
|
|
|
|
|
|
Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero()
|
|
|
|
|
SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado)
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
Private Sub VerificaCotizaciones(ByRef dt As DataTable)
|
|
|
|
|
If ChkCotProductos.Checked Then
|
|
|
|
|
For Each Gvr As GridViewRow In GvCotPS.Rows
|
|
|
|
|
@@ -28382,13 +28494,15 @@ Partial Class Ventas
|
|
|
|
|
End Sub
|
|
|
|
|
Protected Sub BtnAplicarDesc_Click(sender As Object, e As EventArgs)
|
|
|
|
|
Try
|
|
|
|
|
Dim CveSATNC = "84111506"
|
|
|
|
|
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
|
|
|
|
|
|
|
|
|
|
Dim DrPS As DataRow = Nothing
|
|
|
|
|
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
|
|
|
|
|
If ArrayNC.Length > 0 Then
|
|
|
|
|
Dim CvePSNC As Integer = ArrayNC(0).ToEntero()
|
|
|
|
|
If ArrayNC.Length >= 4 Then
|
|
|
|
|
Dim CvePSNC As Integer = ArrayNC(3).ToEntero()
|
|
|
|
|
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSNC, AplicaParaVenta:=1).Rows(0)
|
|
|
|
|
Else
|
|
|
|
|
Dim CveSATNC = "84111506"
|
|
|
|
|
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
If DrPS Is Nothing Then
|
|
|
|
|
@@ -28431,7 +28545,7 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
'SI TIENE ALGUN AJUSTE O GARANTIA
|
|
|
|
|
If ListaNCDesc.Any(Function(RNC) RNC.Num2 = 1) Then
|
|
|
|
|
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
|
|
|
|
|
For Each RNC In ListaNCDesc.Where(Function(x) x.Num2 = 1)
|
|
|
|
|
Dim Salir As Boolean = False
|
|
|
|
|
|
|
|
|
|
Dim NCAjuste As Integer = -1
|
|
|
|
|
@@ -28496,9 +28610,12 @@ Partial Class Ventas
|
|
|
|
|
ListaNCDesc.Clear()
|
|
|
|
|
Exit Sub
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Dim TotalProntoPago As Decimal = TmpDT.SUM("ImporteProntoPago").ToDecimal
|
|
|
|
|
|
|
|
|
|
HdnTotalRNC.Value = TotalRemNCAplicado.ToString()
|
|
|
|
|
LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero
|
|
|
|
|
LblTotalNC.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado).FormatoNumero
|
|
|
|
|
LblTotalAPagar.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado - TotalProntoPago).FormatoNumero
|
|
|
|
|
|
|
|
|
|
Dim CvePS = DrPS("CvePS").ToString().ToEntero()
|
|
|
|
|
|
|
|
|
|
@@ -29415,7 +29532,7 @@ Partial Class Ventas
|
|
|
|
|
DtImpuestos.AcceptChanges()
|
|
|
|
|
Dim AcumuladoNC As Decimal = 0
|
|
|
|
|
|
|
|
|
|
DtImpuestos.Merge(CargaDtImpuestosNC(ObjFactura.CveVenta, ObjFactura.DescuentoProntoPago), True, MissingSchemaAction.Ignore)
|
|
|
|
|
DtImpuestos.Merge(CargaDtImpuestosNCProntoPago(ObjFactura.CveVenta, ObjFactura.DescuentoProntoPago), True, MissingSchemaAction.Ignore)
|
|
|
|
|
|
|
|
|
|
DtImpuestos = CargaTotalesImpuestosProntoPago(DtImpuestos)
|
|
|
|
|
|
|
|
|
|
|