--Cortes con subproyectos

--Fix varios
This commit is contained in:
2024-06-17 09:45:03 -07:00
parent 8868df292b
commit c3c8a6754d
3 changed files with 69 additions and 20 deletions

View File

@@ -269,7 +269,7 @@ Public Class ClsPuntoVenta
Return Retorno
End Function
Public Function AddVtaCortes(FechaInicial As DateTime, ImporteInicial As Decimal, CveUsuario As Integer, Descripcion As String, CveEmpresa As Integer) As Boolean
Public Function AddVtaCortes(FechaInicial As DateTime, ImporteInicial As Decimal, CveUsuario As Integer, Descripcion As String, CveEmpresa As Integer, CveSubProyecto As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_CortesAdd")
@@ -278,7 +278,8 @@ Public Class ClsPuntoVenta
.Add("@ImporteInicial", SqlDbType.Money).Value = ImporteInicial
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveCorte", SqlDbType.Int).Direction = ParameterDirection.Output
End With

View File

@@ -4932,6 +4932,15 @@
<td colspan="1">&nbsp;</td>
<td colspan="1">&nbsp;</td>
</tr>
<tr align="left">
<td>
<asp:Label runat="server" Font-Bold="true" ID="Label3">Sucursal:</asp:Label>
</td>
<td>
<asp:DropDownList ID="DdlSucursalCorte" AutoPostBack="True" runat="server" CssClass="form-control input-sm" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Width="170px"></asp:DropDownList>
</td>
</tr>
<tr>
<td colspan="1">
<asp:Label runat="server" Text="Dinero En Caja:" Font-Bold="true" Width="120px" />
@@ -8930,7 +8939,7 @@
</div>
<%-- MODAL PS ADICIONALES --%>
<div id="DivSimilares" class="modal ADS fade" role="dialog" style="z-index:9999;">
<div id="DivSimilares" class="modal ADS fade" role="dialog" style="z-index: 9999;">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpSimilares" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>

View File

@@ -3808,9 +3808,15 @@ Partial Class Ventas
End If
End Sub
Private Sub BtnIniciarTurno_Click(sender As Object, e As EventArgs) Handles BtnIniciarTurno.Click
If DdlSucursalCorte.SelectedValue.ToEntero() <= 0 Then
Alert("Debe seleccionar una sucursal.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim ObjPVenta As New ClsPuntoVenta
ObjPVenta.AddVtaCortes(NowADS(), TxtDineroCaja.Text.ToDecimal, UsuarioActual.CveUsuario, TxtDescripcionCaja.Text, UsuarioActual.CveEmpresa)
ObjPVenta.AddVtaCortes(NowADS(), TxtDineroCaja.Text.ToDecimal, UsuarioActual.CveUsuario, TxtDescripcionCaja.Text, UsuarioActual.CveEmpresa, DdlSucursalCorte.SelectedValue.ToEntero())
CveCorte = ObjPVenta.CveCorte
LblEstatusCaja.Text = NowADS().ToShortDateString
TrEstatusCaja.Visible = True
@@ -6750,6 +6756,11 @@ Partial Class Ventas
Me.PermiteCredito = ObjCliente.PermiteCredito
LnkAgregarCliente.Visible = False
'SI EL CLIENTE ES DIFERENTE DEL PREDETERMINADO Y PERMITE CREDITO, REGRESAR EL METODO DE PAGO A CREDITO
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso UsuarioActual.Empresa.Funcionalidad(714).ToEntero() > 0 AndAlso CveCliente <> UsuarioActual.Empresa.Funcionalidad(714).ToEntero() AndAlso RBLPago.SelectedValue = "2" AndAlso Me.PermiteCredito Then
RBLPago.SelectedValue = "1"
End If
If UsuarioActual.Empresa.Funcionalidad(714) <> "" Then 'cuando inicia cargado con el cliente. publico general
LnkAgregarCliente.Visible = True
End If
@@ -8299,6 +8310,11 @@ Partial Class Ventas
DdlSubProyectoFiltroAF.DataBind()
DdlSubProyectoFiltroAF.Items.Insert(0, New ListItem("Todos", "-1"))
DdlSucursalCorte.DataSource = dtt.FiltraParametros("EsSucursal = True ")
DdlSucursalCorte.DataBind()
DdlSucursalCorte.SelectedValueExist(UsuarioActual.CveSubProyecto)
DdlSucursalCorte.Items.Insert(0, New ListItem("Seleccione", "-1"))
dtt.Dispose()
End Sub
Private Sub CargaClasificaciones()
@@ -10719,6 +10735,8 @@ Partial Class Ventas
If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA")) Then
ObjVentas.Commit()
BtnEmitirImprimir.Visible = False
ObjFactura.DtDetalle = TmpDT 'actualiza por cambios de pedimentos.
ObjFactura.Timbre = PreParaTimbre(ObjFactura)
@@ -13177,6 +13195,12 @@ Partial Class Ventas
End If
End If
'SI ES DEVOLUCION DIRECTA, SIN RELACION A UNA FACTURA
'If UsuarioActual.CveEmpresa.Contiene(1, 192) AndAlso DdlTipoComprobante.SelectedValue = "Dev" AndAlso CveVentaDevolucion <= 0 AndAlso Timbre.CFDIRelacionados.UUID.Count = 0 Then
' Timbre.CFDIRelacionados.TipoRelacion = ""
' Timbre.CFDIRelacionados.TipoRelacionTexto = ""
'End If
'SI LAS FACTURAS SE RELACIONARAN MANUALMENTE SE AGREGAN
If Me.AplicaRelacionManual AndAlso DdlTipoRelacionARelacionar.SelectedValue.ToEntero() > 0 Then
@@ -13809,22 +13833,20 @@ Partial Class Ventas
End If
'VALIDA ENTREGA POR ADELANTADO
If UsuarioActual.Empresa.Funcionalidad(145) = "1" Then 'If UsuarioActual.CveEmpresa.Contiene(4, 72, 80, 119) Then
'INCRUSTAMOS ALMACEN ENTREGA POR ADELANTADO CUANDO SEA REMISION Y NO TRAIGA ASIGNADO POR EL USUARIO
If CveAlmacenTraspasoDestino <= 0 And factura.TipoDocto = "Rem" Then
CveAlmacenTraspasoDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 10 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()
End If
'INCRUSTAMOS ALMACEN ENTREGA POR ADELANTADO CUANDO SEA REMISION Y NO TRAIGA ASIGNADO POR EL USUARIO
If CveAlmacenTraspasoDestino <= 0 And factura.TipoDocto = "Rem" Then
CveAlmacenTraspasoDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 10 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()
End If
'SI LA SUCURSAL NO TIENE ENTREGA POR ADELANTADO
If CveAlmacenTraspasoDestino <= 0 And factura.TipoDocto = "Rem" Then
ErrorList.Add("Ocurrió un error al seleccionar el almacen de entrega por adelantado de la sucursal.")
End If
'SI LA SUCURSAL NO TIENE ENTREGA POR ADELANTADO
If CveAlmacenTraspasoDestino <= 0 And factura.TipoDocto = "Rem" Then
ErrorList.Add("Ocurrió un error al seleccionar el almacen de entrega por adelantado de la sucursal.")
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
If factura.TipoDocto = "RNC" And CveVentaDevolucion > 0 Then
CveAlmacenTraspasoOrigen = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 10 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()
CveAlmacenTraspasoDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 1 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
If factura.TipoDocto = "RNC" And CveVentaDevolucion > 0 Then
CveAlmacenTraspasoOrigen = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 10 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()
CveAlmacenTraspasoDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 1 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()
End If
End If
@@ -16274,7 +16296,7 @@ Partial Class Ventas
End If
If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso factura.TipoDocto.Contiene("Rem") AndAlso DivAlmacen.Visible AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then
If UsuarioActual.CveEmpresa <> 189 AndAlso UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso factura.TipoDocto.Contiene("Rem") AndAlso DivAlmacen.Visible AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then
Dim DebeGenerarMovimiento As Boolean = TmpDTDetalle.COUNT("CvePS", "CveTipoPS = 2") > 0
@@ -20249,6 +20271,12 @@ Partial Class Ventas
'Puede Hacer Devolución
If Not UsuarioActual.TienePermisoProceso(264) Then
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev"))
Else
'If UsuarioActual.CveEmpresa.Contiene(1, 192) Then
' If DdlTipoComprobante.Items.FindByValue("Dev") Is Nothing Then
' DdlTipoComprobante.Items.Add(New ListItem("Devolución", "Dev"))
' End If
'End If
End If
'Puede facturar
@@ -38370,7 +38398,18 @@ Partial Class Ventas
End Sub
Private Sub RecalculaPrecios()
If TmpDT IsNot Nothing AndAlso (CveVenta <= 0 OrElse EsCreaApartirDe OrElse ModalidadEdicion) Then
Dim PuedeRecalcular As Boolean = False
If CveVenta <= 0 OrElse EsCreaApartirDe OrElse (ModalidadEdicion AndAlso Not DdlTipoComprobante.SelectedValue = "Cot") Then
PuedeRecalcular = True
End If
'SI ES FACTURACION DE COTIZACION, NO PERMITIR CAMBIAR LISTA DE PRECIO
If DtCotizacionesPS IsNot Nothing AndAlso DtCotizacionesPS.Rows.Count > 0 Then
PuedeRecalcular = False
End If
If TmpDT IsNot Nothing AndAlso PuedeRecalcular Then
For Each Row As DataRow In TmpDT.Rows
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
Dim CveClasificacion As Integer = Row("CveClasificacion").ToString().ToEntero