From 2c4d8cca9af740d386575566834ccfc342d1973b Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 9 Feb 2024 14:58:12 -0700 Subject: [PATCH 1/2] =?UTF-8?q?--FERRETERA.=20crear=20la=20impresi=C3=B3n?= =?UTF-8?q?=20de=20etiquetas=20de=20productos=20y=20precios,=20campo=20nue?= =?UTF-8?q?vo.=20en=20PS=20(producto=20de=20exhibici=C3=B3n)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsProductosServicios.vb | 26 +++++++++++++-- Compras/PopUpVerFactura.aspx.vb | 28 +++++++++++++++- Ventas/ActualizarPrecios.aspx | 2 +- Ventas/ActualizarPrecios.aspx.vb | 55 ++++++++++++++++++++----------- Ventas/ProductosServicios.aspx | 4 +++ Ventas/ProductosServicios.aspx.vb | 9 +++-- 6 files changed, 97 insertions(+), 27 deletions(-) diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index f5a3d51af..cadf04a74 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -413,7 +413,7 @@ Public Class ClsProductosServicios Optional CveMaterialPeligroso As Integer = -1, Optional CveEmbalaje As Integer = -1, Optional PesoKg As Decimal = -1, Optional Dimensiones As String = "", Optional CveObjetoImpuesto As Integer = 0, Optional RegistroRSCO As String = "-1", Optional FechaVigenciaRSCO As Date = MinFecha, Optional VigenciaIndeterminadaRSCO As Boolean = False, Optional CveTipoEmpacado As Integer = -1, Optional CveTipoOrganico As Integer = -1, Optional NombreComercial As String = "", Optional NotasAdicionales As String = "", Optional EcommerceEtiquetas As String = "", Optional ActivoEcommerce As Boolean = False, Optional EcommercePrecio As Decimal = 0, - Optional CveClasificacionEcommerce As Integer = -1, Optional EcommerceCantidad As Decimal = 0, Optional CodigoAlterno As String = "-1", Optional PSAlterno As String = "-1") As Integer + Optional CveClasificacionEcommerce As Integer = -1, Optional EcommerceCantidad As Decimal = 0, Optional CodigoAlterno As String = "-1", Optional PSAlterno As String = "-1", Optional ProductoExhibicion As Boolean = False) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_ProductosServiciosAdd") @@ -521,7 +521,7 @@ Public Class ClsProductosServicios .Add("@CodigoAlterno", SqlDbType.VarChar).Value = CodigoAlterno .Add("@PSAlterno", SqlDbType.VarChar).Value = PSAlterno - + .Add("@ProductoExhibicion", SqlDbType.Bit).Value = ProductoExhibicion End With @@ -658,7 +658,7 @@ Public Class ClsProductosServicios Optional CveMaterialPeligroso As Integer = -1, Optional CveEmbalaje As Integer = -1, Optional PesoKg As Decimal = -1, Optional Dimensiones As String = "", Optional CveObjetoImpuesto As Integer = 0, Optional RegistroRSCO As String = "-1", Optional FechaVigenciaRSCO As Date = MinFecha, Optional VigenciaIndeterminadaRSCO As Boolean = False, Optional CveTipoEmpacado As Integer = -1, Optional CveTipoOrganico As Integer = -1, Optional NombreComercial As String = "", Optional NotasAdicionales As String = "", Optional EcommerceEtiquetas As String = "", Optional ActivoEcommerce As Boolean = False, Optional EcommercePrecio As Decimal = 0, - Optional CveClasificacionEcommerce As Integer = -1, Optional EcommerceCantidad As Decimal = 0, Optional CodigoAlterno As String = "-1", Optional PSAlterno As String = "-1") As Boolean + Optional CveClasificacionEcommerce As Integer = -1, Optional EcommerceCantidad As Decimal = 0, Optional CodigoAlterno As String = "-1", Optional PSAlterno As String = "-1", Optional ProductoExhibicion As Boolean = False) As Boolean Dim Retorno As Boolean = False @@ -765,6 +765,7 @@ Public Class ClsProductosServicios .Add("@EcommerceCantidad", SqlDbType.SmallMoney).Value = EcommerceCantidad .Add("@CodigoAlterno", SqlDbType.VarChar).Value = CodigoAlterno .Add("@PSAlterno", SqlDbType.VarChar).Value = PSAlterno + .Add("@ProductoExhibicion", SqlDbType.Bit).Value = ProductoExhibicion End With Try @@ -2332,6 +2333,25 @@ Public Class ClsProductosServicios Return Retorno End Function + Public Function GetPSPrecios(CvePrecioLista As Integer, Productos As String) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ProductosPreciosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista + .Add("@Productos", SqlDbType.VarChar).Value = Productos + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los precios de los productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + #Region " P S C O M P L E M E N T O S" diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 328071a34..a2f5a8316 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1301,13 +1301,20 @@ Partial Class PopUpVerFactura End If End If - 'IMPRIME VALE + 'IMPRIME ACUSE If UrlParametros("OP").ToString = "CAN" Then If UrlParametros("CVEVTA") IsNot Nothing AndAlso UrlParametros("CVEVTA").ToString.ToEntero > 0 Then ImprimeCancelacion(UrlParametros("CVEVTA").ToString.ToEntero) End If End If + 'IMPRIME ETIQUETA + If UrlParametros("OP").ToString = "ETIQUETA" Then + If UrlParametros("PRODUCTOS") IsNot Nothing AndAlso UrlParametros("CVEPRECIOLISTA").ToString.ToEntero > 0 Then + ImprimeEtiqueta(UrlParametros("PRODUCTOS").ToString, UrlParametros("CVEPRECIOLISTA").ToString.ToEntero) + End If + End If + 'IMPRIME AFR If UrlParametros("OP").ToString = "AFR" Then If UrlParametros("CVEAFR") IsNot Nothing AndAlso UrlParametros("CVEAFR").ToString.ToEntero > 0 Then @@ -6020,6 +6027,25 @@ Partial Class PopUpVerFactura End Sub #End Region +#Region "OP = 'E T I Q U E T A'" + Public Sub ImprimeEtiqueta(CvesProductos As String, CvePrecioLista As Integer) + Dim DtPrecios As DataTable = Nothing + + Dim ObjVentas As New ClsProductosServicios + If ObjVentas.GetPSPrecios(CvePrecioLista, CvesProductos) AndAlso ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + DtPrecios = ObjVentas.DtResultados.Copy() + End If + ObjVentas.Dispose() + + If DtPrecios IsNot Nothing Then + Dim DirectorioArchivo As String = "Empresas/Grales/Formatos/Etiqueta.mrt" + Dim params As New List(Of ReportParameter) + + ImprimirPDFStimul(DirectorioArchivo, DtPrecios, params, "Precios") + End If + + End Sub +#End Region #Region "IMPRESION POLIZAS" diff --git a/Ventas/ActualizarPrecios.aspx b/Ventas/ActualizarPrecios.aspx index dea6d8d1e..5eb90535c 100644 --- a/Ventas/ActualizarPrecios.aspx +++ b/Ventas/ActualizarPrecios.aspx @@ -207,7 +207,7 @@ " style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> - diff --git a/Ventas/ActualizarPrecios.aspx.vb b/Ventas/ActualizarPrecios.aspx.vb index f692f952a..0222be5d3 100644 --- a/Ventas/ActualizarPrecios.aspx.vb +++ b/Ventas/ActualizarPrecios.aspx.vb @@ -296,34 +296,49 @@ Partial Class Ventas_ActualizarPrecios Alert("Se debe de especificar un porcentaje.", TipoMensaje.MsgAdvertencia) Exit Sub End If - Dim Correcto As Boolean = False + Dim TieneError As Boolean = False 'Dim Importe As Decimal = If(TxtImporte.Text = "", -1, TxtImporte.Text.ToDecimal) Dim Porcentaje As Decimal = If(TxtPorcentaje.Text = "", -1, TxtPorcentaje.Text.ToDecimal) - + Dim MensajeAlert As New StringBuilder + Dim sbProductos As New StringBuilder + Dim ObjPS As New ClsProductosServicios ObjPS.IniciaTransacSQL() - - For Each row As GridViewRow In GVPrecios.Rows - - If row.FCCheckBox("chkPS").Checked Then - Correcto = ObjPS.UpdatePSPreciosLista(row.FCTextBox("TxtPrecio").Text.ToDecimal, DdlPrecioLista.SelectedValue.ToEntero, Porcentaje, row.DataKey("CvePS").ToEntero, UsuarioActual.CveUsuario, NowADS(), If(RblTipo.SelectedValue = "Imp", True, False), PrecioMinimo:=row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal) - - If Correcto Then - TieneError = ActualizarPreciosFranquicia(ObjPS, row.DataKey("Codigo"), row.DataKey("PS"), row.FCTextBox("TxtPrecio").Text.ToDecimal, row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal, DdlPrecioLista.SelectedItem.Text) - Else - Exit Sub - End If - End If - - Next - - If Correcto AndAlso Not TieneError Then - Alert("Los Precios de lista de los Productos/Servicios se actualizaron correctamente") - End If + Try + For Each row As GridViewRow In GVPrecios.Rows + If row.FCCheckBox("chkPS").Checked Then + TieneError = Not ObjPS.UpdatePSPreciosLista(row.FCTextBox("TxtPrecio").Text.ToDecimal, DdlPrecioLista.SelectedValue.ToEntero, Porcentaje, row.DataKey("CvePS").ToEntero, UsuarioActual.CveUsuario, NowADS(), If(RblTipo.SelectedValue = "Imp", True, False), PrecioMinimo:=row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal) + If CBool(row.DataKey("ProductoExhibicion")) Then + sbProductos.AppendFormat("{0},", row.DataKey("CvePS").ToEntero) + End If + + + If Not TieneError Then + TieneError = ActualizarPreciosFranquicia(ObjPS, row.DataKey("Codigo"), row.DataKey("PS"), row.FCTextBox("TxtPrecio").Text.ToDecimal, row.FCTextBox("TxtPrecioMinimo").Text.ToDecimal, DdlPrecioLista.SelectedItem.Text) + Else + Exit For + End If + End If + Next + + If Not TieneError Then + If UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso sbProductos.Length > 0 Then + MensajeAlert.AppendFormat("Los precios de lista de los productos/servicios se actualizaron correctamente.
Descargar Etiquetas", Encripta(String.Format("OP=ETIQUETA&CVEPRECIOLISTA={0}&PRODUCTOS={1}", DdlPrecioLista.SelectedValue.ToEntero, sbProductos.ToString()))) + Else + MensajeAlert.Append("Los precios de lista de los productos/servicios se actualizaron correctamente.") + End If + + Alert(MensajeAlert.ToString()) + End If + Catch ex As Exception + TieneError = True + GuardaLog(ex.ToString()) + End Try If TieneError Then ObjPS.RollBack() + Alert("Ocurrió un error al actualizar precios", TipoMensaje.MsgError) Else ObjPS.Commit() End If diff --git a/Ventas/ProductosServicios.aspx b/Ventas/ProductosServicios.aspx index 9739df374..596dacc42 100644 --- a/Ventas/ProductosServicios.aspx +++ b/Ventas/ProductosServicios.aspx @@ -246,6 +246,10 @@ +
+ + +
<%----%> diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 6737c583f..4e568ad27 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -1113,6 +1113,11 @@ Partial Class ProductosyServicios DVCodigoPSAlterno.Visible = True End If + + If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + DivPSExhibicion.Visible = True + ChkPSExhibicion.Checked = CBool(ObjProductosServicios.DtResultados.Rows(0)("ProductoExhibicion").ToString) + End If Else Alert("El Producto o Servicio Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) RegistraScript("$('#C_Tab_TabPaquetes_tab').css('display' , 'none')") @@ -1509,7 +1514,7 @@ Partial Class ProductosyServicios CveMaterialPeligroso:=DdlMaterialPeligroso.SelectedValue.ToEntero, CveEmbalaje:=DdlEmbalaje.SelectedValue.ToEntero, PesoKg:=TxtPesoKg.Text.ToDecimal, Dimensiones:=TxtDimensiones.Text.Trim, CveObjetoImpuesto:=DdlObjetoImpuesto.SelectedValue.ToEntero, Litraje:=TxtLitraje.Text.ToDecimal, RegistroRSCO:=TxtRegistroRSCO.Text, FechaVigenciaRSCO:=TxtFechaVigenciaRSCO.Text.ToDate, VigenciaIndeterminadaRSCO:=ChkFechaIndeterminadaRSCO.Checked, NombreComercial:=TxtNombreComercial.Text.Trim, NotasAdicionales:=TxtEcommerceNota.Text.Trim, EcommerceEtiquetas:=TxtEcommerceEtiquetas.Text.Trim.Replace(".", ""), EcommercePrecio:=TxtEcommercePrecio.Text.Trim.ToDecimal, - CveClasificacionEcommerce:=DdlEcommerceClasificacion.SelectedValue.ToEntero, EcommerceCantidad:=TxtEcommerceCantidad.Text.Trim.ToDecimal, CodigoAlterno:=TxtCodigoAlterno.Text.Trim, PSAlterno:=TxtPSAlterno.Text.Trim) > 0 Then + CveClasificacionEcommerce:=DdlEcommerceClasificacion.SelectedValue.ToEntero, EcommerceCantidad:=TxtEcommerceCantidad.Text.Trim.ToDecimal, CodigoAlterno:=TxtCodigoAlterno.Text.Trim, PSAlterno:=TxtPSAlterno.Text.Trim, ProductoExhibicion:=ChkPSExhibicion.Checked) > 0 Then ViewState("CvePS") = ObjProductosServicios.CvePS For Each GVR As GridViewRow In GvImpuestosLocales.Rows If GVR.FCCheckBox("ChkDeduccion").Checked Then @@ -1583,7 +1588,7 @@ Partial Class ProductosyServicios RegistroRSCO:=TxtRegistroRSCO.Text, FechaVigenciaRSCO:=TxtFechaVigenciaRSCO.Text.ToDate, VigenciaIndeterminadaRSCO:=ChkFechaIndeterminadaRSCO.Checked, NombreComercial:=TxtNombreComercial.Text.Trim, NotasAdicionales:=TxtEcommerceNota.Text.Trim, EcommerceEtiquetas:=TxtEcommerceEtiquetas.Text.Trim.Replace(".", ""), ActivoEcommerce:=ChkActivoEcommerce.Checked, EcommercePrecio:=TxtEcommercePrecio.Text.Trim.ToDecimal, CveClasificacionEcommerce:=DdlEcommerceClasificacion.SelectedValue.ToEntero, EcommerceCantidad:=TxtEcommerceCantidad.Text.Trim.ToDecimal, - CodigoAlterno:=TxtCodigoAlterno.Text.Trim, PSAlterno:=TxtPSAlterno.Text.Trim) Then + CodigoAlterno:=TxtCodigoAlterno.Text.Trim, PSAlterno:=TxtPSAlterno.Text.Trim, ProductoExhibicion:=ChkPSExhibicion.Checked) Then If Not ObjProductosServicios.LimpiaImpuestosLocales(CvePS) Then TieneError = True From 6f7d9e09538ffc8b0825f3539e02f4f40da93fd2 Mon Sep 17 00:00:00 2001 From: AbrahamCastilloV Date: Fri, 9 Feb 2024 16:28:08 -0700 Subject: [PATCH 2/2] -- --- App_Code/ClsContratos.vb | 4 +- App_Code/ClsPaginas.vb | 1 + Ashx/CargaEventos.ashx | 11 +- Transportes/RepContratos - Copy.aspx | 361 +++++++++++++++++++++ Transportes/RepContratos - Copy.aspx.vb | 159 +++++++++ Transportes/RepContratos.aspx | 211 +++++------- Transportes/RepContratos.aspx.vb | 106 +++--- Transportes/RepContratosCalendario.aspx | 29 +- Transportes/RepContratosCalendario.aspx.vb | 43 +-- 9 files changed, 694 insertions(+), 231 deletions(-) create mode 100644 Transportes/RepContratos - Copy.aspx create mode 100644 Transportes/RepContratos - Copy.aspx.vb diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index 5b6c87d55..c56dffb17 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -4,7 +4,6 @@ Option Explicit On Imports System.Data Imports System.Data.SqlClient Imports Extensiones -Imports Profact.TimbraCFDI40 Public Class ClsContratos Implements IDisposable @@ -323,7 +322,7 @@ Public Class ClsContratos Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CvePeriodo As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, Optional DiaMesFacturacion As Integer = 1, Optional ObservacionesGenerales As String = "", - Optional CveTipoAF As Integer = -1, Optional CveChofer As Integer = -1, Optional CveAF As Integer = -1) As Integer + Optional CveTipoAF As Integer = -1, Optional CveChofer As Integer = -1, Optional CveAF As Integer = -1, Optional CantidadPasajeros As Integer = -1) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Con_ContratosAdd") @@ -382,6 +381,7 @@ Public Class ClsContratos .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF .Add("@CveChofer", SqlDbType.Int).Value = CveChofer .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CantidadPasajeros", SqlDbType.Int).Value = CantidadPasajeros End With diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index dbba3a3cd..d2298ba08 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -10812,6 +10812,7 @@ Public Class ClsPaginas #Region "Transportes" PaginaDict.Add("/Transportes/RepContratos.aspx".ToUpper(), 598) + PaginaDict.Add("/Transportes/RepContratosDetalles.aspx".ToUpper(), 598) PaginaDict.Add("/Transportes/RepViajes.aspx".ToUpper(), 599) PaginaDict.Add("/Transportes/Boletos.aspx".ToUpper(), 600) PaginaDict.Add("/Transportes/RepBoletos.aspx".ToUpper(), 601) diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index 344297e94..84be4f7ec 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -457,8 +457,6 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState For Each dr As DataRow In ObjContratos.DtResultados.Rows Dim cevent As CalendarEvent = New CalendarEvent() - Dim estatus As Integer = dr("EstatusContrato").ToString.ToEntero - cevent.id = dr("CveContrato").ToString.ToEntero cevent.title = dr("DescripcionContrato").ToString cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime) @@ -471,15 +469,8 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.Pesos = dr("ImporteMax").ToString.ToDecimal cevent.Anticipo = dr("ImporteMin").ToString.ToDecimal cevent.CveActivoFijo = dr("CveAF").ToString.ToEntero + cevent.backgroundColor = dr("BackgroundColor").ToString - Select Case estatus - Case 1 - cevent.backgroundColor = "#00A56A" - Case 2 - cevent.backgroundColor = "#2B4FD6" - Case 3 - cevent.backgroundColor = "#EE602E" - End Select diff --git a/Transportes/RepContratos - Copy.aspx b/Transportes/RepContratos - Copy.aspx new file mode 100644 index 000000000..b89700e5b --- /dev/null +++ b/Transportes/RepContratos - Copy.aspx @@ -0,0 +1,361 @@ +<%@ Page Language="VB" AutoEventWireup="true" Title="Transportes V&A - Contratos" + MasterPageFile="~/Site.master" + CodeFile="RepContratos - Copy.aspx.vb" + Inherits="ListadoContratos" %> + + + Listado de Contratos + + + + + + + + + +
  • + Agregar Contrato +
  • +
  • + Generar Excel +
  • +
    + + + +
    +
    + + + + +
    +
    + + + + +
    + +
    + + + + +
    + +
    + + +
    + +
    + +
    + + +
    +
    + + +
    +
    +
    + + + + + + + + + + + + + + Fecha
    + Salida +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + Fecha
    + Regreso +
    + + + +
    + + + + + + + +
    +
    +
    +
    + + + +
    + + diff --git a/Transportes/RepContratos - Copy.aspx.vb b/Transportes/RepContratos - Copy.aspx.vb new file mode 100644 index 000000000..57ecfc736 --- /dev/null +++ b/Transportes/RepContratos - Copy.aspx.vb @@ -0,0 +1,159 @@ +Option Explicit On +Option Strict On +Imports System.Data.SqlClient +Imports Extensiones +Imports Extensiones.ModExtensiones + +Partial Class ListadoContratos + Inherits ClsPaginas + + Private Property CveContrato As Integer + Get + Return ViewState("CveContrato").ToString().ToEntero + End Get + Set(value As Integer) + ViewState("CveContrato") = value + End Set + End Property + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + txtFechaI.Text = DateTime.Now.AddMonths(-1).ToString("MM/dd/yyyy").Replace(" ", "T") + txtFechaF.Text = DateTime.Now.AddDays(7).ToString("MM/dd/yyyy").Replace(" ", "T") + + If Not IsPostBack Then + ViewState("CveContrato") = 0 + InicializaCombos() + CargaDatos() + End If + End Sub + Private Sub InicializaCombos() + 'Lista Tipo AF + DdlTipoAF.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa) + DdlTipoAF.DataBind() + DdlTipoAF.Items.Insert(0, New ListItem("-", "")) + 'Lista Chofer' + DdlChofer.DataSource = GlobalDTRHPersonal(185) + DdlChofer.DataBind() + DdlChofer.Items.Insert(0, New ListItem("-", "")) + UpModal.Update() + End Sub + Private Sub CargaDatos() + Dim ObjContratos As New ClsContratos + If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then + GvContratos.DataSource = ObjContratos.DtResultados + GvContratos.DataBind() + End If + If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then + DdlEstatusConsulta.DataSource = ObjContratos.DtResultados + DdlEstatusConsulta.DataBind() + DdlEstatusConsulta.Items.Insert(0, New ListItem("-", "")) + + End If + UpTitulos.Update() + + End Sub + Protected Sub MostrarModal(Optional Descripcion As String = "", Optional FechaSalida As String = "", Optional FechaRegreso As String = "", Optional Observaciones As String = "", Optional Ubicacion As String = "", Optional Transporte As String = "", Optional CveCliente As Integer = 0, Optional Dolares As String = "", Optional Pesos As String = "", Optional Anticipo As String = "", Optional Boton As String = "Guardar", Optional Chofer As String = "") + + 'DdlClientes.SelectedText = Cliente + TxtDescripcion.Text = Descripcion + TxtUbicacion.Text = Ubicacion + TxtFechaSalida.Text = FechaSalida + TxtFechaRegreso.Text = FechaRegreso + TxtObservaciones.Text = Observaciones + TxtUbicacion.Text = Ubicacion + DdlTipoAF.SelectedValue = Transporte + DdlClientes.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa, -1, CveCliente:=CveCliente).FiltroPrimeroValor("NombreComercial") + DdlClientes.SelectedValue = CveCliente.ToString + DdlChofer.SelectedValue = Chofer + TxtObservaciones.Text = Observaciones + TxtDolares.Text = Math.Round(Dolares.ToDecimal, 2).ToString + TxtPesos.Text = Math.Round(Pesos.ToDecimal, 2).ToString + TxtAnticipo.Text = Math.Round(Anticipo.ToDecimal * 100, 2).ToString + BtnGuardar.Text = Boton + myModalLabel.InnerHtml = $"{Boton} Contrato" + UpModal.Update() + RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar")) + End Sub + Private Sub LBAgregarContrato_Click(sender As Object, e As EventArgs) Handles LBAgregarContrato.Click + MostrarModal() + End Sub + Protected Sub AddContrato(sender As Object, e As EventArgs) + + If DdlClientes.SelectedValue = "" Then + Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim ObjContratos As New ClsContratos + ObjContratos.IniciaTransacSQL() + + + 'Agregar contrato + If BtnGuardar.Text = "Guardar" Then + If ObjContratos.AddContratos("", TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=50, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero) > 0 Then + ObjContratos.Commit() + Alert("Agregado Correctamente.") + End If + End If + + 'Actualizar contrato + If BtnGuardar.Text = "Editar" Then + If ObjContratos.UpdateContratos(CveContrato, "", TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero) Then + + ObjContratos.Commit() + Alert("Actualizado Correctamente.") + End If + End If + + TxtDescripcion.Text = "" + TxtFechaSalida.Text = "" + TxtFechaRegreso.Text = "" + TxtObservaciones.Text = "" + TxtUbicacion.Text = "" + DdlClientes.SelectedText = "" + DdlTipoAF.SelectedValue = "" + DdlChofer.SelectedValue = "" + TxtDolares.Text = "" + TxtPesos.Text = "" + TxtAnticipo.Text = "" + BtnGuardar.Text = "Guardar" + + ObjContratos.Dispose() + CargaDatos() + + End Sub + + Protected Sub LBExcel_Click(sender As Object, e As EventArgs) Handles LBExcel.Click + GvContratos.ExportToExcel("ReporteCompras" & NowADS().ToShortDateString) + End Sub + + Protected Sub Consultar(sender As Object, e As EventArgs) + Dim fechaInicial As String = txtFechaI.Text + Dim fechaFinal As String = txtFechaF.Text + + Dim cliente As String = If(DdlClientesConsulta.SelectedValue = "", "", $"C.CveCliente = {DdlClientesConsulta.SelectedValue} AND") + Dim estatus As String = "" + Dim nombreEstatus As String = "" + Dim innerEstatus As String = "" + If (DdlEstatusConsulta.SelectedValue <> "") Then + estatus = $"C.CveContratosEstatus = {DdlEstatusConsulta.SelectedValue} AND" + nombreEstatus = ", CE.ContratoEstatus As ContratoEstatus1" + innerEstatus = "INNER JOIN Con_ContratosEstatus CE with(nolock) ON CE.CveContratoEstatus = C.CveContratosEstatus +" + End If + Dim intervalo As String = If(DdlEstatusConsulta.SelectedValue = "" And DdlClientesConsulta.SelectedValue = "", $"FechaInicial BETWEEN '{fechaInicial}' AND '{fechaFinal}'", $"FechaInicial BETWEEN '{fechaInicial}' AND '{fechaFinal}'") + + + Dim query As String = $"SELECT *, ISNULL(Cli.NombreComercial,'') AS NombreComercial {nombreEstatus} FROM Con_Contratos C LEFT JOIN Clientes Cli with(nolock) ON Cli.CveCliente = C.CveCliente {innerEstatus} WHERE {cliente} {estatus} {intervalo}" + + Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("Conexion").ConnectionString) + Using command As New SqlCommand(query, connection) + connection.Open() + Dim reader As SqlDataReader = command.ExecuteReader() + GvContratos.DataSource = reader + GvContratos.DataBind() + End Using + End Using + + UpTitulos.Update() + End Sub +End Class diff --git a/Transportes/RepContratos.aspx b/Transportes/RepContratos.aspx index 339d007a1..9f4d4df89 100644 --- a/Transportes/RepContratos.aspx +++ b/Transportes/RepContratos.aspx @@ -13,24 +13,6 @@ margin-block: 1rem; } - .dataTables_scrollHead { - background-color: #DDD; - color: white; - } - - .table-scrollable { - margin-top: 0px !important; - margin-bottom: 0px !important; - } - - .Texto { - text-align: left !important - } - - .boton { - background: red; - } - .consulta { padding: 1rem 2rem; background-color: #95A5A6; @@ -70,52 +52,49 @@ - - -
    -
    - + <%-- Filtros --%> +
    +
    + - + -
    +
    -
    - +
    + - + -
    +
    -
    - - -
    +
    + + +
    -
    - -
    - - -
    -
    - - +
    + +
    + +
    - - +
    + +
    + <%-- Listado de Contratos --%> + Text='<%# Eval("ContratoEstatus") %>' Style='<%# "color:" + If(Eval("BackgroundColor") IsNot DBNull.Value, Eval("BackgroundColor").ToString(), String.Empty) %>'> @@ -177,13 +156,12 @@ - + <%-- Modal --%>