-cleanup
This commit is contained in:
@@ -1,28 +1,27 @@
|
||||
using System;
|
||||
using Extensiones;
|
||||
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;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
{
|
||||
|
||||
|
||||
DataTable DTGenerarDocumentos
|
||||
{
|
||||
get {
|
||||
get
|
||||
{
|
||||
|
||||
if(ViewState["DTGenerarDocumentos"] == null){
|
||||
if (ViewState["DTGenerarDocumentos"] == null)
|
||||
{
|
||||
ViewState["DTGenerarDocumentos"] = new DataTable();
|
||||
}
|
||||
return (DataTable)ViewState["DTGenerarDocumentos"];
|
||||
|
||||
}
|
||||
set {
|
||||
set
|
||||
{
|
||||
ViewState["DTGenerarDocumentos"] = (DataTable)value;
|
||||
}
|
||||
}
|
||||
@@ -61,7 +60,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
ViewState["DTRecoleccion"] = (DataTable)value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SeleccionEntrega
|
||||
{
|
||||
get
|
||||
@@ -69,18 +68,19 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
if (ViewState["SeleccionEntrega"] == null)
|
||||
{
|
||||
ViewState["SeleccionEntrega"] = false;
|
||||
}
|
||||
return (bool) ViewState["SeleccionEntrega"];
|
||||
}
|
||||
return (bool)ViewState["SeleccionEntrega"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["SeleccionEntrega"] = (bool)value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int CveEntregaAlmacen
|
||||
{
|
||||
get {
|
||||
get
|
||||
{
|
||||
|
||||
if (ViewState["CveEntregaAlmacen"] == null)
|
||||
{
|
||||
@@ -98,35 +98,35 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
{
|
||||
|
||||
SeleccionEntrega = true;
|
||||
SeleccionEntrega = true;
|
||||
CargaCombos();
|
||||
CargaDatos();
|
||||
CargaDatos();
|
||||
|
||||
#region RECOLEECION
|
||||
// CargaDatosRecoleccion();
|
||||
|
||||
// CargaDatosRecoleccion();
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnAsignar_Click(object sender, EventArgs e)
|
||||
{
|
||||
{
|
||||
|
||||
|
||||
if(DdlChofer.SelectedValue.ToEntero() <= 0)
|
||||
if (DdlChofer.SelectedValue.ToEntero() <= 0)
|
||||
{
|
||||
Alert("Debe seleccionar un chofer.", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
|
||||
if(DdlUnidadCamion.SelectedValue.ToEntero() <= 0)
|
||||
if (DdlUnidadCamion.SelectedValue.ToEntero() <= 0)
|
||||
{
|
||||
Alert("Debe seleccionar una unidad", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder SBError = new StringBuilder();
|
||||
ActualizaOrdenDTGenerarDocumentos();
|
||||
@@ -136,16 +136,16 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
bool TieneError = false;
|
||||
ClsGenerales ObjGeneral = new ClsGenerales();
|
||||
ObjGeneral.IniciaTransacSQL();
|
||||
GridViewRowCollection Grid = GvGenerarDocumentos.Rows;
|
||||
GridViewRowCollection Grid = GvGenerarDocumentos.Rows;
|
||||
string Usuario = DdlChofer.SelectedItem.Text;
|
||||
|
||||
|
||||
|
||||
|
||||
int CveDireccionOrigen = -1;
|
||||
foreach (GridViewRow row in Grid)
|
||||
{
|
||||
int Orden = row.DataKey("Orden").ToEntero();
|
||||
int CveDireccionDestino = row.DataKey("CveDireccionEnvio").ToEntero();
|
||||
int CveDireccionDestino = row.DataKey("CveDireccionEnvio").ToEntero();
|
||||
|
||||
if (CveDireccionDestino <= 0)
|
||||
{
|
||||
@@ -154,12 +154,12 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
break;
|
||||
}
|
||||
DateTime fechallegada = (TxtFechaEntrega.Text + " 23:59").ToDate();
|
||||
int CveEntregaAlmacen = ObjGeneral.AddInvEntregaAlmacenRuta(row.DataKey("CveSubProyectoOrigen").ToEntero(), CveDireccionOrigen, CveDireccionDestino, row.DataKey("CveMovimiento").ToEntero(), DdlChofer.SelectedValue.ToEntero(), DdlUnidadCamion.SelectedValue.ToEntero(), TxtFechaEntrega.Text.ToDate(), fechallegada, "E", "","", "1900-01-01".ToDate(), Orden,0, 1);
|
||||
int CveEntregaAlmacen = ObjGeneral.AddInvEntregaAlmacenRuta(row.DataKey("CveSubProyectoOrigen").ToEntero(), CveDireccionOrigen, CveDireccionDestino, row.DataKey("CveMovimiento").ToEntero(), DdlChofer.SelectedValue.ToEntero(), DdlUnidadCamion.SelectedValue.ToEntero(), TxtFechaEntrega.Text.ToDate(), fechallegada, "E", "", "", "1900-01-01".ToDate(), Orden, 0, 1);
|
||||
CveDireccionOrigen = row.DataKey("CveDireccionEnvio").ToEntero();
|
||||
|
||||
if (CveEntregaAlmacen > 0)
|
||||
{
|
||||
int CveTimbre = ObjGeneral.AddGralTimbre("Ent", row.DataKey("CveSubProyectoOrigen").ToEntero(), TxtFechaEntrega.Text.ToDate(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:CveEntregaAlmacen, AplicaCP: ChkEmitirCartaPorte.Checked);
|
||||
{
|
||||
int CveTimbre = ObjGeneral.AddGralTimbre("Ent", row.DataKey("CveSubProyectoOrigen").ToEntero(), TxtFechaEntrega.Text.ToDate(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen: CveEntregaAlmacen, AplicaCP: ChkEmitirCartaPorte.Checked);
|
||||
|
||||
if (CveTimbre <= 0)
|
||||
{
|
||||
@@ -178,9 +178,9 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
SBError.AppendLine($"Factura {row.DataKey("SerieFolio")} error al agregar entrega almacen. ");
|
||||
TieneError = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!TieneError)
|
||||
{
|
||||
@@ -195,7 +195,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
{
|
||||
TieneError = true;
|
||||
ModExtensiones.GuardaLog(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!TieneError)
|
||||
@@ -207,16 +207,16 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
bool huboerror = false;
|
||||
|
||||
foreach (int cvetimbre in ListaTimbres)
|
||||
{
|
||||
Timbres ObjTimbres = new Timbres("Ent", cvetimbre, UsuarioActual);
|
||||
{
|
||||
Timbres ObjTimbres = new Timbres("Ent", cvetimbre, UsuarioActual);
|
||||
MensajeAlert.AppendFormat("Folio: <b>{0}</b> ", ObjTimbres.ObjFactura.SerieFolio);
|
||||
if (ObjTimbres.Timbrar())
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
MensajeAlert.AppendFormat("<a class='texto' style='color:#337ab7' href='/Compras/PopUpVerFactura.aspx?P={0}' target='_blank'>XML <i class='fa fa-file'></i></i></a> ", ModExtensiones.Encripta(String.Format("OP=DesXmlTra&CveTimbre={0}&EXT={1}&FOLIO={2}&TIPODOCTO={3}", cvetimbre, "XML", ObjTimbres.ObjFactura.SerieFolio, ObjTimbres.ObjFactura.TipoDocto)));
|
||||
MensajeAlert.AppendFormat("<a class='texto' style='color:#337ab7' href='/Compras/PopUpVerFactura.aspx?P={0}' target='_blank'>PDF <i class='fa fa-ad-pdf'></i></i></i></a> ", ModExtensiones.Encripta(String.Format("OP=CARPOTIMBRE&CVETIMBRE={0}", cvetimbre)));
|
||||
MensajeAlert.Append("<br/>");
|
||||
|
||||
|
||||
DdlChofer.SelectedValueExist("-1");
|
||||
DdlUnidadCamion.SelectedValueExist("-1");
|
||||
ChkEmitirCartaPorte.Checked = false;
|
||||
@@ -228,7 +228,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
{
|
||||
huboerror = true;
|
||||
MensajeAlert.AppendFormat("<ul><li>{0}</li></ul>", ObjTimbres.MsgError);
|
||||
}
|
||||
}
|
||||
}
|
||||
Alert(MensajeAlert.ToString(), ModExtensiones.TipoMensaje.MsgInformacion);
|
||||
CargaDatos();
|
||||
@@ -239,10 +239,11 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
ObjGeneral.RollBack();
|
||||
}
|
||||
ObjGeneral.Dispose();
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert(SBError.ToString(), ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -276,11 +277,11 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
int CveDireccionOrigen = -1;
|
||||
foreach (GridViewRow row in gvR.Rows)
|
||||
{
|
||||
int Orden = row.DataKey("Orden").ToEntero();
|
||||
int Orden = row.DataKey("Orden").ToEntero();
|
||||
int CveEntregaAlmacen = row.DataKey("CveEntregaAlmacen").ToEntero();
|
||||
|
||||
if (row.FCCheckBox("Chk").Checked)
|
||||
{
|
||||
{
|
||||
CveDireccionOrigen = row.DataKey("CveDireccionOrigen").ToEntero();
|
||||
|
||||
if (CveEntregaAlmacen > 0)
|
||||
@@ -345,7 +346,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
foreach (int cvetimbre in ListaTimbres)
|
||||
{
|
||||
Timbres ObjTimbres = new Timbres("Rec", cvetimbre, UsuarioActual);
|
||||
|
||||
|
||||
if (ObjTimbres.Timbrar())
|
||||
{
|
||||
//ClsPaginas.PdfFactura(ref ObjTimbres.ObjFactura,"0",true);
|
||||
@@ -369,7 +370,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
//if (UsuarioActual.Empresa.Funcionalidad(161) == "1")
|
||||
// MensajeAlert.AppendFormat("<ul><li><a class='Texto' href='/Compras/PopUpVerFactura.aspx?P={0}'>Descargar Carta Porte</a></li></ul>", Encripta(String.Format("OP=CARPOTIMBRE&CVETIMBRE={0}", cvetimbre)));
|
||||
//else
|
||||
// MensajeAlert.AppendFormat("<ul><li><a class='Texto' href='/Compras/PopUpVerFactura.aspx?P={0}'>Descargar Carta Porte</a></li></ul>", ModExtensiones.Encripta(String.Format("OP=CARPO&CveTimbre={0}", cvetimbre)));
|
||||
// MensajeAlert.AppendFormat("<ul><li><a class='Texto' href='/Compras/PopUpVerFactura.aspx?P={0}'>Descargar Carta Porte</a></li></ul>", ModExtensiones.Encripta(String.Format("OP=CARPO&CveTimbre={0}", cvetimbre)));
|
||||
|
||||
}
|
||||
else
|
||||
@@ -381,7 +382,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
CargaDatosRecoleccion();
|
||||
DdlChofer.SelectedValueExist("-1");
|
||||
DdlUnidadCamion.SelectedValueExist("-1");
|
||||
|
||||
|
||||
SeleccionEntrega = false;
|
||||
SeleccionarGenerar(1);
|
||||
UpDatos.Update();
|
||||
@@ -400,7 +401,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
private void CargaDatos()
|
||||
{
|
||||
ClsGenerales ObjGeneral = new ClsGenerales();
|
||||
if (ObjGeneral.GetInvEntregaAlmacenRuta(DdlSubProyecto.SelectedValue.ToEntero(), TxtFechaI.Text.ToDate(), TxtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa, 1))
|
||||
if (ObjGeneral.GetInvEntregaAlmacenRuta(DdlSubProyecto.SelectedValue.ToEntero(), TxtFechaI.Text.ToDate(), TxtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa, 1))
|
||||
{
|
||||
GvEntregas.DataSource = ObjGeneral.DtResultados;
|
||||
DTDatosConsulta = ObjGeneral.DtResultados;
|
||||
@@ -410,12 +411,12 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
ObjGeneral.Dispose();
|
||||
GvEntregas.DataBind();
|
||||
|
||||
UpDatos.Update();
|
||||
UpDatos.Update();
|
||||
}
|
||||
private void CargaCombos()
|
||||
{
|
||||
|
||||
DdlUnidadCamion.DataSource = get_GlobalDTInvCamiones(UsuarioActual.CveEmpresa);
|
||||
DdlUnidadCamion.DataSource = get_GlobalDTInvCamiones(UsuarioActual.CveEmpresa);
|
||||
DdlUnidadCamion.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||||
DdlUnidadCamion.DataBind();
|
||||
DdlUnidadRec.DataSource = get_GlobalDTInvCamiones(UsuarioActual.CveEmpresa);
|
||||
@@ -424,7 +425,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
|
||||
TxtFechaI.Text = DateTime.Now.AddDays(-1).ToShortDateString();
|
||||
TxtFechaF.Text = DateTime.Now.AddDays(3).ToShortDateString();
|
||||
|
||||
|
||||
DdlChofer.DataSource = get_GlobalDTChoferes(UsuarioActual.CveEmpresa);
|
||||
DdlChofer.DataBind();
|
||||
DdlChofer.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||||
@@ -432,21 +433,22 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
DdlChoferRec.DataBind();
|
||||
DdlChoferRec.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||||
|
||||
TxtFechaEntrega.Text = DateTime.Now.ToShortDateString();
|
||||
TxtFechaEntrega.Text = DateTime.Now.ToShortDateString();
|
||||
|
||||
TabRecoleccion.Visible = UsuarioActual.Empresa.Funcionalidad(531)=="1";
|
||||
TabRecoleccion.Visible = UsuarioActual.Empresa.Funcionalidad(531) == "1";
|
||||
TxtFechaLimite.Text = DateTime.Now.ToShortDateString();
|
||||
|
||||
CargarCentrosDeCosto(null, DdlSubProyecto, null, LblSubProyecto);
|
||||
CargarCentrosDeCosto(null, DdlSubProyectoRecoleccion, null, LblSubProyectoRecoleccion);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void LnkGenerarDocumentos_Click(object sender, EventArgs e)
|
||||
{
|
||||
SeleccionarGenerar(1);
|
||||
}
|
||||
private void SeleccionarGenerar(int Opcion ) {
|
||||
}
|
||||
private void SeleccionarGenerar(int Opcion)
|
||||
{
|
||||
|
||||
if (SeleccionEntrega)
|
||||
{
|
||||
@@ -542,7 +544,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -550,8 +552,8 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
BtnConsultar.Visible = true;
|
||||
SeleccionEntrega = true;
|
||||
LnkGenerarDocumentos.Text = "Preseleccionar";
|
||||
LnkGenerarDocumentos.CssClass = "btn btn-primary";
|
||||
|
||||
LnkGenerarDocumentos.CssClass = "btn btn-primary";
|
||||
|
||||
|
||||
OcultarmostarDatosEntrega(false);
|
||||
|
||||
@@ -561,10 +563,10 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
UpDatos.Update();
|
||||
UpFiltro.Update();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OcultarmostarDatosEntrega(bool mostrar )
|
||||
private void OcultarmostarDatosEntrega(bool mostrar)
|
||||
{
|
||||
//DVDatosEntrega1.Visible = mostrar;
|
||||
DVDatosEntrega2.Visible = mostrar;
|
||||
@@ -586,21 +588,21 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
{
|
||||
DvCartaPorte2.Visible = mostrar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ActualizaOrdenDTGenerarDocumentos()
|
||||
{
|
||||
string[] OrdenMovimientos = Request.Form.GetValues("OrdenMovimientos");
|
||||
string[] OrdenMovimientos = Request.Form.GetValues("OrdenMovimientos");
|
||||
|
||||
int NumOrden = 1;
|
||||
foreach (string CveMovimiento in OrdenMovimientos)
|
||||
{
|
||||
foreach(DataRow dRow in DTGenerarDocumentos.Rows)
|
||||
foreach (DataRow dRow in DTGenerarDocumentos.Rows)
|
||||
{
|
||||
if (CveMovimiento.ToEntero() == dRow["CveMovimiento"].ToString().ToEntero() )
|
||||
if (CveMovimiento.ToEntero() == dRow["CveMovimiento"].ToString().ToEntero())
|
||||
{
|
||||
dRow["Orden"] = NumOrden;
|
||||
}
|
||||
@@ -608,7 +610,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
DTGenerarDocumentos.AcceptChanges();
|
||||
NumOrden++;
|
||||
}
|
||||
|
||||
|
||||
DataView DTview = new DataView(DTGenerarDocumentos);
|
||||
|
||||
// Sort by State and ZipCode column in descending order
|
||||
@@ -618,13 +620,13 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
GvGenerarDocumentos.DataBind();
|
||||
UpDatos.Update();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void BtnConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(Tab.ActiveTabIndex == 0)
|
||||
if (Tab.ActiveTabIndex == 0)
|
||||
{
|
||||
CargaDatos();
|
||||
}
|
||||
@@ -633,14 +635,14 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
CargaDatosRecoleccion();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region RECOLECCION
|
||||
|
||||
|
||||
private DataTable InitDTRecoleccion()
|
||||
private DataTable InitDTRecoleccion()
|
||||
{
|
||||
DataTable DT = new DataTable();
|
||||
|
||||
@@ -649,8 +651,8 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
DT.Columns.Add("CvePS", System.Type.GetType("System.Int32"));
|
||||
DT.Columns.Add("Cantidad", System.Type.GetType("System.Double"));
|
||||
DT.Columns.Add("CveUnidadMedida", System.Type.GetType("System.Int32"));
|
||||
DT.Columns.Add("CveUsuario",System.Type.GetType("System.Int32"));
|
||||
DT.Columns.Add("FechaIng",System.Type.GetType("System.DateTime"));
|
||||
DT.Columns.Add("CveUsuario", System.Type.GetType("System.Int32"));
|
||||
DT.Columns.Add("FechaIng", System.Type.GetType("System.DateTime"));
|
||||
DT.Columns.Add("CodigoPS", System.Type.GetType("System.String"));
|
||||
DT.Columns.Add("Abreviatura", System.Type.GetType("System.String"));
|
||||
|
||||
@@ -667,9 +669,9 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
}
|
||||
ObjGeneral.Dispose();
|
||||
gvR.DataBind();
|
||||
UpDatosRecoleccion.Update();
|
||||
UpDatosRecoleccion.Update();
|
||||
}
|
||||
|
||||
|
||||
private void CargaDatosRecoleccionDetallePS()
|
||||
{
|
||||
if (CveEntregaAlmacen > 0)
|
||||
@@ -679,18 +681,20 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
if (ObjGenerales.GetEntregaAlmacenRutaDetalle(CveEntregaAlmacen))
|
||||
{
|
||||
GvModalPSRecoleccion.DataSource = ObjGenerales.DtResultados;
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
GvModalPSRecoleccion.DataSource = null;
|
||||
}
|
||||
}
|
||||
ObjGenerales.Dispose();
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
GvModalPSRecoleccion.DataSource = DTRecoleccion;
|
||||
}
|
||||
GvModalPSRecoleccion.DataBind();
|
||||
UpModalRecoleccion.Update();
|
||||
}
|
||||
}
|
||||
protected void DdlModalRecoleccionCliente_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
ModalRecoleccionCargaDirecciones();
|
||||
@@ -698,14 +702,14 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
|
||||
private void ModalRecoleccionCargaDirecciones()
|
||||
{
|
||||
if(DdlModalRecoleccionCliente.SelectedValue.ToEntero() > 0)
|
||||
if (DdlModalRecoleccionCliente.SelectedValue.ToEntero() > 0)
|
||||
{
|
||||
ClsClientes ObjClientes = new ClsClientes();
|
||||
if (ObjClientes.DireccionEnvioGet(-1, DdlModalRecoleccionCliente.SelectedValue.ToEntero(), -1))
|
||||
{
|
||||
DdlmodalRecoleccionDireccion.DataSource = ObjClientes.DtResultados.FiltraParametros("CveSubProyecto = " + DdlSubProyectoRecoleccion.SelectedValue.ToEntero());
|
||||
}
|
||||
ObjClientes.Dispose();
|
||||
ObjClientes.Dispose();
|
||||
}
|
||||
|
||||
DdlmodalRecoleccionDireccion.DataBind();
|
||||
@@ -713,11 +717,11 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
|
||||
UpModalRecoleccion.Update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void LnkAgregarRecoleccion_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
LtlModalRecoleccionTitulo.Text = "Agregar Recolección";
|
||||
BtnModalRecoleccionGuardar.Text = "Agregar";
|
||||
|
||||
@@ -772,7 +776,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
DdlmodalRecoleccionDireccion.SelectedValueExist(-1);
|
||||
TxtModalRecoleccionCantidad.Text = "";
|
||||
DdlModalRecoleccionUnidad.Items.Clear();
|
||||
DdlModalRecoleccionUnidad.Items.Add(new ListItem("Seleccione una","-1"));
|
||||
DdlModalRecoleccionUnidad.Items.Add(new ListItem("Seleccione una", "-1"));
|
||||
DdlProducto2.txtValue.Value = "";
|
||||
DdlProducto2.txtText.Value = "";
|
||||
|
||||
@@ -799,48 +803,48 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
|
||||
protected void BtnModalRecoleccionGuardar_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (DdlmodalRecoleccionDireccion.SelectedValue.ToEntero() <= 0)
|
||||
{
|
||||
Alert("Debe seleccionar la dirección de recolección", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool ProcesoOK = false;
|
||||
bool ProcesoOK = false;
|
||||
|
||||
ClsGenerales ObjGenerales = new ClsGenerales();
|
||||
ObjGenerales.IniciaTransacSQL();
|
||||
|
||||
if( CveEntregaAlmacen == -1)
|
||||
|
||||
if (CveEntregaAlmacen == -1)
|
||||
{
|
||||
DateTime fechallegada = (TxtFechaEntrega.Text + " 23:59").ToDate();
|
||||
CveEntregaAlmacen = ObjGenerales.AddInvEntregaAlmacenRuta(DdlSubProyectoRecoleccion.SelectedValue.ToEntero(), DdlmodalRecoleccionDireccion.SelectedValue.ToEntero(), -1,-1, DdlChoferRec.SelectedValue.ToEntero(), DdlUnidadRec.SelectedValue.ToEntero(), TxtFechaEntrega.Text.ToDate(), fechallegada, "R",TxtFolioReferencia.Text, TxtReferencia.Text, TxtFechaLimite.Text.ToDate(), 1,0,1) ;
|
||||
CveEntregaAlmacen = ObjGenerales.AddInvEntregaAlmacenRuta(DdlSubProyectoRecoleccion.SelectedValue.ToEntero(), DdlmodalRecoleccionDireccion.SelectedValue.ToEntero(), -1, -1, DdlChoferRec.SelectedValue.ToEntero(), DdlUnidadRec.SelectedValue.ToEntero(), TxtFechaEntrega.Text.ToDate(), fechallegada, "R", TxtFolioReferencia.Text, TxtReferencia.Text, TxtFechaLimite.Text.ToDate(), 1, 0, 1);
|
||||
if (CveEntregaAlmacen > 0)
|
||||
{
|
||||
//CveTimbrenuevo = ObjGenerales.AddGralTimbre("Rec", "-1", -1, "-1", TxtFechaEntrega.Text.ToDate(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, -1, ChkEmitirCartaPorte.Checked, CveEntregaAlmacen, -1);
|
||||
|
||||
//if (CveTimbrenuevo > 0)
|
||||
//{
|
||||
foreach (DataRow dRow in DTRecoleccion.Rows)
|
||||
foreach (DataRow dRow in DTRecoleccion.Rows)
|
||||
{
|
||||
if (ObjGenerales.AddEntregaAlmacenRutaDetalle(CveEntregaAlmacen, dRow["CvePS"].ToString().ToEntero(), dRow["Cantidad"].ToString().ToDecimal(), dRow["CveUnidadMedida"].ToString().ToEntero(), UsuarioActual.CveUsuario))
|
||||
{
|
||||
if(ObjGenerales.AddEntregaAlmacenRutaDetalle(CveEntregaAlmacen,dRow["CvePS"].ToString().ToEntero(), dRow["Cantidad"].ToString().ToDecimal(),dRow["CveUnidadMedida"].ToString().ToEntero(), UsuarioActual.CveUsuario))
|
||||
{
|
||||
ProcesoOK = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcesoOK = false;
|
||||
break;
|
||||
}
|
||||
ProcesoOK = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcesoOK = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcesoOK = ObjGenerales.UpdateInvEntregaAlmacenRuta(CveEntregaAlmacen, DdlmodalRecoleccionDireccion.SelectedValue.ToEntero(), -1, DdlChofer.SelectedValue.ToEntero(), DdlUnidadCamion.SelectedValue.ToEntero(), TxtFechaEntrega.Text.ToDate(), UsuarioActual.CveEmpresa);
|
||||
}
|
||||
}
|
||||
|
||||
if (ProcesoOK)
|
||||
{
|
||||
@@ -849,11 +853,11 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
RegistraScript("$('#DivModalRecoleccion').modal('hide');");
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
ObjGenerales.RollBack();
|
||||
Alert("Ocurrió un error.",ModExtensiones.TipoMensaje.MsgError);
|
||||
Alert("Ocurrió un error.", ModExtensiones.TipoMensaje.MsgError);
|
||||
}
|
||||
|
||||
|
||||
ObjGenerales.Dispose();
|
||||
CargaDatosRecoleccion();
|
||||
}
|
||||
@@ -882,7 +886,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
GridViewRow GvRow = (GridViewRow)LnkEliminar.NamingContainer;
|
||||
|
||||
if (CveEntregaAlmacen > 0)
|
||||
{
|
||||
{
|
||||
|
||||
int CveEntregaAlmacenDetalleEliminar = GvRow.DataKey("CveEntregaAlmacenDetalle").ToEntero();
|
||||
ClsGenerales ObjGenerales = new ClsGenerales();
|
||||
@@ -899,17 +903,17 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
DTRecoleccion.Rows[DTIndex].Delete();
|
||||
DTRecoleccion.AcceptChanges();
|
||||
|
||||
}
|
||||
}
|
||||
CargaDatosRecoleccionDetallePS();
|
||||
}
|
||||
|
||||
protected void LnkModalAgregarPS_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(CveEntregaAlmacen > 0)
|
||||
if (CveEntregaAlmacen > 0)
|
||||
{
|
||||
ClsGenerales ObjGenerales = new ClsGenerales();
|
||||
|
||||
if(ObjGenerales.AddEntregaAlmacenRutaDetalle(CveEntregaAlmacen,DdlProducto2.SelectedValue.ToEntero(), TxtModalRecoleccionCantidad.Text.ToEntero(), DdlModalRecoleccionUnidad.SelectedValue.ToEntero(), UsuarioActual.CveUsuario))
|
||||
if (ObjGenerales.AddEntregaAlmacenRutaDetalle(CveEntregaAlmacen, DdlProducto2.SelectedValue.ToEntero(), TxtModalRecoleccionCantidad.Text.ToEntero(), DdlModalRecoleccionUnidad.SelectedValue.ToEntero(), UsuarioActual.CveUsuario))
|
||||
{
|
||||
|
||||
}
|
||||
@@ -917,17 +921,17 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
}
|
||||
else
|
||||
{
|
||||
DataRow dRow = DTRecoleccion.NewRow() ;
|
||||
DataRow dRow = DTRecoleccion.NewRow();
|
||||
|
||||
dRow["CveEntregaAlmacenDetalle"] = -1;
|
||||
dRow["CveEntregaAlmacen"] = CveEntregaAlmacen;
|
||||
dRow["CvePS"] = DdlProducto2.SelectedValue.ToEntero();
|
||||
dRow["Cantidad"] =TxtModalRecoleccionCantidad.Text.ToEntero();
|
||||
dRow["Cantidad"] = TxtModalRecoleccionCantidad.Text.ToEntero();
|
||||
dRow["CveUnidadMedida"] = DdlModalRecoleccionUnidad.SelectedValue.ToEntero();
|
||||
dRow["CveUsuario"] =UsuarioActual.CveUsuario;
|
||||
dRow["CveUsuario"] = UsuarioActual.CveUsuario;
|
||||
dRow["FechaIng"] = DateTime.Now;
|
||||
dRow["CodigoPS"] = DdlProducto2.txtText.Value;
|
||||
dRow["Abreviatura"] =DdlModalRecoleccionUnidad.SelectedItem.Text;
|
||||
dRow["Abreviatura"] = DdlModalRecoleccionUnidad.SelectedItem.Text;
|
||||
|
||||
DTRecoleccion.Rows.Add(dRow);
|
||||
//GvModalPSRecoleccion.DataSource = DTRecoleccion;
|
||||
@@ -935,8 +939,8 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
|
||||
LimpiarControlesPS();
|
||||
CargaDatosRecoleccionDetallePS();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
private void LimpiarControlesPS()
|
||||
{
|
||||
TxtModalRecoleccionCantidad.Text = "";
|
||||
@@ -945,10 +949,10 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
DdlProducto2.txtValue.Value = "";
|
||||
UpModalRecoleccion.Update();
|
||||
}
|
||||
|
||||
|
||||
protected void Tab_ActiveTabChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(Tab.ActiveTabIndex == 0)
|
||||
if (Tab.ActiveTabIndex == 0)
|
||||
{
|
||||
SeleccionEntrega = false;
|
||||
SeleccionarGenerar(1);
|
||||
@@ -958,7 +962,7 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
OcultarmostarDatosEntrega(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void CargaModalCombosDirecciones(int CveCliente, int CveDireccionEnvio)
|
||||
{
|
||||
@@ -989,10 +993,10 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
int CveDireccion = GvRow.DataKey("CveDireccionEnvio").ToEntero();
|
||||
|
||||
HdnCveVenta.Value = GvRow.DataKey("CveVenta");
|
||||
CargaModalCombosDirecciones(CveCliente, CveDireccion);
|
||||
CargaModalCombosDirecciones(CveCliente, CveDireccion);
|
||||
|
||||
UpModalEditarentrega.Update();
|
||||
this.RegistraScript("$('#DivEditarEntrega').modal('show');");
|
||||
this.RegistraScript("$('#DivEditarEntrega').modal('show');");
|
||||
}
|
||||
|
||||
protected void BtnModalEditarentrega_Click(object sender, EventArgs e)
|
||||
@@ -1010,12 +1014,12 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
if (ProcesoOK)
|
||||
{
|
||||
this.RegistraScript("$('#DivEditarEntrega').modal('hide');");
|
||||
Alert("Dirección Actualizada correctamente.",ModExtensiones.TipoMensaje.ToastInformacion);
|
||||
Alert("Dirección Actualizada correctamente.", ModExtensiones.TipoMensaje.ToastInformacion);
|
||||
CargaDatos();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void gvR_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
@@ -1027,13 +1031,13 @@ public partial class Inventarios_EntregaAlmacenRuta : ClsPaginas
|
||||
{
|
||||
LnkEditar.Visible = true;
|
||||
LnkEliminar.Visible = true;
|
||||
|
||||
|
||||
}
|
||||
if (e.Row.DataKey("CveTimbre") != "")
|
||||
{
|
||||
e.Row.FCCheckBox("Chk").Visible = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user