1141 lines
42 KiB
C#
1141 lines
42 KiB
C#
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 CvePaqueteriaGuia
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CvePaqueteriaGuia"].ToString().ToEntero();
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["CvePaqueteriaGuia"] = 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();
|
|
CargaSucursales();
|
|
CargaPaqueterias();
|
|
CargaPaqueteriasGuiasTipo();
|
|
InicializaFechas();
|
|
CargaUsuarios();
|
|
CargaMotivosRechazo();
|
|
UPFiltros.Update();
|
|
|
|
if (!UsuarioActual.TienePermisoProceso(219))
|
|
{
|
|
GVDatos.Columns[10].HeaderText = "Detalle/Liga";
|
|
}
|
|
|
|
if (!UsuarioActual.TienePermisoProceso(218))
|
|
{
|
|
LnkAgregarGuia.Visible = false;
|
|
}
|
|
|
|
CargaDatos();
|
|
|
|
}
|
|
}
|
|
|
|
#region CARGA DDL
|
|
protected void CargaSucursales()
|
|
{
|
|
DdlSucursales.DataSource = get_GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1);
|
|
DdlSucursales.DataBind();
|
|
DdlSucursales.Items.Insert(0, new ListItem("Todos ", "-1"));
|
|
|
|
DdlSucursalesEditar.DataSource = get_GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1);
|
|
DdlSucursalesEditar.DataBind();
|
|
DdlSucursalesEditar.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
|
}
|
|
|
|
protected void CargaPaqueterias()
|
|
{
|
|
if (UsuarioActual.CveRol == 1339)
|
|
{
|
|
DdlPaqueterias.DataSource = get_GlobalDTPaqueterias(UsuarioActual.CveEmpresa, 0);
|
|
DdlPaqueterias.DataBind();
|
|
}
|
|
else
|
|
{
|
|
DdlPaqueterias.DataSource = get_GlobalDTPaqueterias(UsuarioActual.CveEmpresa);
|
|
DdlPaqueterias.DataBind();
|
|
DdlPaqueterias.Items.Insert(0, new ListItem("Todos ", "-1"));
|
|
}
|
|
|
|
|
|
DdlPaqueteriaEditar.DataSource = get_GlobalDTPaqueterias(UsuarioActual.CveEmpresa);
|
|
DdlPaqueteriaEditar.DataBind();
|
|
DdlPaqueteriaEditar.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
|
}
|
|
|
|
protected void CargaPaqueteriasGuiasTipo()
|
|
{
|
|
DdlTipo.DataSource = get_GlobalDTPaqueteriaGuiaTipos(UsuarioActual.CveEmpresa).FiltraParametros("Consultable = 'True'");
|
|
DdlTipo.DataBind();
|
|
DdlTipo.Items.Insert(0, new ListItem("Todos ", "-1"));
|
|
|
|
DdlTipoEditar.DataSource = get_GlobalDTPaqueteriaGuiaTipos(UsuarioActual.CveEmpresa);
|
|
DdlTipoEditar.DataBind();
|
|
DdlTipoEditar.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
|
}
|
|
|
|
protected void CargaEstatus()
|
|
{
|
|
if (UsuarioActual.CveRol == 1339)
|
|
{
|
|
DdlEstatus.Items.Insert(0, new ListItem("En Proceso ", "2"));
|
|
}else
|
|
{
|
|
DdlEstatus.Items.Insert(0, new ListItem("Todos ", "-1"));
|
|
DdlEstatus.Items.Insert(1, new ListItem("Pendiente ", "1"));
|
|
DdlEstatus.Items.Insert(2, new ListItem("En Proceso ", "2"));
|
|
DdlEstatus.Items.Insert(3, new ListItem("Entregado ", "3"));
|
|
DdlEstatus.Items.Insert(4, new ListItem("Reasignar Nueva Entrega ", "4"));
|
|
DdlEstatus.Items.Insert(5, new ListItem("Directo a Clientes ", "5"));
|
|
DdlEstatus.SelectedValue = "-1";
|
|
}
|
|
|
|
DdlEstatusEditar.Items.Insert(0, new ListItem("Seleccione ", "-1"));
|
|
DdlEstatusEditar.Items.Insert(1, new ListItem("En Proceso ", "1"));
|
|
DdlEstatusEditar.Items.Insert(2, new ListItem("Confirmado por Proveedor ", "2"));
|
|
DdlEstatusEditar.Items.Insert(3, new ListItem("Entregado ", "3"));
|
|
DdlEstatusEditar.Items.Insert(4, new ListItem("Confirmado por Cliente", "4"));
|
|
DdlEstatusEditar.SelectedValue = "-1";
|
|
|
|
if(UsuarioActual.Empresa.Funcionalidad(280) == "1"){
|
|
DivEstatusEntrega.Visible = true;
|
|
}
|
|
|
|
}
|
|
|
|
private void CargaUsuarios()
|
|
{
|
|
if (UsuarioActual.CveRol == 1339)
|
|
{
|
|
DdlUsuarios.DataSource = get_GlobalDTUsuarios(CveEmpresa:UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveRol = {0}",UsuarioActual.CveRol));
|
|
DdlUsuarios.DataBind();
|
|
}
|
|
else
|
|
{
|
|
DdlUsuarios.DataSource = get_GlobalDTUsuarios(CveEmpresa: UsuarioActual.CveEmpresa);
|
|
DdlUsuarios.DataBind();
|
|
DdlUsuarios.Items.Insert(0, new ListItem("Todos ", "-1"));
|
|
}
|
|
}
|
|
|
|
private void CargaMotivosRechazo()
|
|
{
|
|
ClsGenerales ObjGeneral = new ClsGenerales();
|
|
if (ObjGeneral.GetMotivoRechazoPaqueteria(-1, UsuarioActual.CveEmpresa))
|
|
{
|
|
DdlMotivoRechazoGuia.DataSource = ObjGeneral.DtResultados;
|
|
DdlMotivoRechazoGuia.DataBind();
|
|
}
|
|
ObjGeneral.Dispose();
|
|
}
|
|
|
|
protected void InicializaFechas()
|
|
{
|
|
DateTime FI = new DateTime(DateTime.Now.Year, 1, 1);
|
|
TxtFechaI.Text = FI.ToShortDateString();
|
|
TxtFechaF.Text = DateTime.Today.ToShortDateString();
|
|
|
|
TxtFechaInicialIngreso.Text = "";//FI.ToShortDateString();
|
|
TxtFechaFinalIngreso.Text = ""; //DateTime.Today.ToShortDateString();
|
|
}
|
|
#endregion
|
|
|
|
#region CARGA DATOS
|
|
protected void CargaDatos()
|
|
{
|
|
ClsGenerales ObjGeneral = new ClsGenerales();
|
|
|
|
int CvePaqueteriaGuia = -1;
|
|
int CvePaqueteria = DdlPaqueterias.SelectedValue.ToEntero();
|
|
int CvePaqueteriaGuiaTipo = DdlTipo.SelectedValue.ToEntero();
|
|
int CveEstatus = DdlEstatus.SelectedValue.ToEntero();
|
|
int CveSubProyecto = DdlSucursales.SelectedValue.ToEntero();
|
|
int CveEmpresa = UsuarioActual.CveEmpresa;
|
|
int Filtro = DdlFiltro.SelectedValue.ToEntero();
|
|
int CveUsuarioEntrega = DdlUsuarios.SelectedValue.ToEntero();
|
|
|
|
String Guia = "-1";
|
|
String FechaInicio = TxtFechaI.Text == "" ? "-1" : TxtFechaI.Text;
|
|
String FechaFin = TxtFechaF.Text == "" ? "-1" : TxtFechaF.Text;
|
|
|
|
String FechaIngInicio = TxtFechaInicialIngreso.Text == "" ? "-1" : TxtFechaInicialIngreso.Text;
|
|
String FechaIngFin = TxtFechaFinalIngreso.Text == "" ? "-1" : TxtFechaFinalIngreso.Text;
|
|
|
|
if (ObjGeneral.GetPaqueteriasGuias(CvePaqueteriaGuia, CvePaqueteriaGuiaTipo, CvePaqueteria, CveEstatus, CveSubProyecto, CveEmpresa, Guia, FechaInicio, FechaFin,
|
|
FechaIngInicio, FechaIngFin, Filtro: Filtro, CveUsuarioEntrega: CveUsuarioEntrega, EsEntregaInterna: ChkLote.Checked))
|
|
{
|
|
DTDatos = ObjGeneral.DtResultados;
|
|
GVDatos.DataSource = DTDatos;
|
|
}
|
|
ObjGeneral.Dispose();
|
|
|
|
GVDatos.DataBind();
|
|
UPDatos.Update();
|
|
}
|
|
|
|
protected void ActualizaGuia()
|
|
{
|
|
ClsGenerales ObjGeneral = new ClsGenerales();
|
|
|
|
int CvePaqueteria = DdlPaqueteriaEditar.SelectedValue.ToEntero();
|
|
int CvePaqueteriaGuiaTipo = DdlTipoEditar.SelectedValue.ToEntero();
|
|
int CveEstatus = DdlEstatusEditar.SelectedValue.ToEntero();
|
|
int CveSubProyecto = DdlSucursalesEditar.SelectedValue.ToEntero();
|
|
|
|
String Guia = (TxtGuia.Text != "") ? TxtGuia.Text : "-1";
|
|
String Rastreo = TxtRastreo.Text;
|
|
String Fecha = TxtFecha.Text;
|
|
String FechaEstimada = TxtFechaEstimada.Text == "" ? "-1" : TxtFechaEstimada.Text;
|
|
|
|
int NumCajas = TxtNumCajas.Text.ToEntero();
|
|
Double Peso = TxtPeso.Text.ToDouble();
|
|
String Dimensiones = TxtDimensiones.Text;
|
|
String Observaciones = TxtObservaciones.Text;
|
|
Boolean ImplicaCosto = ChkImplicaCosto.Checked;
|
|
|
|
Boolean MensajeEnviado = false;
|
|
|
|
if (ObjGeneral.UpdatePaqueteriasGuias(CvePaqueteriaGuia, CvePaqueteriaGuiaTipo, CveSubProyecto, CvePaqueteria, CveEstatus, Fecha, Rastreo, Guia, NumCajas, Peso, Dimensiones, FechaEstimada, Observaciones, ImplicaCosto))
|
|
{
|
|
|
|
if (Guia == "-1")
|
|
{
|
|
Alert(String.Format("La Guía se ha actualizado correctamente."), ModExtensiones.TipoMensaje.MsgInformacion);
|
|
}
|
|
else
|
|
{
|
|
//Si es Guia de Venta y se actualizo el estatus a Confirmado por el Cliente
|
|
if (CveVenta > 0 && CveEstatus == 4)
|
|
{
|
|
//Cargamos datos para Correo del Vendedor
|
|
CargaDatosCorreo(CveVenta, false);
|
|
Paqueteria = DdlPaqueteriaEditar.SelectedItem.Text;
|
|
|
|
MensajeEnviado = EnviarCorreoNotificacionEntrega(2, SerieFolio, NombreCliente, Destinatario, Paqueteria, Guia, Rastreo, CveVenta, DTMovimientos);
|
|
|
|
if (MensajeEnviado)
|
|
{
|
|
Alert(String.Format("La Guía {0} se ha actualizado correctamente.<br><br>Correo enviado exitosamente a {1}.", Guia, Destinatario));
|
|
}
|
|
else
|
|
{
|
|
Alert(String.Format("La Guía {0} se ha actualizado correctamente.<br><br>Error al enviar correo a: {1}.", Guia, Destinatario));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert(String.Format("La Guía {0} se ha actualizado correctamente.", Guia), ModExtensiones.TipoMensaje.MsgInformacion);
|
|
}
|
|
}
|
|
|
|
}
|
|
this.RegistraScript("$('#DivEditarGuia').modal('hide');");
|
|
ObjGeneral.Dispose();
|
|
}
|
|
|
|
protected void EliminaGuia()
|
|
{
|
|
ClsGenerales ObjGeneral = new ClsGenerales();
|
|
ObjGeneral.IniciaTransacSQL();
|
|
Boolean TieneError = false;
|
|
|
|
TieneError = !ObjGeneral.RemovePaqueteriasGuiasDetalles(-1, CvePaqueteriaGuia);
|
|
|
|
if (!TieneError)
|
|
{
|
|
TieneError = !ObjGeneral.RemovePaqueteriasGuias(CvePaqueteriaGuia);
|
|
}
|
|
|
|
if (!TieneError)
|
|
{
|
|
ObjGeneral.Commit();
|
|
Alert(String.Format("La Guía se ha Eliminado correctamente."), ModExtensiones.TipoMensaje.MsgInformacion);
|
|
}
|
|
else
|
|
{
|
|
ObjGeneral.RollBack();
|
|
}
|
|
ObjGeneral.Dispose();
|
|
}
|
|
|
|
|
|
protected void CargaGuiasVinculadas()
|
|
{
|
|
ClsGenerales ObjGeneral = new ClsGenerales();
|
|
if (ObjGeneral.GetPaqueteriasGuiasDetalles(-1, CvePaqueteriaGuia, -1, -1, -1, -1))
|
|
{
|
|
GvGuiasVinculadas.DataSource = ObjGeneral.DtResultados;
|
|
GvGuiasVinculadas.DataBind();
|
|
}
|
|
ObjGeneral.Dispose();
|
|
}
|
|
#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);
|
|
|
|
CvePaqueteriaGuia = GvRow.DataKey("CvePaqueteriaGuia").ToEntero();
|
|
|
|
if (GvRow.DataKey("TipoAgrupador").ToString() == "Venta")
|
|
{
|
|
CveVenta = GvRow.DataKey("CveAgrupador").ToString().ToEntero();
|
|
}
|
|
else
|
|
{
|
|
CveVenta = -1;
|
|
}
|
|
|
|
Paqueteria = GvRow.DataKey("Paqueteria");
|
|
Guia = GvRow.DataKey("Guia");
|
|
|
|
DdlSucursalesEditar.SelectedValueExist(GvRow.DataKey("CveSubProyecto"));
|
|
//DdlSucursalesEditar.Enabled = false;
|
|
DdlPaqueteriaEditar.SelectedValueExist((GvRow.DataKey("CvePaqueteria").ToEntero() > 0) ? GvRow.DataKey("CvePaqueteria") : "-1");
|
|
DdlTipoEditar.SelectedValueExist((GvRow.DataKey("CvePaqueteriaGuiaTipo").ToEntero() > 0) ? GvRow.DataKey("CvePaqueteriaGuiaTipo") : "-1");
|
|
DdlEstatusEditar.SelectedValueExist(GvRow.DataKey("CveEstatus"));
|
|
|
|
TxtGuia.Text = GvRow.DataKey("Guia");
|
|
TxtRastreo.Text = GvRow.DataKey("Rastreo");
|
|
TxtFecha.Text = GvRow.DataKey("Fecha");
|
|
TxtFechaEstimada.Text = GvRow.DataKey("FechaEstimada");
|
|
|
|
TxtNumCajas.Text = GvRow.DataKey("NumCajas");
|
|
TxtPeso.Text = String.Format("{0:N3}", GvRow.DataKey("Peso").ToDouble());
|
|
TxtDimensiones.Text = GvRow.DataKey("Dimensiones");
|
|
TxtObservaciones.Text = GvRow.DataKey("Observaciones");
|
|
|
|
ChkImplicaCosto.Checked = Boolean.Parse(GvRow.DataKey("ImplicaCosto"));
|
|
|
|
Boolean mostrarDescarga = CrearArchivo(false);
|
|
|
|
if (mostrarDescarga)
|
|
{
|
|
DivDownloadGuia.Visible = true;
|
|
} else
|
|
{
|
|
DivDownloadGuia.Visible = false;
|
|
}
|
|
|
|
CargaGuiasVinculadas();
|
|
|
|
if (!UsuarioActual.TienePermisoProceso(219))
|
|
{
|
|
DdlSucursalesEditar.Enabled = false;
|
|
DdlPaqueteriaEditar.Enabled = false;
|
|
DdlTipoEditar.Enabled = false;
|
|
DdlEstatusEditar.Enabled = false;
|
|
|
|
TxtGuia.Enabled = false;
|
|
TxtRastreo.Enabled = false;
|
|
TxtFecha.Enabled = false;
|
|
TxtFechaEstimada.Enabled = false;
|
|
|
|
imgCalendarioFecha.Enabled = false;
|
|
imgCalendarioFechaE.Enabled = false;
|
|
|
|
CETxtFecha.Enabled = false;
|
|
CETxtFechaE.Enabled = false;
|
|
|
|
TxtNumCajas.Enabled = false;
|
|
TxtPeso.Enabled = false;
|
|
TxtDimensiones.Enabled = false;
|
|
|
|
ChkImplicaCosto.Enabled = false;
|
|
TxtObservaciones.Enabled = false;
|
|
|
|
BtGuardarGuia.Visible = false;
|
|
}
|
|
|
|
if (!UsuarioActual.TienePermisoProceso(220))
|
|
{
|
|
BtnEliminarGuia.Visible = false;
|
|
}
|
|
|
|
UPEditarGuia.Update();
|
|
|
|
|
|
this.RegistraScript("$('#DivEditarGuia').modal('show');");
|
|
}
|
|
|
|
protected void BtGuardarGuia_Click(object sender, EventArgs e)
|
|
{
|
|
ActualizaGuia();
|
|
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)
|
|
{
|
|
if (e.Row.DBCampo("Liga") != "")
|
|
{
|
|
e.Row.FCHyperLink("BtnLiga").NavigateUrl = string.Format(e.Row.DBCampo("Liga"), e.Row.DBCampo("Guia"));
|
|
}
|
|
else
|
|
{
|
|
//e.Row.FCHyperLink("BtnLiga").Visible = false;
|
|
e.Row.FCHyperLink("BtnLiga").ToolTip = "Sin liga";
|
|
}
|
|
|
|
|
|
if (e.Row.DBCampo("CveAgrupador").ToString().ToEntero() > 0)
|
|
{
|
|
if (e.Row.DataKey("TipoAgrupador").ToString() == "Venta")
|
|
{
|
|
e.Row.FCHyperLink("HLFolio").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DataKey("CveAgrupador"));
|
|
}
|
|
if (e.Row.DataKey("TipoAgrupador").ToString() == "Mov")
|
|
{
|
|
e.Row.FCHyperLink("HLFolio").NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", e.Row.DataKey("CveAgrupador"));
|
|
}
|
|
if (e.Row.DataKey("TipoAgrupador").ToString() == "OC")
|
|
{
|
|
e.Row.FCHyperLink("HLFolio").NavigateUrl = String.Format("/OC/OC.aspx?OC={0}", e.Row.DataKey("CveAgrupador"));
|
|
}
|
|
if (e.Row.DataKey("TipoAgrupador").ToString() == "Compra")
|
|
{
|
|
e.Row.FCHyperLink("HLFolio").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DataKey("CveAgrupador"));
|
|
}
|
|
}
|
|
|
|
// Si la cve estatus es En Proceso o Confirmado por Proveedor
|
|
if (e.Row.DataKey("CveEstatus").ToEntero() > 2)
|
|
{
|
|
e.Row.FCLinkButton("SubirArchivo").Visible = false;
|
|
}
|
|
|
|
|
|
if (!UsuarioActual.TienePermisoProceso(219))
|
|
{
|
|
e.Row.FCLinkButton("SubirArchivo").Visible = false;
|
|
}
|
|
e.Row.FCLinkButton("LnkReasignar").Visible = e.Row.DataKey("EsEntregaInterna").ToString() == "True";
|
|
}
|
|
|
|
}
|
|
|
|
protected void GvGuiasVinculadas_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
if (e.Row.DBCampo("CveAgrupador").ToString().ToEntero() > 0)
|
|
{
|
|
if (e.Row.DataKey("TipoAgrupador").ToString() == "Venta")
|
|
{
|
|
e.Row.FCHyperLink("HLFolioDetalle").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DataKey("CveAgrupador"));
|
|
}
|
|
if (e.Row.DataKey("TipoAgrupador").ToString() == "Mov")
|
|
{
|
|
e.Row.FCHyperLink("HLFolioDetalle").NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", e.Row.DataKey("CveAgrupador"));
|
|
}
|
|
if (e.Row.DataKey("TipoAgrupador").ToString() == "OC")
|
|
{
|
|
e.Row.FCHyperLink("HLFolioDetalle").NavigateUrl = String.Format("/OC/OC.aspx?OC={0}", e.Row.DataKey("CveAgrupador"));
|
|
}
|
|
if (e.Row.DataKey("TipoAgrupador").ToString() == "Compra")
|
|
{
|
|
e.Row.FCHyperLink("HLFolioDetalle").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DataKey("CveAgrupador"));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void LnkAgregarGuia_Click(object sender, EventArgs e)
|
|
{
|
|
//Agregamos guia sin vincular
|
|
this.RegistraScript(String.Format("AbrirVentana('/General/PopUpPaqueteriasGuias.aspx',800,480);"));
|
|
}
|
|
|
|
protected void LnkImprimirPDF_Click(object sender, EventArgs e)
|
|
{
|
|
ImprimiReporte("PDF");
|
|
}
|
|
|
|
protected void LnkImprimirExcel_Click(object sender, EventArgs e)
|
|
{
|
|
ImprimiReporte("Excel");
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region SUBIR/DESCARGAR DOCUMENTO
|
|
protected void SubirArchivo_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
|
|
CvePaqueteriaGuia = GvRow.DataKey("CvePaqueteriaGuia").ToEntero();
|
|
|
|
Paqueteria = GvRow.DataKey("Paqueteria");
|
|
Guia = GvRow.DataKey("Guia");
|
|
Rastreo = GvRow.DataKey("Rastreo");
|
|
|
|
|
|
// Especificar demas parametros a subir
|
|
if (GvRow.DataKey("TipoAgrupador") == "Mov")
|
|
{
|
|
LblObservacionArchivo.InnerText = String.Format("Observación del Movimiento:");
|
|
}
|
|
else
|
|
{
|
|
LblObservacionArchivo.InnerText = String.Format("Observación de la {0}:", GvRow.DataKey("TipoAgrupador"));
|
|
}
|
|
|
|
if (GvRow.DataKey("TipoAgrupador").ToString() == "Venta")
|
|
{
|
|
CveVenta = GvRow.DataKey("CveAgrupador").ToString().ToEntero();
|
|
}
|
|
else
|
|
{
|
|
CveVenta = -1;
|
|
}
|
|
|
|
UpModalUploadGuiaDocumento.Update();
|
|
|
|
this.RegistraScript("$('#ModalUploadGuiaDocumento').modal({ backdrop: 'static', keyboard: false});");
|
|
}
|
|
|
|
protected void BtnModalGuiaDocumentoUpload_Click(object sender, EventArgs e)
|
|
{
|
|
String FileExtension = "-1";
|
|
List<Archivo> Filesgral = TxtFileDocumentacion.getfiles().Archivos;
|
|
|
|
foreach (Archivo fileItem in Filesgral)
|
|
{
|
|
try
|
|
{
|
|
FileExtension = System.IO.Path.GetExtension(string.Format("{0}Temp\\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
|
|
string rutaDestino = UsuarioActual.Empresa.Ruta + "Documentos\\Guias\\" + CvePaqueteriaGuia + "." + FileExtension;
|
|
if (!System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta + "Documentos\\Guias\\"))
|
|
{
|
|
System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta + "Documentos\\Guias\\");
|
|
}
|
|
|
|
if (System.IO.File.Exists(rutaDestino))
|
|
{
|
|
System.IO.File.Delete(rutaDestino);
|
|
}
|
|
|
|
System.IO.File.Copy(fileItem.FileUrl, rutaDestino);
|
|
|
|
//Al subir el archivo actualiza el estatus de la guia a
|
|
ClsGenerales ObjGral = new ClsGenerales();
|
|
|
|
Boolean TieneError = false;
|
|
Boolean MensajeEnviado = false;
|
|
|
|
int EstatusEntregado = 3;
|
|
|
|
//Mandamos a actualizar solo el estatus
|
|
if (!ObjGral.UpdatePaqueteriasGuias(CvePaqueteriaGuia,-1, -1, -1, EstatusEntregado, "-1", "", "", -1, -1, "-1", "-1", ""))
|
|
{
|
|
TieneError = true;
|
|
}
|
|
|
|
if (!TieneError)
|
|
{
|
|
//Si es Venta Notificamos a Cliente
|
|
if (CveVenta > 0)
|
|
{
|
|
CargaDatosCorreo(CveVenta, true);
|
|
MensajeEnviado = EnviarCorreoNotificacionEntrega(1, SerieFolio, NombreCliente, Destinatario, Paqueteria, Guia, Rastreo, CveVenta, DTMovimientos, RutaArchivoAdjunto: rutaDestino);
|
|
|
|
if (MensajeEnviado)
|
|
{
|
|
Alert(String.Format("El Archivo ha sido guardado y el estatus de la Guía ha sido actualizado correctamente. <br><br>Correo enviado exitosamente a {0}.", Destinatario));
|
|
}else
|
|
{
|
|
Alert(String.Format("El Archivo ha sido guardado y el estatus de la Guía ha sido actualizado correctamente. <br><br>Error al Notificar al Cliente a su correo: {0}.", Destinatario));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert("El Archivo ha sido guardado y el estatus de la Guía ha sido actualizado correctamente.");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert("Ocurrio un error al Guardar el Archivo o Actualizar el Estatus de la Guia.", ModExtensiones.TipoMensaje.MsgError);
|
|
}
|
|
|
|
ObjGral.Dispose();
|
|
|
|
CargaDatos();
|
|
|
|
UPDatos.Update();
|
|
TxtFileDocumentacion.Text = "";
|
|
TxtObservacionVenta.Text = "";
|
|
UpModalUploadGuiaDocumento.Update();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Alert("Error al cargar archivo", ModExtensiones.TipoMensaje.MsgError);
|
|
this.GuardaLog(string.Format("Error al cargar archivo: {0}", ex.Message));
|
|
}
|
|
}
|
|
|
|
this.RegistraScript("$('#ModalUploadGuiaDocumento').modal('hide')", "hidemodal3");
|
|
|
|
}
|
|
|
|
protected void BtnDownloadGuia_Click(object sender, EventArgs e)
|
|
{
|
|
CrearArchivo();
|
|
}
|
|
|
|
|
|
private Boolean CrearArchivo(Boolean descargar = true)
|
|
{
|
|
String path = Path.Combine(UsuarioActual.Empresa.Ruta, "Documentos", "Guias", CvePaqueteriaGuia.ToString() + ".pdf");
|
|
System.IO.FileInfo file = new System.IO.FileInfo(path);
|
|
|
|
|
|
string[] fileEntries = Directory.GetFiles(Path.Combine(UsuarioActual.Empresa.Ruta, "Documentos", "Guias"));
|
|
foreach (string fileName in fileEntries)
|
|
{
|
|
System.IO.FileInfo fileActual = new System.IO.FileInfo(fileName);
|
|
if (CvePaqueteriaGuia.ToString() == Path.GetFileNameWithoutExtension(fileActual.FullName))
|
|
{
|
|
file = fileActual;
|
|
}
|
|
}
|
|
|
|
//Si es descarga va por el archivo, si no regresa si existe o no
|
|
if (descargar)
|
|
{
|
|
DescargarArchivo(file);
|
|
}else
|
|
{
|
|
if (!file.Exists)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
private void DescargarArchivo(System.IO.FileInfo File)
|
|
{
|
|
if (File.Exists)
|
|
{
|
|
try
|
|
{
|
|
Response.Clear();
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename="+ String.Format("Guia {0} - {1}{2}",Paqueteria, Guia,File.Extension));
|
|
Response.AddHeader("Content-Length", File.Length.ToString());
|
|
Response.ContentType = "application/octet-stream";
|
|
Response.WriteFile(File.FullName);
|
|
|
|
Response.End();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Alert(e.Message, ModExtensiones.TipoMensaje.MsgError);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert("Ocurrio un error al descargar el archivo", ModExtensiones.TipoMensaje.MsgAdvertencia, "window.close()");
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region GENERAR REPORTE
|
|
|
|
protected void ImprimiReporte(string Formato = "PDF")
|
|
{
|
|
string Sucursal = DdlSucursales.SelectedItem.Text;
|
|
string Estatus = DdlEstatus.SelectedItem.Text;
|
|
string Paqueteria = DdlPaqueterias.SelectedItem.Text;
|
|
|
|
string FechaInicio = DateTime.Parse(TxtFechaI.Text).ToShortDateString();
|
|
string FechaFinal = DateTime.Parse(TxtFechaF.Text).ToShortDateString();
|
|
|
|
string FechaIngInicio = TxtFechaInicialIngreso.Text;
|
|
string FechIngaFinal = TxtFechaFinalIngreso.Text;
|
|
|
|
|
|
string Ruta = string.Format("{0}Empresas/{1}/", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa);
|
|
string RutaPDF = string.Format("{0}/Formatos/RepPaqueteriasGuias.rdlc", Ruta);
|
|
|
|
if (!File.Exists(RutaPDF))
|
|
{
|
|
RutaPDF = "Empresas/Grales/Formatos/RepPaqueteriasGuias.rdlc";
|
|
}
|
|
|
|
var logouri = string.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
|
|
System.IO.FileInfo Imagen = new System.IO.FileInfo(string.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta));
|
|
|
|
List<ReportParameter> @params = new List<ReportParameter>();
|
|
|
|
@params.Add(new ReportParameter("pEmp", UsuarioActual.Empresa.Empresa));
|
|
@params.Add(new ReportParameter("pImg", new Uri(Server.MapPath(string.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri));
|
|
@params.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa));
|
|
|
|
@params.Add(new ReportParameter("Sucursal", Sucursal));
|
|
@params.Add(new ReportParameter("Estatus", Estatus));
|
|
@params.Add(new ReportParameter("Paqueteria", Paqueteria));
|
|
@params.Add(new ReportParameter("FechaInicio", FechaInicio));
|
|
@params.Add(new ReportParameter("FechaFin", FechaFinal));
|
|
|
|
//@params.Add(new ReportParameter("FechaIngInicio", FechaIngInicio));
|
|
//@params.Add(new ReportParameter("FechaIngFin", FechIngaFinal));
|
|
|
|
@params.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre));
|
|
@params.Add(new ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString()));
|
|
@params.Add(new ReportParameter("Filtros", String.Format(" <b>Sucursal: </b>{0}  <b>Estatus: </b>{1}  <b>Paquetería: </b>{2}<br/><b>Fecha Inicio: </b>{3}  <b>Fecha Fin: </b>{4}", Sucursal, Estatus, Paqueteria, FechaInicio, FechaFinal)));
|
|
|
|
string Usuario = DdlUsuarios.SelectedValue == "-1" ? "" : DdlUsuarios.SelectedItem.Text;
|
|
@params.Add(new ReportParameter("FiltroUsuario", Usuario));
|
|
|
|
if (Imagen.Exists)
|
|
{
|
|
@params.Add(new ReportParameter("LogoPath", logouri));
|
|
}
|
|
else
|
|
{
|
|
@params.Add(new ReportParameter("LogoPath", ""));
|
|
}
|
|
|
|
ImprimirPDF(RutaPDF, DTDatos, @params, "RepPaqueteriasGuias" + DateTime.Now.ToString("yyyyMMddhhmmss"), Formato);
|
|
}
|
|
#endregion
|
|
|
|
#region CORREO DE NOTIFICACION DE GUIA
|
|
protected Boolean EnviarCorreoNotificacionEntrega(int Tipo, String SerieFolio, String NombreCliente, String Destinatario, String Paqueteria, String Guia, String Rastreo, int CveVenta, DataTable tDtMovimientos, int CountPaqueteria = 0, int CvePaqueteriaGuia = -1, String RutaArchivoAdjunto = "")
|
|
{
|
|
ClsSisMail Correo = new ClsSisMail();
|
|
String Asunto = String.Format("{0} Envio de pedido: {1}", UsuarioActual.Empresa.NombreCorto, SerieFolio);
|
|
StringBuilder Cuerpo = new StringBuilder();
|
|
|
|
Boolean MensajeEnviado = false;
|
|
|
|
switch (Tipo)
|
|
{
|
|
// Tipo 1 Paqueteria Entregada - Notifica a Cliente al subir archivo
|
|
case 1:
|
|
Cuerpo.AppendLine(String.Format("Estimado {0} le informamos que los productos de la factura {1} con Guía {3} y paquetería {2} han sido entregados.<br><br>", NombreCliente, SerieFolio, Paqueteria, Guia));
|
|
|
|
if (tDtMovimientos.Rows.Count > 0)
|
|
{
|
|
Cuerpo.AppendLine("<table><tr>");
|
|
Cuerpo.AppendLine("<th>Cantidad</th><th>Producto</th>");
|
|
|
|
|
|
foreach (DataRow Drow in tDtMovimientos.Rows)
|
|
{
|
|
Cuerpo.AppendLine(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", Drow["Cantidad"].ToString().ToEntero(), Drow["PS"].ToString()));
|
|
}
|
|
|
|
Cuerpo.AppendLine("</tr></table>");
|
|
}
|
|
|
|
Cuerpo.AppendLine("<br><br>Dudas y aclaraciones con su coordinador empresarial.");
|
|
|
|
string body = DocumentoEntregaInterna(this.CveVenta);
|
|
//Adjunta Archivo al Correo
|
|
ClsSisMail.ArchivoMail ArchivoAdjunto = new ClsSisMail.ArchivoMail();
|
|
|
|
List<ClsSisMail.ArchivoMail> ListaAdjuntos = new List<ClsSisMail.ArchivoMail>();
|
|
|
|
if (File.Exists(RutaArchivoAdjunto))
|
|
{
|
|
ArchivoAdjunto.ArchivoBinario = File.ReadAllBytes(RutaArchivoAdjunto);
|
|
ArchivoAdjunto.Ruta = RutaArchivoAdjunto;
|
|
ArchivoAdjunto.NombreArchivo = new FileInfo(RutaArchivoAdjunto).Name;
|
|
|
|
ListaAdjuntos.Add(ArchivoAdjunto);
|
|
}
|
|
|
|
if ((ListaAdjuntos.Count > 0))
|
|
{
|
|
MensajeEnviado = Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, body.ToString(), Archivos: ListaAdjuntos);
|
|
}
|
|
else
|
|
{
|
|
MensajeEnviado = Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, body.ToString());
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
// Tipo 2 Paqueteria Recibida por Cliente - Notifica a Vendedor al actualizar estatus a 4
|
|
Cuerpo.AppendLine(String.Format("Le informamos que los productos de la factura {0} con Guía {1} y paquetería {2} han sido confirmados de recibido por el Cliente {3}.<br><br>", SerieFolio, Guia, Paqueteria, NombreCliente));
|
|
|
|
if (tDtMovimientos.Rows.Count > 0)
|
|
{
|
|
Cuerpo.AppendLine("<table><tr>");
|
|
Cuerpo.AppendLine("<th>Cantidad</th><th>Producto</th>");
|
|
|
|
foreach (DataRow Drow in tDtMovimientos.Rows)
|
|
{
|
|
Cuerpo.AppendLine(String.Format("<tr><td>{0}</td><td>{1}</td></tr>", Drow["Cantidad"].ToString().ToEntero(), Drow["PS"].ToString()));
|
|
}
|
|
Cuerpo.AppendLine("</tr></table>");
|
|
}
|
|
|
|
if (Correo.SendMail(UsuarioActual.Empresa, Destinatario, Asunto, Cuerpo.ToString()))
|
|
{
|
|
MensajeEnviado = true;
|
|
}
|
|
|
|
break;
|
|
case 3:
|
|
//Tipo 3 Guia reasignada
|
|
Cuerpo.AppendLine(String.Format("Motivo:{0}. Tu envío fue reprogramado para el siguiente día hábil.", DdlMotivoRechazoGuia.SelectedItem.Text));
|
|
CargaDatosCorreo(this.CveVenta);
|
|
if (Correo.SendMail(UsuarioActual.Empresa, this.Destinatario, Asunto, Cuerpo.ToString()))
|
|
{
|
|
MensajeEnviado = true;
|
|
}
|
|
break;
|
|
}
|
|
return MensajeEnviado;
|
|
}
|
|
|
|
|
|
protected void CargaDatosCorreo(int CveVenta, Boolean SubirArchivo = false)
|
|
{
|
|
if (CveVenta > 0)
|
|
{
|
|
|
|
ClsVentas ObjVentas = new ClsVentas();
|
|
|
|
if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa))
|
|
{
|
|
if (ObjVentas.DtResultados.Rows.Count > 0)
|
|
{
|
|
DataRow DbRowVenta = ObjVentas.DtResultados.Rows[0];
|
|
|
|
int CveCliente = DbRowVenta["CveCliente"].ToString().ToEntero();
|
|
int CveVendedor = DbRowVenta["CveVendedor"].ToString().ToEntero();
|
|
SerieFolio = String.Format("{0}-{1}", DbRowVenta["Serie"].ToString(), DbRowVenta["Folio"].ToString().ToEntero());
|
|
NombreCliente = DbRowVenta["ClienteNombre"].ToString();
|
|
|
|
|
|
//Si se subio Archivo
|
|
if (!SubirArchivo)
|
|
{
|
|
//correo de Vendedor
|
|
Destinatario = DbRowVenta["CorreoVendedorVenta"].ToString();
|
|
}
|
|
else
|
|
{
|
|
//correo del cliente
|
|
Destinatario = DbRowVenta["Mail"].ToString();
|
|
}
|
|
|
|
Destinatario = "sig.buzon02@gmail.com"; // CORREO PRUEBA
|
|
if (UsuarioActual.Empresa.Funcionalidad(280) == "1" && CveCliente > 0 && CveVendedor > 0)
|
|
{
|
|
Destinatario = getCorreoNotificacion(CveCliente, CveVendedor);
|
|
}
|
|
|
|
if (ObjVentas.GetVentaDetalle(CveVenta))
|
|
{
|
|
DTMovimientos = ObjVentas.DtResultados;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private string getCorreoNotificacion(int CveCliente, int CveVendedor)
|
|
{
|
|
DataRow DatosCliente = get_GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimero(string.Format("CveCliente = {0}",CveCliente));
|
|
DataRow DatosVendedor = get_GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimero(string.Format("CveVendedor = {0}", CveVendedor));
|
|
if (DatosCliente != null && DatosVendedor != null)
|
|
{
|
|
StringBuilder correos = new StringBuilder("");
|
|
if (DatosCliente["CorreoEntregaCompras"].ToString().Length > 0) correos.Append(string.Format("{0};", DatosCliente["CorreoEntregaCompras"].ToString()));
|
|
if (DatosCliente["CorreoEntregaAlmacen"].ToString().Length > 0) correos.Append(string.Format("{0};", DatosCliente["CorreoEntregaAlmacen"].ToString()));
|
|
if (DatosVendedor["Correo"].ToString().Length > 0) correos.Append(string.Format("{0};", DatosVendedor["Correo"].ToString()));
|
|
if (DatosVendedor["CorreoAdicionalNotificaciones"].ToString().Length > 0) correos.Append(string.Format("{0};", DatosVendedor["CorreoAdicionalNotificaciones"].ToString()));
|
|
return correos.ToString();
|
|
}
|
|
return "";
|
|
}
|
|
#endregion
|
|
|
|
protected void Reasignar_Click(object sender, EventArgs e)
|
|
{
|
|
this.RegistraScript("$('#ModalMotivoReasignacion').modal('show')", "hidemodal3");
|
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
CvePaqueteriaGuiaReasignar = GvRow.DataKey("CvePaqueteriaGuia").ToEntero();
|
|
CveVenta = GvRow.DataKey("CveAgrupador").ToString().ToEntero();
|
|
Folio = GvRow.DataKey("Folio").ToString();
|
|
}
|
|
|
|
protected void BtnReasignar_Click(object sender, EventArgs e)
|
|
{
|
|
ClsGenerales ObjGeneral = new ClsGenerales();
|
|
if (ObjGeneral.AsignarEntregasPorRealizar(CvePaqueteriaGuiaReasignar, -1, CveMotivoRechazoPaqueteria:DdlMotivoRechazoGuia.SelectedValue.ToEntero()))
|
|
{
|
|
Alert("La guía está lista para volver a ser asignada, disponible en el reporte <a style='color:#23527c' href='/Inventarios/EntregasPorRealizar.aspx'>Entregas Por Realizar</a>");
|
|
}
|
|
ObjGeneral.Dispose();
|
|
CargaDatos();
|
|
UPDatos.Update();
|
|
CvePaqueteriaGuiaReasignar = -1;
|
|
EnviarCorreoNotificacionEntrega(3, Folio, "","","","","",-1,null);
|
|
this.RegistraScript("$('#ModalMotivoReasignacion').modal('hide')", "hidemodal3");
|
|
}
|
|
|
|
private string DocumentoEntregaInterna(int CveVenta)
|
|
{
|
|
ClsVentas ObjVentas = new ClsVentas();
|
|
|
|
if (ObjVentas.GetVenta(CveVenta,UsuarioActual.CveEmpresa))
|
|
{
|
|
DataRow row = ObjVentas.DtResultados.Rows[0];
|
|
string ClienteNombre = row["ClienteNombre"].ToString();
|
|
string FolioVenta = row["SerieFolio"].ToString();
|
|
string Pedido = row["PedidoContrato"].ToString();
|
|
string OrdenCompra = row["OrdenCompra"].ToString();
|
|
string tipoDocto = row["TipoDocto"].ToString();
|
|
DataTable DtDetalle = new DataTable();
|
|
if (ObjVentas.GetVentaDetalle(CveVenta))
|
|
{
|
|
DtDetalle = ObjVentas.DtResultados;
|
|
}
|
|
string DetalleTable = "";
|
|
foreach (DataRow dRow in DtDetalle.Rows)
|
|
{
|
|
string detalle = string.Format("<tr><td style='width:25%'>{0}</td><td style='width:25%'>{1}</td><td style='width:50%'>{2}</td></tr>", dRow["Codigo"], dRow["Cantidad"], dRow["PS"]);
|
|
DetalleTable += detalle;
|
|
}
|
|
|
|
StringBuilder strBody = new StringBuilder();
|
|
strBody.Append("<html>");
|
|
strBody.Append("<head>");
|
|
strBody.Append("<meta charset='UTF-8'>");
|
|
strBody.Append("</head>");
|
|
strBody.Append(" <body>");
|
|
strBody.Append("<div>");
|
|
strBody.Append($"<img src='http://sig.adssistemas.mx/Empresas/{UsuarioActual.CveEmpresa}/Logo.png' style='width:200px'></img>");
|
|
strBody.Append("</div>");
|
|
strBody.Append(" <p style='font-family:Segoe UI Semibold;font-size:12pt;width:100%'>");
|
|
strBody.Append($" Apreciable {ClienteNombre}, su pedido correspondiente a la {tipoDocto}:");
|
|
strBody.Append(" </p>");
|
|
strBody.Append($" <p style='width:100%;text-align:center;font-family:Segoe UI Semibold;font-size:12pt'>{FolioVenta} - Pedido {Pedido} - Orden de Compra {OrdenCompra}</P>");
|
|
strBody.Append(" <p style='font-family:Segoe UI Semibold;font-size:12pt;width:100%'>Su Pedido:</p>");
|
|
strBody.Append(" <div style='width:100%;text-align:center'>");
|
|
strBody.Append(" <table style='width:80%;font-family:Segoe UI Semibold;font-size:12pt'>");
|
|
strBody.Append(DetalleTable);
|
|
strBody.Append(" </table>");
|
|
strBody.Append(" </div>");
|
|
strBody.Append(" <br/>");
|
|
strBody.Append(" <p style='font-family:Segoe UI Semibold;font-size:12pt;width:100%'>");
|
|
strBody.Append(" Agradecemos su preferencia. <br/>");
|
|
strBody.Append(" Compuproveedores");
|
|
strBody.Append(" </p>");
|
|
strBody.Append(" <p style='font-family:Segoe UI Semibold;font-size:12pt;width:100%;text-align:center'>");
|
|
strBody.Append(" Sigue disfrutando de nuestros productos y servicios<br/>");
|
|
strBody.Append(" <a href='https://www.compuproveedoresti.com/'>www.compuproveedores.com</a>");
|
|
strBody.Append("");
|
|
strBody.Append(" </p>");
|
|
strBody.Append(" </body>");
|
|
strBody.Append("</html>");
|
|
|
|
return strBody.ToString();
|
|
}
|
|
ObjVentas.Dispose();
|
|
return "";
|
|
}
|
|
|
|
} |