From a2be14116a26378015046391a292ce29642ed485 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Fri, 12 Nov 2021 13:27:14 -0700 Subject: [PATCH] Entregas Ruta sin timbrado --- App_Code/ClsGenerales.vb | 169 ++++++-- App_Code/ClsPaginas.vb | 9 +- Bancos/IE.aspx.vb | 4 +- General/RepPaqueteriasGuiasRuta.aspx | 338 +++++++++++++++ General/RepPaqueteriasGuiasRuta.aspx.cs | 433 ++++++++++++++++++++ Inventarios/EntregasPorRealizarRuta.aspx | 295 +++++++++++++ Inventarios/EntregasPorRealizarRuta.aspx.cs | 389 ++++++++++++++++++ 7 files changed, 1609 insertions(+), 28 deletions(-) create mode 100644 General/RepPaqueteriasGuiasRuta.aspx create mode 100644 General/RepPaqueteriasGuiasRuta.aspx.cs create mode 100644 Inventarios/EntregasPorRealizarRuta.aspx create mode 100644 Inventarios/EntregasPorRealizarRuta.aspx.cs diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 939808c43..b2cc54484 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -2955,7 +2955,9 @@ Public Class ClsGenerales .Add("@FechaIngFin", SqlDbType.VarChar).Value = FechaIngFin .Add("@Filtro", SqlDbType.Int).Value = Filtro .Add("@CveUsuarioEntrega", SqlDbType.Int).Value = CveUsuarioEntrega - .Add("@EsEntregaInterna", SqlDbType.Bit).Value = EsEntregaInterna + .Add("@EsEntregaInterna", SqlDbType.Bit).Value = EsEntregaInterna + + End With Try SqlAdapter.Fill(Data) @@ -2964,6 +2966,30 @@ Public Class ClsGenerales OnError("Ocurrió un error al obtener las Guías de Paquetería.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try + Return Retorno + End Function + + + Public Function GetPaqueteriasGuiasRuta(CveSubProyecto As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Gral_PaqueteriasGuiasRutaGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las entregas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno End Function @@ -3029,7 +3055,8 @@ Public Class ClsGenerales DataAdapter("PA_Gral_EntregasPorRealizarGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveAsignacionEntrega", SqlDbType.BigInt).Value = CveAsignacionEntrega + .Add("@CveAsignacionEntrega", SqlDbType.BigInt).Value = CveAsignacionEntrega + End With Try SqlAdapter.Fill(Data) @@ -3611,8 +3638,9 @@ Public Class ClsGenerales #Region "GRAL TIMBRES" - Public Function AddGralTimbre(TipoDocto As String, Serie As String, Folio As Integer, FolioFiscal As String, Fecha As Date, CvePaqueteriaGuia As Integer, CveMovimientoAlmacen As Integer, CveUsuario As Integer, CveEmpresa As Integer, - Estatus As Integer, CvePAC As Integer, AplicaCP As Boolean, CveSubProyectoOrigen As Integer, CveDireccionOrigen As Integer, CveDireccionDestino As Integer, CveChofer As Integer, CveCamion As Integer, FechaEntrega As Date) As Integer + Public Function AddGralTimbre(TipoDocto As String, Serie As String, Folio As Integer, FolioFiscal As String, Fecha As Date, CveUsuario As Integer, CveEmpresa As Integer, + Estatus As Integer, CvePAC As Integer, AplicaCP As Boolean, CveEntregaAlmacen As Integer, CveSubProyectoOrigen As Integer) As Integer + Dim Retorno As Integer = -1 DataAdapter("PA_Gral_TimbreAdd") @@ -3623,19 +3651,13 @@ Public Class ClsGenerales .Add("@Folio", SqlDbType.Int).Value = Folio .Add("@FolioFiscal", SqlDbType.VarChar).Value = FolioFiscal .Add("@Fecha", SqlDbType.Date).Value = Fecha - .Add("@CvePaqueteriaGuia", SqlDbType.Int).Value = CvePaqueteriaGuia - .Add("@CveMovimientoAlmacen", SqlDbType.Int).Value = CveMovimientoAlmacen .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Estatus", SqlDbType.Int).Value = Estatus .Add("@CvePAC", SqlDbType.Int).Value = CvePAC .Add("@AplicaCP", SqlDbType.Bit).Value = AplicaCP + .Add("@CveEntregaAlmacen", SqlDbType.Int).Value = CveEntregaAlmacen .Add("@CveSubProyectoOrigen", SqlDbType.Int).Value = CveSubProyectoOrigen - .Add("@CveDireccionOrigen", SqlDbType.Int).Value = CveDireccionOrigen - .Add("@CveDireccionDestino", SqlDbType.Int).Value = CveDireccionDestino - .Add("@CveChofer", SqlDbType.Int).Value = CveChofer - .Add("@CveCamion", SqlDbType.Int).Value = CveCamion - .Add("@FechaEntrega", SqlDbType.DateTime).Value = FechaEntrega .Add("@CveTimbre", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@FolioInsertado", SqlDbType.Int).Direction = ParameterDirection.Output @@ -3671,10 +3693,7 @@ Public Class ClsGenerales .Add("@Estatus", SqlDbType.Int).Value = Estatus .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento - .Add("@CvePaqueteriaGuia", SqlDbType.Int).Value = CvePaqueteriaGuia - - - + .Add("@CvePaqueteriaGuia", SqlDbType.Int).Value = CvePaqueteriaGuia End With Try @@ -3687,9 +3706,9 @@ Public Class ClsGenerales Return Retorno End Function - Public Function UpdateGralTimbre(CveTimbre As Integer, TipoDocto As String, Serie As String, Folio As Integer, FolioFiscal As String, Fecha As Date, CvePaqueteriaGuia As Integer, CveMovimientoAlmacen As Integer, CveUsuario As Integer, CveEmpresa As Integer, - Estatus As Integer, CvePAC As Integer, CvePACCancelacion As Integer, FechaCancelacion As Date, AplicaCP As Boolean, CveSubProyectoOrigen As Integer, CveDireccionOrigen As Integer, CveDireccionDestino As Integer, - CveChofer As Integer, CveCamion As Integer) As Boolean + Public Function UpdateGralTimbre(CveTimbre As Integer, TipoDocto As String, Serie As String, Folio As Integer, FolioFiscal As String, Fecha As Date, CvePaqueteriaGuia As Integer, CveUsuario As Integer, CveEmpresa As Integer, + Estatus As Integer, CvePAC As Integer, CvePACCancelacion As Integer, FechaCancelacion As Date, AplicaCP As Boolean, SelloCancelacion As String + ) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_TimbreUpdate") @@ -3702,20 +3721,16 @@ Public Class ClsGenerales .Add("@FolioFiscal", SqlDbType.VarChar).Value = FolioFiscal .Add("@Fecha", SqlDbType.Date).Value = Fecha .Add("@CvePaqueteriaGuia", SqlDbType.Int).Value = CvePaqueteriaGuia - .Add("@CveMovimientoAlmacen", SqlDbType.Int).Value = CveMovimientoAlmacen .Add("@Estatus", SqlDbType.Int).Value = Estatus .Add("@CvePAC", SqlDbType.Int).Value = CvePAC .Add("@CvePACCancelacion", SqlDbType.Int).Value = CvePACCancelacion .Add("@FechaCancelacion", SqlDbType.DateTime).Value = FechaCancelacion .Add("@AplicaCP", SqlDbType.Bit).Value = AplicaCP - .Add("@CveSubProyectoOrigen", SqlDbType.Int).Value = CveSubProyectoOrigen - .Add("@CveDireccionOrigen", SqlDbType.Int).Value = CveDireccionOrigen - .Add("@CveDireccionDestino", SqlDbType.Int).Value = CveDireccionDestino .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveChofer", SqlDbType.Int).Value = CveChofer - .Add("@CveCamion", SqlDbType.Int).Value = CveCamion - + .Add("@SelloCancelacion", SqlDbType.VarChar).Value = SelloCancelacion + + End With Try @@ -3769,8 +3784,112 @@ Public Class ClsGenerales End Function + Public Function AddInvEntregaAlmacenRuta(CveSubProyectoOrigen As Integer, CveMovimientoAlmacen As Integer, CveDireccionOrigen As Integer, CveDireccionDestino As Integer, CveChofer As Integer, CveCamion As Integer, FechaEntrega As Date, Tipo As String, Orden As Integer) As Integer + Dim Retorno As Integer = -1 + DataAdapter("PA_Inv_EntregaAlmacenRutaAdd") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveSubProyectoOrigen", SqlDbType.Int).Value = CveSubProyectoOrigen + .Add("@CveMovimientoAlmacen", SqlDbType.Int).Value = CveMovimientoAlmacen + .Add("@CveDireccionOrigen", SqlDbType.Int).Value = CveDireccionOrigen + .Add("@CveDireccionDestino", SqlDbType.Int).Value = CveDireccionDestino + .Add("@CveChofer", SqlDbType.Int).Value = CveChofer + .Add("@CveCamion", SqlDbType.Int).Value = CveCamion + .Add("@FechaEntrega", SqlDbType.DateTime).Value = FechaEntrega + .Add("@Orden", SqlDbType.Int).Value = Orden + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + .Add("@CveEntregaAlmacen", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@CveEntregaAlmacen").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error al agregar la entrega almacen", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + Public Function UpdateInvEntregaAlmacenRuta(CveEntregaAlmacen As Integer, CveDireccionOrigen As Integer, CveDireccionDestino As Integer, CveChofer As Integer, CveCamion As Integer, FechaEntrega As Date, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Inv_EntregaAlmacenRutaUpdate") + + With SqlAdapter.SelectCommand.Parameters + + + .Add("@CveEntregaAlmacen", SqlDbType.Int).Value = CveEntregaAlmacen + .Add("@CveDireccionOrigen", SqlDbType.Int).Value = CveDireccionOrigen + .Add("@CveDireccionDestino", SqlDbType.Int).Value = CveDireccionDestino + .Add("@CveChofer", SqlDbType.Int).Value = CveChofer + .Add("@CveCamion", SqlDbType.Int).Value = CveCamion + .Add("@FechaEntrega", SqlDbType.DateTime).Value = FechaEntrega + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la entrega almacen", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + Public Function GetInvEntregaAlmacenRuta(CveSubProyecto As Integer, CveEmpresa As Integer, Opcion As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Inv_EntregaAlmacenRutaGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Opcion", SqlDbType.Int).Value = Opcion + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error obtener las entregas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + + Public Function GetInvEntregaAlmacenRutaRep(CveSubProyecto As Integer, CveEmpresa As Integer, Estatus As Integer, FechaInicio As Date, FechaFin As Date, CveChofer As Integer) As Boolean + + Dim Retorno As Boolean = False + + DataAdapter("PA_Inv_EntregaAlmacenRutaRepGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveChofer", SqlDbType.Int).Value = CveChofer + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error obtener las entregas", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + #End Region End Class + diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 389ad3700..c1c0f5228 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4870,6 +4870,7 @@ Public Class ClsPaginas PaginaDict.Add("/Inventarios/AjustesSeccionAlmacen.aspx".ToUpper(), 892) PaginaDict.Add("/Inventarios/RepTraspasoAlmacen.aspx".ToUpper(), 688) PaginaDict.Add("/Inventarios/EntregasPorRealizar.aspx".ToUpper(), 728) + PaginaDict.Add("/Inventarios/CatAlmacenClasificacionSecciones.aspx".ToUpper(), 764) PaginaDict.Add("/Inventarios/ReconstruirCostos.aspx".ToUpper(), 764) PaginaDict.Add("/Inventarios/RecepcionDevolucion.aspx".ToUpper(), 696) @@ -4879,6 +4880,11 @@ Public Class ClsPaginas + PaginaDict.Add("/Inventarios/EntregasPorRealizarRuta.aspx".ToUpper(), -1) + PaginaDict.Add("/General/RepPaqueteriasGuiasRuta.aspx".ToUpper(), -1) + + + #End Region #Region "MF" PaginaDict.Add("/MF/BitacoraDiaria.aspx".ToUpper(), 801) @@ -8492,7 +8498,8 @@ Public Class ClsPaginas Dim PathXML As String = $"{Ruta}XML\Pag\{Serie}-{Folio}.xml" Dim PathPDF As String = $"{Ruta}PDF\Pag\{Serie}-{Folio}.pdf" SerieFolio = $"{Serie}-{Folio}" - Dim ImagenCBB As String = String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, $"{Serie}-{Folio}.jpg") + + Dim ImagenCBB As String = $"file://{Ruta}CBB\{Serie}-{Folio}.jpg" If File.Exists(PathXML) Then Dim XmlDoc As New System.Xml.XmlDocument diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 9fa47aee1..ec91572d5 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -5727,7 +5727,7 @@ Partial Class Bancos_IE If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DataKey("Tipo") = "Ing" Then - e.Row.Cells(3).Text = String.Format("", Encripta(String.Format("OP=CompP&EXT=xml&SerieFolio={0}&CVECOMPLEMENTOPAGO={1}&CVEIE={2}", e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("CveComplementoPago"), e.Row.DBCampo("CveIE")))) + e.Row.Cells(3).Text = String.Format("", Encripta(String.Format("OP=CompP&EXT=xml&SerieFolio={0}&CVECOMPLEMENTOPAGO={1}&CVEIE={2}", e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("CveComplementoPago"), e.Row.DBCampo("CveIE")))) e.Row.Cells(4).Text = String.Format("", Encripta(String.Format("OP=CompP&EXT=pdf&SerieFolio={0}&CVECOMPLEMENTOPAGO={1}&CVEIE={2}", e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("CveComplementoPago"), e.Row.DBCampo("CveIE")))) If e.Row.DataKey("Estatus").Contiene("1", "3") Then @@ -5738,7 +5738,7 @@ Partial Class Bancos_IE ElseIf e.Row.DataKey("Tipo") = "Egs" Then - e.Row.Cells(3).Text = String.Format("", Encripta(String.Format("OP=Fact&EXT=xml&CveFactura={0}&RFC={1}", e.Row.DBCampo("CveFactura"), e.Row.DBCampo(("RFCde").ToString.Replace("&", "%26%"))))) + e.Row.Cells(3).Text = String.Format("", Encripta(String.Format("OP=Fact&EXT=xml&CveFactura={0}&RFC={1}", e.Row.DBCampo("CveFactura"), e.Row.DBCampo(("RFCde").ToString.Replace("&", "%26%"))))) e.Row.Cells(4).Text = String.Format("", Encripta(String.Format("OP=Fact&EXT=pdf&CveFactura={0}&RFC={1}", e.Row.DBCampo("CveFactura"), e.Row.DBCampo("RFCde").ToString.Replace("&", "%26%")))) GvComplementoPagos.Columns(6).Visible = False diff --git a/General/RepPaqueteriasGuiasRuta.aspx b/General/RepPaqueteriasGuiasRuta.aspx new file mode 100644 index 000000000..ee30e8e65 --- /dev/null +++ b/General/RepPaqueteriasGuiasRuta.aspx @@ -0,0 +1,338 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepPaqueteriasGuiasRuta.aspx.cs" Inherits="General_RepPaqueteriasGuias" %> + + + + + + + + Reporte de Envíos + + + + + +<%-- + +
  • + Agregar Guía +
  • + +
  • + Generar PDF +
  • + +
  • + Generar Excel +
  • + +
    + + + + +
    --%> +
    + + + + + + +
    +
    +
    + + +
    + +
    +
    + Sucursal: +
    + + +
    + +
    + +
    + + +
    +
    + + + + +
    + + + + + + +
    + + +
    +
    + + + + +
    + + + + + + +
    + + +
    +
    +
    + +
    + +
    +
    + + + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + +
    + + + + + + diff --git a/General/RepPaqueteriasGuiasRuta.aspx.cs b/General/RepPaqueteriasGuiasRuta.aspx.cs new file mode 100644 index 000000000..6a38d21e6 --- /dev/null +++ b/General/RepPaqueteriasGuiasRuta.aspx.cs @@ -0,0 +1,433 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +using Extensiones; +using System.Data; +using Microsoft.Reporting.WebForms; +using System.IO; +using System.Text; + +public partial class General_RepPaqueteriasGuias : ClsPaginas +{ + #region PROPIEDADES + private DataTable DTDatos + { + get + { + return (DataTable)ViewState["DTDatos"]; + } + + set + { + ViewState["DTDatos"] = value; + } + } + + private int CveEntregaAlmacen + { + get + { + return ViewState["CveEntregaAlmacen"].ToString().ToEntero(); + } + + set + { + ViewState["CveEntregaAlmacen"] = value; + } + } + + private int CveVenta + { + get + { + return ViewState["CveVenta"].ToString().ToEntero(); + } + + set + { + ViewState["CveVenta"] = value; + } + } + + private int CveMovimiento + { + get + { + return ViewState["CveMovimiento"].ToString().ToEntero(); + } + + set + { + ViewState["CveMovimiento"] = value; + } + } + + private String SerieFolio + { + get + { + return ViewState["SerieFolio"].ToString(); + } + set + { + ViewState["SerieFolio"] = value; + } + } + + private String NombreCliente + { + get + { + return ViewState["NombreCliente"].ToString(); + } + set + { + ViewState["NombreCliente"] = value; + } + } + + private String Destinatario + { + get + { + return ViewState["Destinatario"].ToString(); + } + set + { + ViewState["Destinatario"] = value; + } + } + + private String Paqueteria + { + get + { + return ViewState["Paqueteria"].ToString(); + } + set + { + ViewState["Paqueteria"] = value; + } + } + private String Guia + { + get + { + return ViewState["Guia"].ToString(); + } + set + { + ViewState["Guia"] = value; + } + } + + private String Rastreo + { + get + { + return ViewState["Rastreo"].ToString(); + } + set + { + ViewState["Rastreo"] = value; + } + } + + + private DataTable DTMovimientos + { + get + { + return (DataTable)ViewState["DTMovimientos"]; + } + + set + { + ViewState["DTMovimientos"] = value; + } + } + + private int CvePaqueteriaGuiaReasignar + { + get + { + return ViewState["CvePaqueteriaGuiaReasignar"].ToString().ToEntero(); + } + + set + { + ViewState["CvePaqueteriaGuiaReasignar"] = value; + } + } + + private String Folio + { + get + { + return ViewState["Folio"].ToString(); + } + set + { + ViewState["Folio"] = value; + } + } + + #endregion + + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaEstatus(); + CargaCombosModalEntrega(); + InicializaFechas(); + CargaChoferes(); + UPFiltros.Update(); + CargarCentrosDeCosto(null, DdlSucursales, null, LblDdlSucursal); + CargaDatos(); + } + } + + #region CARGA DDL + protected void CargaCombosModalEntrega() + { + ClsInventarios ObjInventarios = new ClsInventarios(); + + if (ObjInventarios.GetCamiones(-1, UsuarioActual.CveEmpresa) && ObjInventarios.DtResultados.Rows.Count > 0) + { + DdlModalCamion.DataSource = ObjInventarios.DtResultados; + } + + ObjInventarios.Dispose(); + DdlModalCamion.Items.Insert(0, new ListItem("Seleccione", "-1")); + DdlModalCamion.DataBind(); + + ClsAcarreos ObjAcar = new ClsAcarreos(); + + if (ObjAcar.GetChofer(-1, UsuarioActual.CveEmpresa, 1, -1)) + { + DdlModalChofer.DataSource = ObjAcar.DtResultados; + DdlModalChofer.DataBind(); + } + ObjAcar.Dispose(); + DdlModalChofer.Items.Insert(0, new ListItem("Seleccione", "-1")); + } + protected void CargaChoferes() + { + ClsAcarreos ObjAcar = new ClsAcarreos(); + + if (ObjAcar.GetChofer(-1, UsuarioActual.CveEmpresa, 1, -1)) + { + DdlChofer.DataSource = ObjAcar.DtResultados; + } + ObjAcar.Dispose(); + DdlChofer.DataBind(); + DdlChofer.Items.Insert(0, new ListItem("Todos", "-1")); + } + + + + + + protected void CargaEstatus() + { + + DdlEstatus.Items.Insert(0, new ListItem("Todos ", "-1")); + DdlEstatus.Items.Insert(1, new ListItem("Registrado", "0")); + DdlEstatus.Items.Insert(2, new ListItem("Timbrado", "1")); + DdlEstatus.Items.Insert(3, new ListItem("Cancelado ", "2")); + + } + + + + + + protected void InicializaFechas() + { + + TxtFechaI.Text = DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy"); + TxtFechaF.Text = DateTime.Now.ToString("dd/MM/yyyy"); + + } + #endregion + + #region CARGA DATOS + protected void CargaDatos() + { + ClsGenerales ObjGeneral = new ClsGenerales(); + + if (ObjGeneral.GetInvEntregaAlmacenRutaRep(DdlSucursales.SelectedValue.ToEntero(),UsuarioActual.CveEmpresa, DdlEstatus.SelectedValue.ToEntero(), TxtFechaI.Text.ToDate(), TxtFechaF.Text.ToDate(), DdlChofer.SelectedValue.ToEntero())) + { + DTDatos = ObjGeneral.DtResultados; + GVDatos.DataSource = DTDatos; + } + + ObjGeneral.Dispose(); + GVDatos.DataBind(); + UPDatos.Update(); + } + + + + + #endregion + + #region BOTONES + + protected void BtnConsultar_Click(object sender, EventArgs e) + { + CargaDatos(); + } + + protected void imgEditar_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + + CveEntregaAlmacen = GvRow.DataKey("CveEntregaAlmacen").ToEntero(); + + int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); + int CveDireccionOrigen = GvRow.DataKey("CveDireccionOrigen").ToEntero(); + int CveAlmacen = GvRow.DataKey("CveAlmacen").ToEntero(); + + CargaModalCombosDirecciones(CveCliente, CveDireccionOrigen, CveAlmacen); + + DdlModalDireccionOrigen.SelectedValueExist(GvRow.DataKey("CveDireccionOrigen")); + DdlModalDireccionDestino.SelectedValueExist(GvRow.DataKey("CveDireccionDestino")); + + DdlModalCamion.SelectedValueExist(GvRow.DataKey("CveCamion")); + DdlModalChofer.SelectedValueExist(GvRow.DataKey("CveChofer")); + + TxtmodalFechaEntrega.Text = GvRow.DataKey("FechaEntrega").ToDate().ToString("dd/MM/yyyy"); + + + UpModalEditarentrega.Update(); + this.RegistraScript("$('#DivEditarEntrega').modal('show');"); + } + + + private void CargaModalCombosDirecciones(int CveCliente, int CveDireccionOrigen, int CveAlmacen ) + { + + DdlModalDireccionOrigen.Items.Clear(); + DdlModalDireccionDestino.Items.Clear(); + + DataTable DTDireccionesCliente = new DataTable(); + ClsClientes ObjClientes = new ClsClientes(); + if (ObjClientes.DireccionEnvioGet(-1, -1, -1)) + { + DTDireccionesCliente = ObjClientes.DtResultados ; + } + ObjClientes.Dispose(); + + DdlModalDireccionDestino.DataSource = DTDireccionesCliente.FiltraParametros($"CveCliente = {CveCliente}"); + DdlModalDireccionDestino.DataBind(); + DdlModalDireccionDestino.Items.Insert(0,new ListItem("Seleccione Una", "-1")); + + string Almacen = get_GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen: CveAlmacen).FiltroPrimeroValor("Almacen", $"CveAlmacen = {CveAlmacen}"); + if (CveDireccionOrigen > 0) + { + DdlModalDireccionOrigen.DataSource = DTDireccionesCliente.FiltraParametros($"CveDireccionEnvio = {CveDireccionOrigen}"); + DdlModalDireccionOrigen.DataBind(); + DdlModalDireccionOrigen.Items.Insert(0, new ListItem($"Almacen: {Almacen}", "-2")); + }else + { + DdlModalDireccionOrigen.Items.Insert(0, new ListItem($"Almacen: {Almacen}", "-2")); + } + + } + + + protected void LnkTimbrar_Click(object sender, EventArgs e) + { + + } + + protected void LnkCancelaTimbre_Click(object sender, EventArgs e) + { + + } + + + protected void BtnModalEditarentrega_Click(object sender, EventArgs e) + { + + bool ProcesoOK = true ; + + ClsGenerales ObjGral = new ClsGenerales(); + if(!ObjGral.UpdateInvEntregaAlmacenRuta(CveEntregaAlmacen,DdlModalDireccionOrigen.SelectedValue.ToEntero(), DdlModalDireccionDestino.SelectedValue.ToEntero(), DdlModalChofer.SelectedValue.ToEntero(), DdlModalCamion.SelectedValue.ToEntero(), TxtmodalFechaEntrega.Text.ToDate(), UsuarioActual.CveEmpresa)) + { + ProcesoOK = false; + } + ObjGral.Dispose(); + + if (ProcesoOK) + { + this.RegistraScript("$('#DivEditarEntrega').modal('hide');"); + Alert("Entrega Actualizada correctamente."); + CargaDatos(); + } + + } + + protected void BtnEliminarGuia_Click(object sender, EventArgs e) + { + //EliminaGuia(); + //this.RegistraScript("$('#DivEditarGuia').modal('hide');"); + //CargaDatos(); + } + + protected void GVDatos_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + LinkButton LnkEditar = e.Row.FCLinkButton("LnkEditar"); + LinkButton LnkTimbrar = e.Row.FCLinkButton("LnkTimbrar"); + LinkButton LnkCancelaTimbre = e.Row.FCLinkButton("LnkCancelaTimbre"); + + LnkEditar.Visible = false; + LnkTimbrar.Visible = false; + LnkCancelaTimbre.Visible = false; + + if (e.Row.DataKey("Estatus").ToEntero() == 0) + { + LnkEditar.Visible = true; + LnkTimbrar.Visible = true; + } + + if (e.Row.DataKey("Estatus").ToEntero() == 1) + { + LnkCancelaTimbre.Visible = true; + } + + if (e.Row.DataKey("Estatus").ToEntero() == 2) + { + + } + + } + } + + + + + + + + #endregion + + + + + + + + + + +} \ No newline at end of file diff --git a/Inventarios/EntregasPorRealizarRuta.aspx b/Inventarios/EntregasPorRealizarRuta.aspx new file mode 100644 index 000000000..3e76e78a9 --- /dev/null +++ b/Inventarios/EntregasPorRealizarRuta.aspx @@ -0,0 +1,295 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="EntregasPorRealizarRuta.aspx.cs" Inherits="Inventarios_EntregasPorRealizarRuta" %> + + + + + + + + + Entregas por Realizar + + + + + + + + + + + + +
    +
    +
    + + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + +
    + +
    + Chofer: +
    +
    + + + +
    +
    + Unidad: +
    +
    + + + +
    + +
    + Fecha de Entrega: +
    + +
    +
    + + + + + + + + +
    +
    +
    + Carta Porte: +
    +
    + + +
    +
    + +
    + +
    + Generar Documentos +
    + +
    + +
    + +
    + +
    + + + +
    + + + + + +
    +
    + + ASIGNACIÓN DE ENTREGAS +
    +
    + +
    +
    +
    + + +
    +
    + + + + + + +   + + + + + +   + + + + <%----%> + + +   + + + + +   + + + + +   + + + + + + + + + +
    + +
    + + + +
    +
    + + + + + + + +   + + + + + + <%----%> + + + + + + + + + + + +   + + + + <%----%> + + +   + + + + +   + + + + +   + + + + + + + + + + + +
    + +
    + + + + + +
    +
    +
    +
    +
    + + + + + diff --git a/Inventarios/EntregasPorRealizarRuta.aspx.cs b/Inventarios/EntregasPorRealizarRuta.aspx.cs new file mode 100644 index 000000000..60f33e822 --- /dev/null +++ b/Inventarios/EntregasPorRealizarRuta.aspx.cs @@ -0,0 +1,389 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data; +using Extensiones; +using Microsoft.Reporting.WebForms; +using System.Text; + +public partial class Inventarios_EntregasPorRealizarRuta : ClsPaginas +{ + + + DataTable DTGenrarDocumentos + { + get { + + if(ViewState["DTGenrarDocumentos"] == null){ + ViewState["DTGenrarDocumentos"] = new DataTable(); + } + return (DataTable)ViewState["DTGenrarDocumentos"]; + + } + set { + ViewState["DTGenrarDocumentos"] = (DataTable)value; + } + } + + DataTable DTDatosConsulta + { + get + { + + if (ViewState["DTDatosConsulta"] == null) + { + ViewState["DTDatosConsulta"] = new DataTable(); + } + return (DataTable)ViewState["DTDatosConsulta"]; + + } + set + { + ViewState["DTDatosConsulta"] = (DataTable)value; + } + } + + + bool SelecionEntrega + { + get + { + if (ViewState["SelecionEntrega"] == null) + { + ViewState["SelecionEntrega"] = false; + } + return (bool) ViewState["SelecionEntrega"]; + } + set + { + ViewState["SelecionEntrega"] = (bool)value; + } + } + + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + + if (UsuarioActual.Empresa.Funcionalidad(161).ToEntero() == 1) + { + DvCartaPorte1.Visible = true; + DvCartaPorte2.Visible = true; + } + + SelecionEntrega = true; + + CargaCombos(); + CargaDatos(); + + } + } + + protected void BtnAsignar_Click(object sender, EventArgs e) + { + + + + + if(DdlChofer.SelectedValue.ToEntero() <= 0) + { + Alert("Debe seleccionar un chofer.", ModExtensiones.TipoMensaje.MsgAdvertencia); + return; + } + + if(DdlUnidadCamion.SelectedValue.ToEntero() <= 0) + { + Alert("Debe seleccionar una unidad", ModExtensiones.TipoMensaje.MsgAdvertencia); + return; + } + + + StringBuilder SBError = new StringBuilder(); + ActualizaOrdenDTGenrarDocumentos(); + + + + bool TieneError = false; + ClsGenerales ObjGeneral = new ClsGenerales(); + ObjGeneral.IniciaTransacSQL(); + + GridViewRowCollection Grid = GvGenerarDocumentos.Rows; + + + string Usuario = DdlChofer.SelectedItem.Text; + + + + + int CveDireccionOrigen = -1; + foreach (GridViewRow row in Grid) + { + //int CvePaqueteriasGuias = row.DataKey("CvePaqueteriaGuia").ToEntero(); + int Orden = row.DataKey("Orden").ToEntero(); + + //if (ObjGeneral.AsignarEntregasPorRealizar(CvePaqueteriasGuias, CvePersonal: -1, CveAsignacionEntrega: CveAsignacionEntrega, Orden: Orden)) + //{ + + int CveDireccionDestino = row.DataKey("CveDireccionEnvio").ToEntero(); + + if (CveDireccionDestino <= 0) + { + SBError.AppendLine($"Factura {row.DataKey("SerieFolio")} el cliente {row.DataKey("Nombre")} no tiene una dirección de envio. "); + TieneError = true; + break; + } + int CveEntregaAlmacen = ObjGeneral.AddInvEntregaAlmacenRuta(row.DataKey("CveSubProyectoOrigen").ToEntero(), row.DataKey("CveMovimiento").ToEntero(), CveDireccionOrigen, CveDireccionDestino, DdlChofer.SelectedValue.ToEntero(), DdlUnidadCamion.SelectedValue.ToEntero(), TxtFechaEntrega.Text.ToDate(), "E",Orden); + CveDireccionOrigen = row.DataKey("CveDireccionEnvio").ToEntero(); + + if (CveEntregaAlmacen > 0) + { + DateTime MinFecha = new DateTime(1900, 01, 01); + int CveTimbre = ObjGeneral.AddGralTimbre("Tra", "-1", -1, "", MinFecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, -1, ChkEmitirCartaPorte.Checked, CveEntregaAlmacen, row.DataKey("CveSubProyectoOrigen").ToEntero()); + + if (CveTimbre <= 0) + { + SBError.AppendLine($"Factura {row.DataKey("SerieFolio")} error al agregar timbre. "); + + TieneError = true; + break; + } + } + else + { + SBError.AppendLine($"Factura {row.DataKey("SerieFolio")} error al agregar entrega alamcen. "); + TieneError = true; + break; + } + + + } + + + + + + if (!TieneError) + { + + foreach (GridViewRow row in Grid) + { + try + { + //MandarNotificacionCorreo(row); + } + catch (Exception ex) + { + TieneError = true; + ModExtensiones.GuardaLog(ex.Message); + } + + + } + + if (!TieneError) + { + ObjGeneral.Commit(); + Alert("Entregas asignadas correctamente"); + + DdlChofer.SelectedValueExist("-1"); + DdlUnidadCamion.SelectedValueExist("-1"); + ChkEmitirCartaPorte.Checked = false; + + SelecionEntrega = false; + SeleccioanrGenrar(); + + CargaDatos(); + UpDatos.Update(); + } + else + { + ObjGeneral.RollBack(); + } + ObjGeneral.Dispose(); + }else + { + Alert(SBError.ToString(), ModExtensiones.TipoMensaje.MsgAdvertencia); + } + + } + private void CargaDatos() + { + ClsGenerales ObjGeneral = new ClsGenerales(); + if (ObjGeneral.GetInvEntregaAlmacenRuta(DdlSubProyecto.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, 1)) + { + GvPaqueteriasGuias.DataSource = ObjGeneral.DtResultados; + DTDatosConsulta = ObjGeneral.DtResultados; + DTGenrarDocumentos = ObjGeneral.DtResultados.Clone(); + + } + ObjGeneral.Dispose(); + GvPaqueteriasGuias.DataBind(); + + UpDatos.Update(); + } + + + private void CargaCombos() + { + + ClsInventarios ObjInventarios = new ClsInventarios(); + + if(ObjInventarios.GetCamiones(-1, UsuarioActual.CveEmpresa) && ObjInventarios.DtResultados.Rows.Count > 0){ + DdlUnidadCamion.DataSource = ObjInventarios.DtResultados; + } + ObjInventarios.Dispose(); + DdlUnidadCamion.Items.Insert(0, new ListItem("Seleccione", "-1")); + DdlUnidadCamion.DataBind(); + + + ClsAcarreos ObjAcar = new ClsAcarreos(); + + if(ObjAcar.GetChofer(-1, UsuarioActual.CveEmpresa, 1, -1) ){ + DdlChofer.DataSource = ObjAcar.DtResultados; + DdlChofer.DataBind(); + } + ObjAcar.Dispose(); + DdlChofer.Items.Insert(0, new ListItem("Seleccione", "-1")); + + TxtFechaEntrega.Text = DateTime.Now.ToShortDateString(); + + + CargarCentrosDeCosto(null, DdlSubProyecto, null, LblSubProyecto); + + + } + + + protected void LnkGenerarDocumentos_Click(object sender, EventArgs e) + { + SeleccioanrGenrar(); + } + + + private void SeleccioanrGenrar() { + + if (SelecionEntrega) + { + + DTGenrarDocumentos.Rows.Clear(); + + + + int CountRows = 0; + foreach (GridViewRow GvRow in GvPaqueteriasGuias.Rows) + { + + CheckBox ChkAsigna = GvRow.FCCheckBox("ChkAsigna"); + + if (ChkAsigna.Checked) + { + + int CveMovimiento = GvRow.DataKey("CveMovimiento").ToEntero(); + + DataRow dRow = DTGenrarDocumentos.NewRow(); + DataRow dRowOrigen = DTDatosConsulta.FiltraParametros($"CveMovimiento = {CveMovimiento}").Rows[0]; + + int IndexColun = 0; + foreach (DataColumn dColumn in DTDatosConsulta.Columns) + { + dRow[IndexColun] = dRowOrigen[IndexColun]; + IndexColun++; + } + + dRow["Num"] = CountRows + 1; + DTGenrarDocumentos.Rows.Add(dRow); + CountRows++; + } + } + + DTGenrarDocumentos.AcceptChanges(); + + if (CountRows > 0) + { + GvGenerarDocumentos.DataSource = DTGenrarDocumentos; + GvGenerarDocumentos.DataBind(); + + DVGvGenerarDocumentos.Visible = true; + BtnAsignar.Visible = false; + DVGvPaqueteriasGuias.Visible = false; + + RegistraScript("InitOrdenamientoGvGenerarDocumentos();"); + } + else + { + Alert("No hay entregas seleccionadas", ModExtensiones.TipoMensaje.MsgAdvertencia); + return; + } + + + SelecionEntrega = false; + LnkGenerarDocumentos.Text = "Regresa a selección"; + + BtnAsignar.Visible = true; + BtnConsultar.Visible = false; + + UpDatos.Update(); + UpFiltro.Update(); + } + else + { + + BtnConsultar.Visible = true; + SelecionEntrega = true; + LnkGenerarDocumentos.Text = "Generar Documentos"; + BtnAsignar.Visible = false; + DVGvGenerarDocumentos.Visible = false; + DVGvPaqueteriasGuias.Visible = true; + UpDatos.Update(); + UpFiltro.Update(); + + } + + + } + + + + + + private void ActualizaOrdenDTGenrarDocumentos() + { + string[] OrdenMovimientos = Request.Form.GetValues("OrdenMovimientos"); + + int NumOrden = 1; + foreach (string CveMovimiento in OrdenMovimientos) + { + foreach(DataRow dRow in DTGenrarDocumentos.Rows) + { + if (CveMovimiento.ToEntero() == dRow["CveMovimiento"].ToString().ToEntero() ) + { + dRow["Orden"] = NumOrden; + } + } + DTGenrarDocumentos.AcceptChanges(); + NumOrden++; + } + + + DataView DTview = new DataView(DTGenrarDocumentos); + + // Sort by State and ZipCode column in descending order + DTview.Sort = "Orden ASC"; + + GvGenerarDocumentos.DataSource = DTview; + GvGenerarDocumentos.DataBind(); + UpDatos.Update(); + + + + } + + protected void BtnConsultar_Click(object sender, EventArgs e) + { + CargaDatos(); + } +} \ No newline at end of file