This commit is contained in:
2024-02-12 05:46:08 -07:00
12 changed files with 629 additions and 227 deletions

View File

@@ -539,6 +539,20 @@ Partial Class Ventas
End Get
End Property
Private Property CveClienteOS As Integer
Get
If ViewState("CveClienteOS") Is Nothing Then
ViewState("CveClienteOS") = -1
End If
Return ViewState("CveClienteOS").ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveClienteOS") = value
End Set
End Property
Private Property CveClienteSucursal As Integer
Get
If ViewState("CveClienteSucursal") Is Nothing Then
@@ -2567,6 +2581,7 @@ Partial Class Ventas
TabAlmacen.Enabled = UsuarioActual.Empresa.UsaInventarios
TxtPorDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
TxtPorPS.Attributes.Add("onKeyUp", "CalculaDescPS();")
CreaDTmpC()
CreaDTmpF()
@@ -8245,6 +8260,10 @@ Partial Class Ventas
e.Row.FCLinkButton("imgE").Visible = True
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso UsuarioActual.TienePermisoProceso(374) Then
e.Row.FCLinkButton("LnkDescuentos").Visible = True
End If
'If GvInv.Rows.Count > 0 AndAlso ModalidadEdicion AndAlso DdlTipoComprobante.SelectedValue = "Rem" AndAlso e.Row.DataKey("CveVentaDetalle").ToString().ToEntero() > 0 Then
' e.Row.FCLinkButton("imgE").Enabled = False
' e.Row.FCLinkButton("imgE").ToolTip = "No se puede editar debido a que ya hay un movimiento de almacen."
@@ -23888,7 +23907,6 @@ Partial Class Ventas
Dim RowNum As Integer = Convert.ToInt32(e.CommandArgument)
Dim GvRow As GridViewRow = GvPS.Rows(RowNum)
If (GvRow.RowState = DataControlRowState.Edit OrElse GvRow.RowState = 5) Then
TxtCantidad.Text = GvRow.FCTextBox("TxtCantidad").Text
DdlClasificacion.SelectedValue = GvRow.FCDropDownList("DdlClasificacion").SelectedValue
@@ -23914,6 +23932,32 @@ Partial Class Ventas
RegistraScript("Recalcula();")
LbAgregar_Click(Nothing, Nothing)
ElseIf e.CommandName = "Descuento" Then
LblSubtotalDescPS.Text = ""
LblTotalDescPS.Text = ""
LblTituloDesc.Text = "Descuento"
HdnConsecPS.Value = "-1"
HdnTotalCompra.Value = ""
TxtPorPS.Text = ""
LblIVADescPS.Text = ""
Dim GvRow As GridViewRow = GvPS.Rows(e.CommandArgument.ToString().ToEntero())
LblTituloDesc.Text = $"Descuento: {GvRow.DataKey("PS")}"
HdnConsecPS.Value = GvRow.DataKey("Consec")
LblSubtotalDescPS.Text = (GvRow.DataKey("Total").ToDecimal()).FormatoNumero()
LblTotalDescPS.Text = (GvRow.DataKey("Total").ToDecimal() + GvRow.DataKey("ImporteIVA").ToDecimal()).FormatoNumero()
LblIVADescPS.Text = GvRow.DataKey("ImporteIVA").FormatoNumero()
Using ObjPS As New ClsProductosServicios
Dim PrecioCompra = ObjPS.GetUltimoPrecioCompra(UsuarioActual.CveEmpresa, GvRow.DataKey("CvePS").ToEntero())
If PrecioCompra > 0 Then
HdnTotalCompra.Value = (PrecioCompra * GvRow.DataKey("Cantidad").ToDouble() * 1.16).ToString()
End If
End Using
UpDescPS.Update()
RegistraScript("$('#ModalDescPS').modal({backdrop: 'static', keyboard: false});")
Else
DdlPS_SelectedIndexChanged(Nothing, Nothing)
End If
@@ -36273,6 +36317,17 @@ Partial Class Ventas
DdlClienteSucursal.DataBind()
DdlClienteSucursal.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
Dim EsWS As Boolean = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False)
If EsWS Then
DdlClientesModal.setEsWebService(True)
Else
DdlClientesModal.setEsWebService(False)
DdlClientesModal.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1)
DdlClientesModal.DataBind()
DdlClientesModal.ddl.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
End If
End Sub
Protected Sub ChkRequiereTecnico_CheckedChanged(sender As Object, e As EventArgs)
@@ -36289,7 +36344,7 @@ Partial Class Ventas
If RBLTipoVenta.SelectedValue.ToEntero > 0 Then
DvModalTipoVentaPasoTipo.Visible = False
DvModalTipoVentaPasoCliente.Visible = True
DvModalTipoVentaClientesucursal.Visible = True
DvModalTipoVentaPasoRequiereOS.Visible = True
DvModalTipoVentaPasoMedicoProcedimiento.Visible = True
@@ -36315,6 +36370,7 @@ Partial Class Ventas
ChkRequiereTecnicoModal.Checked = True
ChkRequiereTecnicoModal.Enabled = False
DvModalRequiereOSFecha.Visible = True
DvModalTipoVentaCliente.Visible = True
Case "3" 'A-Vista
ChkRequiereTecnicoModal.Checked = False
DvModalTipoVentaPasoRequiereOS.Visible = False
@@ -36404,7 +36460,8 @@ Partial Class Ventas
LnkDvModalTipoVentaAceptar.Visible = False
DvModalTipoVentaPasoTipo.Visible = True
DvModalTipoVentaPasoCliente.Visible = False
DvModalTipoVentaClientesucursal.Visible = False
DvModalTipoVentaCliente.Visible = False
DvModalTipoVentaPasoRequiereOS.Visible = False
DvModalTipoVentaPasoMedicoProcedimiento.Visible = False
@@ -36437,15 +36494,35 @@ Partial Class Ventas
Protected Sub LnkDvModalTipoVentaAceptar_Click(sender As Object, e As EventArgs)
If RBLTipoVenta.SelectedValue.ToEntero = 2 Then
If DdlClientesModal.SelectedValue.ToEntero > 0 Then
ViewState("CveCliente") = DdlClientesModal.SelectedValue.ToEntero
Else
Alert("Debe de seleccionar un cliente.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DdlClienteSucursalCliente() > 0 Then
ViewState("CveCliente") = DdlClienteSucursalCliente()
If DdlClienteSucursalCliente() > 0 Then
CveClienteOS = DdlClienteSucursalCliente()
Else
Alert("Debe de seleccionar un hospital.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Else
Alert("Debe de seleccionar un cliente.", TipoMensaje.MsgAdvertencia)
Exit Sub
If DdlClienteSucursalCliente() > 0 Then
ViewState("CveCliente") = DdlClienteSucursalCliente()
CveClienteOS = CveCliente
Else
Alert("Debe de seleccionar un cliente.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
If ChkRequiereTecnicoModal.Checked Then
If Not IsDate(TxtFechaModal.Text.Replace(",", "")) Then
Alert("El campo fecha no es valido.", TipoMensaje.MsgAdvertencia)
@@ -36657,7 +36734,7 @@ Partial Class Ventas
Dim EstatusOrdenServicio As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 1").ToEntero
If ObjOrdenServicio.AddOrdenesServicios(CveCliente, DdlSubProyectoDatos.SelectedValue.ToEntero, UsuarioActual.Nombre, TxtFechaOS.Text.Replace(",", "").ToDateTime, $"Venta: {LblSerie.Text}-{TxtFolio.Text}", UsuarioActual.CveUsuario, EstatusOrdenServicio,
If ObjOrdenServicio.AddOrdenesServicios(CveClienteOS, DdlSubProyectoDatos.SelectedValue.ToEntero, UsuarioActual.Nombre, TxtFechaOS.Text.Replace(",", "").ToDateTime, $"Venta: {LblSerie.Text}-{TxtFolio.Text}", UsuarioActual.CveUsuario, EstatusOrdenServicio,
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVentaOS, -1, -1, CveOSTipo, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero,
Direccion:="", Telefono:="", CveModeloAuto:=-1, Año:="", CveMedico:=DdlMedico.SelectedValue.ToEntero,
CveProcedimiento:=DdlProcedimiento.SelectedValue.ToEntero, CveTipoVenta:=RBLTipoVenta.SelectedValue.ToEntero, FechaCita:=TxtFechaOS.Text.Replace(",", "").ToDateTime,
@@ -36811,6 +36888,20 @@ Partial Class Ventas
Protected Sub TxtFechaAnticipoCliente_TextChanged(sender As Object, e As EventArgs)
CargaAnticipos(CveCliente)
End Sub
Protected Sub BtnPorPS_Click(sender As Object, e As EventArgs)
If HdnDescPS.Value.ToEntero() > 0 Then
Dim RowUpdate As DataRow = TmpDT.Select($"Consec = {HdnConsecPS.Value}").FirstOrDefault()
If RowUpdate IsNot Nothing Then
RowUpdate("Descuento") = HdnDescPS.Value.ToDecimal()
RowUpdate("ImporteIVA") = LblIVADescPS.Text.ToDecimal()
CalculaTotalesVenta()
RegistraScript("$('#ModalDescPS').modal('hide');")
End If
Else
Alert("No se pudo aplicar el descuento", TipoMensaje.MsgAdvertencia)
End If
End Sub
End Class