diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index c693d37a3..51f446d2f 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -3036,7 +3036,7 @@ Public Class ClsGenerales Return Retorno End Function - Public Function AsignarEntregasPorRealizar(CvePaqueteriaGuia As Integer, CvePersonal As Integer, Optional CveAsignacionEntrega As Long = -1, Optional CveMotivoRechazoPaqueteria As Integer = -1) As Boolean + Public Function AsignarEntregasPorRealizar(CvePaqueteriaGuia As Integer, CvePersonal As Integer, Optional CveAsignacionEntrega As Long = -1, Optional CveMotivoRechazoPaqueteria As Integer = -1, Optional Orden As Integer = 0) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Gral_AsignarEntregasPorRealizar") With SqlAdapter.SelectCommand.Parameters @@ -3044,6 +3044,7 @@ Public Class ClsGenerales .Add("@CveUsuarioAsignado", SqlDbType.Int).Value = CvePersonal .Add("@CveAsignacionEntrega", SqlDbType.BigInt).Value = CveAsignacionEntrega .Add("@CveMotivoRechazoPaqueteria", SqlDbType.Int).Value = CveMotivoRechazoPaqueteria + .Add("@Orden", SqlDbType.Int).Value = Orden End With Try SqlAdapter.Fill(Data) @@ -3598,5 +3599,137 @@ Public Class ClsGenerales Return Retorno End Function #End Region + + + + +#Region "GRAL TIMBRES" + + + Public Function GralTimbreAdd(TipoDocto As Integer, Serie As String, Folio As Integer, FolioFiscal As String, Fecha As Date, CveVenta 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) As Integer + Dim Retorno As Integer = -1 + DataAdapter("PA_Gral_TimbreAdd") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + .Add("@Serie", SqlDbType.VarChar).Value = Serie + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@FolioFiscal", SqlDbType.VarChar).Value = FolioFiscal + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .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("@CveSubProyectoOrigen", SqlDbType.Int).Value = CveSubProyectoOrigen + .Add("@CveDireccionOrigen", SqlDbType.Int).Value = CveDireccionOrigen + .Add("@CveDireccionDestino", SqlDbType.Int).Value = CveDireccionDestino + .Add("@CveTimbre", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@CveTimbre").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error al agregar el timbre", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + Public Function GralTimbreGet(CveTimbre As Integer, TipoDocto As String, Serie As String, Folio As Integer, FechaI As Date, FechaF As Date, Estatus As Integer, CveEmpresa As Integer, CveVenta As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Gral_TimbreGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTimbre", SqlDbType.Int).Value = CveTimbre + .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + .Add("@Serie", SqlDbType.VarChar).Value = Serie + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + + + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los timbres.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GralTimbreUpdate(CveTimbre As Integer, TipoDocto As Integer, Serie As String, Folio As Integer, FolioFiscal As String, Fecha As Date, CveVenta 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) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Gral_TimbreUpdate") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveTimbre", SqlDbType.Int).Value = CveTimbre + .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + .Add("@Serie", SqlDbType.VarChar).Value = Serie + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@FolioFiscal", SqlDbType.VarChar).Value = FolioFiscal + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .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 + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el timbre", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + + + Public Function GralTimbreRemove(CveTimbre As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Gral_TimbreRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveTimbre", SqlDbType.Int).Value = CveTimbre + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar Timbre", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + +#End Region + End Class diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index e304c226a..5d3ac2f06 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -670,8 +670,10 @@ Partial Class PopUpVerFactura #Region "OP = 'CONG' - IMPRIME GASTO DE CONTRATO" Private Sub ImprimeGastoContrato(CveContrato As Integer, CveContratoGasto As Integer) + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + Dim Dr As DataRow = Nothing Dim ObjContratos As New ClsContratos If Not ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Or Not ObjContratos.DtResultados.Rows.Count > 0 Then @@ -841,12 +843,19 @@ Partial Class PopUpVerFactura If Dt.Rows.Count > 0 Then Dim params As New List(Of ReportParameter) Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + + params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, ImageToBase64(Drawing.Image.FromFile(Imagen.FullName), Drawing.Imaging.ImageFormat.Png), ""))) + + 'If Imagen.Exists Then + ' params.Add(New ReportParameter("LogoPath", logouri)) + + + 'Else + ' params.Add(New ReportParameter("LogoPath", "")) + 'End If + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) diff --git a/Empresas/Grales/Formatos/CartaPorte.rdlc b/Empresas/Grales/Formatos/CartaPorte.rdlc index 2db90a3aa..2b3df4e00 100644 --- a/Empresas/Grales/Formatos/CartaPorte.rdlc +++ b/Empresas/Grales/Formatos/CartaPorte.rdlc @@ -255,6 +255,9 @@ + + + 2pt 2pt 2pt @@ -381,7 +384,7 @@ true true DataSet1 - 5.46866cm + 4.51616cm 0.21008cm 1.14708cm 19.11272cm @@ -389,6 +392,9 @@ + + + @@ -803,400 +809,6 @@ 2pt - - - - - - - - true - true - - - - - DESIGNACIÓN Y/O DESCRIPCIÓN DE LAS MERCANCIAS A TRANSPORTAR - - - - - - - Textbox28 - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - 3.00921cm - - - 3.29899cm - - - 2.03729cm - - - - - 0.6cm - - - - - true - true - - - - - - - - - - - - UM - - 2pt - - - - - - Black - 1pt - - - Black - 1pt - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Textbox31 - - 5pt - - - Black - - 1pt - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Textbox65 - - 5pt - - - Black - - 1pt - - - Black - - 1pt - - - Black - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - 0.52062cm - - - true - true - - - - - PESO - - - - - - - Textbox40 - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.52062cm - - - true - true - - - - - METROS CUBICOS - - - - - - - Textbox30 - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.52062cm - - - true - true - - - - - LITROS - - - - - - - Textbox64 - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - 10.863cm - - - true - true - - - - - =Fields!CodigoPS.Value - - - - - - - Cantidad - - 2pt - - - - - - Black - 1pt - - - Black - 1pt - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - DataSet1 - 4.17165cm - 0.21008cm - 1.12062cm - 19.20849cm - 10 - - - - true true @@ -1215,11 +827,11 @@ Textbox1 - 7.62994cm + 6.99494cm 0.20001cm 0.62599cm 19.21855cm - 11 + 10 @@ -1268,11 +880,11 @@ Textbox1 - 8.25593cm + 7.62093cm 0.20001cm 1.50794cm 19.21855cm - 12 + 11 @@ -1332,11 +944,11 @@ Textbox21 - 13.69816cm + 14.33316cm 2.20199cm 1.2cm 5.78664cm - 13 + 12 @@ -1367,11 +979,11 @@ Textbox22 - 12.0345cm + 12.6695cm 2.20199cm 0.6cm 5.78664cm - 14 + 13 @@ -1415,11 +1027,11 @@ Textbox21 - 13.69816cm + 14.33316cm 11.59464cm 1.2cm 5.78664cm - 15 + 14 @@ -1450,11 +1062,11 @@ Textbox22 - 12.0345cm + 12.6695cm 11.59464cm 0.6cm 5.78664cm - 16 + 15 @@ -1485,11 +1097,11 @@ Textbox22 - 13.3339cm + 13.9689cm 2.20199cm 0.52062cm 5.78664cm - 17 + 16 @@ -1520,11 +1132,11 @@ Textbox22 - 13.3339cm + 13.9689cm 11.59464cm 0.52062cm 5.78664cm - 18 + 17 @@ -1640,7 +1252,7 @@ 0.23022cm 2.22232cm 19.21855cm - 19 + 18 @@ -1683,7 +1295,7 @@ 0.23022cm 0.62599cm 19.21855cm - 20 + 19 @@ -1703,169 +1315,139 @@ 2pt - - - - - 5.06862cm - - - 3.10917cm - - - 10.93493cm - - - - - 0.6cm - - - - - true - true - - - - - CHOFER: - - - - =Parameters!ResponsableRecibio.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - PLACA: - - - - =Parameters!Placa.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - ESPECIFICACION DE LA UNIDAD: - - - - =Parameters!EspecifUnidad.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - - - - - - - - - - - - - - 6.75685cm - 0.21008cm - 0.6cm - 19.11272cm - 21 + + + + true + true + + + + + CHOFER: + + + + =Parameters!ResponsableRecibio.Value + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + PLACA: + + + + =Parameters!Placa.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ESPECIFICACION DE LA UNIDAD: + + + + =Parameters!EspecifUnidad.Value + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + 5.91399cm + 0.23022cm + 0.83216cm + 19.09258cm + 20 - + 8.91698in - External - =Parameters!LogoPath.Value + Database + =System.Convert.FromBase64String(Parameters!LogoPath.Value ) + image/png FitProportional 0.46171in 1.23522in @@ -2039,7 +1622,7 @@ - CARTA DE PORTE TRASLADO + TRASLADO - Textbox1 @@ -2116,7 +1701,7 @@ true - 0.03526cm + 0.03525cm 0.22015cm 0cm 19.22862cm @@ -2146,7 +1731,7 @@ Textbox13 - 0.14109cm + 0.14108cm 0.22015cm 0.54708cm 1.55632cm @@ -2180,7 +1765,7 @@ Textbox14 - 0.14109cm + 0.14108cm 1.77647cm 0.54708cm 4.96223cm @@ -2215,7 +1800,7 @@ Textbox13 - 0.14109cm + 0.14108cm 6.84454cm 0.54708cm 2.84562cm @@ -2250,7 +1835,7 @@ Textbox14 - 0.14109cm + 0.14108cm 9.69015cm 0.54708cm 4.68641cm @@ -2284,7 +1869,7 @@ Textbox14 - 0.17637cm + 0.17636cm 14.62633cm 0.54708cm 4.8023cm @@ -2316,7 +1901,7 @@ Textbox14 - 0.68817cm + 0.68816cm 0.22015cm 0.54708cm 6.21751cm diff --git a/Inventarios/EntregasPorRealizar.aspx b/Inventarios/EntregasPorRealizar.aspx index 3bf84154d..f2bfca7df 100644 --- a/Inventarios/EntregasPorRealizar.aspx +++ b/Inventarios/EntregasPorRealizar.aspx @@ -41,12 +41,12 @@
- +
-
PERSONAL QUE ENTREGA:
+
Personal de Entrega:
@@ -56,6 +56,31 @@
+ + + + + + +
+
+ +
+ +
+ <%----%> +
+ +
+ Generar Documentos +
+ +
+ +
+
+ + @@ -67,50 +92,170 @@
-
+
- - - - -   - - - - - -   - - - - - -   - - - - -   - - - - -   - - - - + +
+
+ + + + + + +   + + + + + +   + + + + + + +   + + + + +   + + + + +   + + + + + + + + + +
+ +
+ + + +
+
+ + + + + <%----%> + + +   + + + + + + <%----%> + + + + + + + + + + + +   + + + + + + +   + + + + +   + + + + +   + + + + + + + + + + + +
+ +
+ + + + +
+ + + diff --git a/Inventarios/EntregasPorRealizar.aspx.cs b/Inventarios/EntregasPorRealizar.aspx.cs index c9a6442da..44a8d193e 100644 --- a/Inventarios/EntregasPorRealizar.aspx.cs +++ b/Inventarios/EntregasPorRealizar.aspx.cs @@ -11,24 +11,83 @@ using System.Text; public partial class Inventarios_EntregasPorRealizar : 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) { + SelecionEntrega = true; CargarEntregas(); CargarPersonal(); } } - protected void BtnAsignar_Click(object sender,EventArgs e) + protected void BtnAsignar_Click(object sender, EventArgs e) { + + ActualizaOrdenDTGenrarDocumentos(); + + if (DdlUsuario.SelectedValue.ToEntero() > 0) { bool TieneError = false; ClsGenerales ObjGeneral = new ClsGenerales(); ObjGeneral.IniciaTransacSQL(); - GridViewRowCollection Grid = GvPaqueteriasGuias.Rows; + + GridViewRowCollection Grid = GvGenerarDocumentos.Rows; int CvePersonal = DdlUsuario.SelectedValue.ToEntero(); long CveAsignacionEntrega = DateTime.Now.Ticks; @@ -37,66 +96,68 @@ public partial class Inventarios_EntregasPorRealizar : ClsPaginas string LigaPopUpVerFactura = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", ModExtensiones.Encripta(String.Format("OP=ENTREGAS&CVEASIGNACIONENTREGA={0}&USUARIOENTREGA={1}", CveAsignacionEntrega, Usuario))); foreach (GridViewRow row in Grid) { - if (row.FCCheckBox("ChkAsigna").Checked) + int CvePaqueteriasGuias = row.DataKey("CvePaqueteriaGuia").ToEntero(); + int Orden = row.DataKey("Orden").ToEntero(); + + if (!ObjGeneral.AsignarEntregasPorRealizar(CvePaqueteriasGuias, CvePersonal:CvePersonal, CveAsignacionEntrega: CveAsignacionEntrega, Orden: Orden)) { - int CvePaqueteriasGuias = row.DataKey("CvePaqueteriaGuia").ToEntero(); - - if(!ObjGeneral.AsignarEntregasPorRealizar(CvePaqueteriasGuias, CvePersonal, CveAsignacionEntrega)){ - TieneError = true; - }else - { - try - { - MandarNotificacionCorreo(row); - } - catch (Exception ex) - { - TieneError = true; - ModExtensiones.GuardaLog(ex.Message); - } - //string CobranzaCorreo = row.DataKey("CobranzaCorreo"); - //string CorreoEntregaAlmacen = row.DataKey("CorreoEntregaAlmacen"); - //string CorreoEntregaCompras = row.DataKey("CorreoEntregaCompras"); - //string CorreoVendedor = row.DataKey("Correo"); - //string CorreoAdicionalNotificacionesVendedor = row.DataKey("CorreoAdicionalNotificaciones"); - - //string CorreosCC = string.Format("{0};{1};{2};{3}", CorreoVendedor, CorreoAdicionalNotificacionesVendedor, CobranzaCorreo, CorreoEntregaCompras); - //string LogCorreo = string.Format("{0} -- {1} --- {2}", "Tipo de entrega", CorreoEntregaAlmacen, CorreosCC); - //LogCorreo.GuardaLog(); - - //ClsSisMail MailCls = new ClsSisMail(); - //MailCls.SendMail(ClsPaginas.EmpresaNotificaciones, CorreoVendedor, "Se enviara la compra a su dirección", "Pendiente", CorreosCC); - //MailCls = null; - } + TieneError = true; + break; } + } - + + if (!TieneError) { - ObjGeneral.Commit(); - Alert(String.Format("Entregas asignadas correctamente

Imprimir Reporte de Entregas Asignadas", LigaPopUpVerFactura)); - CargarEntregas(); - UpDatos.Update(); + + foreach (GridViewRow row in Grid) + { + try + { + MandarNotificacionCorreo(row); + } + catch (Exception ex) + { + TieneError = true; + ModExtensiones.GuardaLog(ex.Message); + } + + + } + + if (!TieneError) + { + ObjGeneral.Commit(); + Alert(String.Format("Entregas asignadas correctamente

Imprimir Reporte de Entregas Asignadas", LigaPopUpVerFactura)); + + SelecionEntrega = false; + SeleccioanrGenrar(); + + CargarEntregas(); + UpDatos.Update(); + } + else + { + ObjGeneral.RollBack(); + } + ObjGeneral.Dispose(); } else { - ObjGeneral.RollBack(); + Alert("Seleccione a alguien del personal", ModExtensiones.TipoMensaje.MsgAdvertencia); } - ObjGeneral.Dispose(); - } - else - { - Alert("Seleccione a alguien del personal",ModExtensiones.TipoMensaje.MsgAdvertencia); } } - private void CargarEntregas() { ClsGenerales ObjGeneral = new ClsGenerales(); if (ObjGeneral.GetEntregasPorRealizar(UsuarioActual.CveEmpresa)) { GvPaqueteriasGuias.DataSource = ObjGeneral.DtResultados; - + DTDatosConsulta = ObjGeneral.DtResultados; + DTGenrarDocumentos = ObjGeneral.DtResultados.Clone(); + } ObjGeneral.Dispose(); GvPaqueteriasGuias.DataBind(); @@ -227,4 +288,137 @@ public partial class Inventarios_EntregasPorRealizar : ClsPaginas MailCls.SendMail(ClsPaginas.EmpresaNotificaciones, Para, "Entrega en camino", body, Para); MailCls = null; } + + + + protected void LnkGenerarDocumentos_Click(object sender, EventArgs e) + { + SeleccioanrGenrar(); + } + + + private void SeleccioanrGenrar() { + + if (SelecionEntrega) + { + + + if (DdlUsuario.SelectedValue.ToEntero() <= 0) + { + Alert("Debe seleccionar entregas", ModExtensiones.TipoMensaje.MsgAdvertencia); + return; + } + + DTGenrarDocumentos.Rows.Clear(); + + + + int CountRows = 0; + foreach (GridViewRow GvRow in GvPaqueteriasGuias.Rows) + { + + CheckBox ChkAsigna = GvRow.FCCheckBox("ChkAsigna"); + + if (ChkAsigna.Checked) + { + + int CvePaqueteriaGuia = GvRow.DataKey("CvePaqueteriaGuia").ToEntero(); + + DataRow dRow = DTGenrarDocumentos.NewRow(); + DataRow dRowOrigen = DTDatosConsulta.FiltraParametros($"CvePaqueteriaGuia = {CvePaqueteriaGuia}").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 = true; + 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; + + UpDatos.Update(); + UpFiltro.Update(); + } + else + { + + SelecionEntrega = true; + LnkGenerarDocumentos.Text = "Generar Documentos"; + BtnAsignar.Visible = true; + DVGvGenerarDocumentos.Visible = false; + DVGvPaqueteriasGuias.Visible = true; + UpDatos.Update(); + UpFiltro.Update(); + + } + + + } + + + + protected void GvGenerarDocumentos_RowDataBound(object sender, GridViewRowEventArgs e) + { + if(e.Row.RowType == DataControlRowType.DataRow) + { + // e.Row.CssClass = $"{e.Row.CssClass} RowOrdenamiento"; + // e.Row.Attributes.Add("onmouseup ", "alert('boton liberado')"); + + } + } + + private void ActualizaOrdenDTGenrarDocumentos() + { + string[] OrdenCvePaqueteriaGuia = Request.Form.GetValues("OrdenCvePaqueteriaGuia"); + + int NumOrden = 1; + foreach (string CvePaqueteriaGuia in OrdenCvePaqueteriaGuia) + { + foreach(DataRow dRow in DTGenrarDocumentos.Rows) + { + if (CvePaqueteriaGuia.ToEntero() == dRow["CvePaqueteriaGuia"].ToString().ToEntero() ) + { + dRow["Orden"] = NumOrden; + } + } + DTGenrarDocumentos.AcceptChanges(); + NumOrden++; + } + + GvGenerarDocumentos.DataSource = DTGenrarDocumentos; + GvGenerarDocumentos.DataBind(); + UpDatos.Update(); + + + + } } \ No newline at end of file