diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index a8718027c..ca2e96e95 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -278,7 +278,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState 'verifica existencias - If Pagina.Contiene("ventas/ventas", "oc/oc", "inv/traspaso") AndAlso CveEmpresa.Contiene(72, 80, 119, 140) Then + If Pagina.Contiene("ventas/ventas", "oc/oc", "inv/traspaso") AndAlso CveEmpresa.Contiene(72, 80, 119, 140, 141) Then UsaGlobal = False Dim objInv As New ClsInventarios diff --git a/CGame/Fletes.aspx.cs b/CGame/Fletes.aspx.cs index ba53371fe..6020f8e17 100644 --- a/CGame/Fletes.aspx.cs +++ b/CGame/Fletes.aspx.cs @@ -991,6 +991,7 @@ public partial class CGame_Fletes : ClsPaginas } catch (Exception ex) { + Alert(ex.ToString(), TipoMensaje.MsgError); } } } diff --git a/CGame/GenerarOrdenCorte.aspx.cs b/CGame/GenerarOrdenCorte.aspx.cs index f39397370..c7eb97a4b 100644 --- a/CGame/GenerarOrdenCorte.aspx.cs +++ b/CGame/GenerarOrdenCorte.aspx.cs @@ -447,7 +447,7 @@ public partial class CGame_GenerarOrdenCorte : ClsPaginas } catch (Exception ex) { - + Alert("Ocurrio un error " + ex); throw; } } diff --git a/Inventarios/RepTraspasoEmitido.aspx b/Inventarios/RepTraspasoEmitido.aspx new file mode 100644 index 000000000..954680e3e --- /dev/null +++ b/Inventarios/RepTraspasoEmitido.aspx @@ -0,0 +1,110 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepTraspasoEmitido.aspx.cs" Inherits="Inventarios_RepTraspasoEmitido" %> + + + + + + + Reporte de Traspasos Emitidos + + + + + + + + + + +
+
+
+ + +
+
+
+ +
+ + +
+ +
+
+ + + + +
+ + + + + + +
+ +
+
+ + + + +
+ + + + + + +
+
+
+
+
+
+ +
+ + + + + +
+
+
+
+
+
+ + +
+ " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
+ + + + + + + + + + + + + + + + + +
+
+
+ + + diff --git a/Inventarios/RepTraspasoEmitido.aspx.cs b/Inventarios/RepTraspasoEmitido.aspx.cs new file mode 100644 index 000000000..d4778d08b --- /dev/null +++ b/Inventarios/RepTraspasoEmitido.aspx.cs @@ -0,0 +1,83 @@ +using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI.WebControls; using Extensiones; using System.Data; using static Extensiones.ModExtensiones; +using Microsoft.Reporting.WebForms; + +public partial class Inventarios_RepTraspasoEmitido : ClsPaginas +{ + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + InicializaValores(); + } + } + + private void InicializaValores() + { + DdlAlmacen.DataSource = get_GlobalDTAlmacen(UsuarioActual.CveEmpresa); + DdlAlmacen.Items.Insert(0, new ListItem("Todos", "-1")); + DdlAlmacen.DataBind(); + txtFechaI.Text = DateTime.Now.FirstDayOfMonth().ToShortDateString(); + txtFechaF.Text = DateTime.Now.ToShortDateString(); + } + + protected void BtnConsultar_Click(object sender, EventArgs e) + { + CargaDatos(); + } + + private void CargaDatos() + { + ClsInventarios ObjInv = new ClsInventarios(); + if (ObjInv.GetRepTraspasosEmitidos(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero(), DdlEstatus.SelectedValue.ToEntero(), + txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate())) + { + GvDatos.DataSource = ObjInv.DtResultados; + } + ObjInv.Dispose(); + GvDatos.DataBind(); + UpDatos.Update(); + } + + protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + e.Row.Cells[6].Text = String.Format("", Encripta(String.Format("OP=DesXmlTra&CVEMOVIMIENTO={0}&EXT={1}&FOLIO={2}&TIPODOCTO={3}", e.Row.DBCampo("CveMovimiento"), "XML",$"Tra-{e.Row.DBCampo("Folio")}","Tra"))); + e.Row.Cells[7].Text = String.Format("", Encripta(String.Format("OP=DesPdfTra&CVEMOVIMIENTO={0}&EXT={1}&FOLIO={2}&TIPODOCTO={3}", e.Row.DBCampo("CveMovimiento"), "PDF", $"Tra-{e.Row.DBCampo("Folio")}", "Tra"))); + if (e.Row.DBCampo("CveEstatusTimbrado").ToEntero()==2) + { + e.Row.Cells[8].Text = ""; + } + } + } + + protected void LnkCancelarTraspaso_Click(object sender, EventArgs e) + { + GridViewRow Gvr = (GridViewRow)(((LinkButton)sender).NamingContainer); + Timbrado ObjCancelacion = new Timbrado(); + DateTime CancelacionFecha=MinFecha; + int CveEstatusTimbrado = 0; + string FolioFiscal = Gvr.DataKey("FolioFiscal").ToString(),SelloCancelacion =""; + int CveMovimiento = Gvr.DataKey("CveMovimiento").ToEntero(); + if (ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, 0, "XAXX010101000", UsuarioActual.Empresa.RFC, 2,false)) + { + CancelacionFecha = ObjCancelacion.CancelacionFecha; + SelloCancelacion = ObjCancelacion.CancelacionAcuse; + CveEstatusTimbrado = 2; + }else + { + Alert("La factura no se pudo cancelar ante el SAT", TipoMensaje.MsgError); + } + if (CveEstatusTimbrado > 0) + { + ClsInventarios ObjInv = new ClsInventarios(); + if (ObjInv.UpdateMovimientoTimbrado(CveMovimiento, CveEstatusTimbrado, FolioFiscal, CancelacionFecha, SelloCancelacion)) + { + Alert("El traspaso se cancelo correctamente.", TipoMensaje.MsgInformacion); + } + ObjInv.Dispose(); + CargaDatos(); + } + + } +} \ No newline at end of file diff --git a/Ventas/ProductosServicios.aspx b/Ventas/ProductosServicios.aspx index 38921f40b..2541f0c6d 100644 --- a/Ventas/ProductosServicios.aspx +++ b/Ventas/ProductosServicios.aspx @@ -936,46 +936,48 @@
-
- - -
-
-
-
- - Secciones de Almacen -
-
-
- -
-
+ + +
+
+
+
+ + Secciones de Almacen
-
- - - - - - - - - - - - - - - - +
+
+ +
+
+ + + + +<%-- + + + + --%> + + + + + + + +
- - -
+
+
+
+
@@ -2035,25 +2037,25 @@
+
diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 873cd7766..578d60a45 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -287,7 +287,6 @@ Partial Class ProductosyServicios CargaCombosSeccionAlmacen() DivSeccionAlmacen.Visible = UsuarioActual.Empresa.Funcionalidad(563).ToString = "1" - CreaDtSeccionAlmacen() If UsuarioActual.Empresa.UsaContabilidad Then @@ -1138,7 +1137,8 @@ Partial Class ProductosyServicios End If Dim ObjProductosServicios As New ClsProductosServicios() - ObjProductosServicios.IniciaTransacSQL() + Dim ObjInv As New ClsInventarios(ObjProductosServicios.IniciaTransacSQL()) + Dim TieneError = False Dim AccionJS = "" Dim EsPaquete As Integer = If(gvPaqueteDetalle.Rows.Count = 0, 0, 1) @@ -1175,6 +1175,18 @@ Partial Class ProductosyServicios Next 'Alert("El Producto o Servicio se guardó correctamente.", TipoMensaje.MsgInformacion, "document.location.href= "" / ProductosServicios.aspx?CvePS=" & ObjProductosServcios.CvePS.ToString & """;") AccionJS = "document.location.href=""/Ventas/CatPS.aspx"";" + + + If Not TieneError Then + For Each Dr As DataRow In DtSeccionAlmacen.Rows + If Dr("CveAlmacen").ToString.ToEntero > 0 Then + If Not ObjInv.AddProductosServiciosAlmacenSeccion(CvePS, Dr("CveAlmacen").ToString.ToEntero, Dr("CveAlmacenSeccion").ToString.ToEntero) Then + TieneError = True + End If + End If + Next + End If + Else TieneError = True Alert("Ocurrió un Error al agregar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError) @@ -1220,6 +1232,22 @@ Partial Class ProductosyServicios AccionJS = If(Ret = "Comp", "ircompras();", "document.location.href=""/Ventas/CatPS.aspx"";") 'UpDatos.Update() 'Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, AccionJS) + + If Not TieneError Then + For Each Dr As DataRow In DtSeccionAlmacen.Rows + If Dr("CveAlmacen").ToString.ToEntero > 0 AndAlso Not Dr("CvePSAlmacenSeccion").ToString.ToEntero > 0 Then + If Not ObjInv.AddProductosServiciosAlmacenSeccion(CvePS, Dr("CveAlmacen").ToString.ToEntero, Dr("CveAlmacenSeccion").ToString.ToEntero) Then + TieneError = True + End If + ElseIf Not Dr("CveAlmacen").ToString.ToEntero > 0 AndAlso Dr("CvePSAlmacenSeccion").ToString.ToEntero > 0 Then + If Not ObjInv.RemoveProductosServiciosAlmacenSeccion(Dr("CvePSAlmacenSeccion").ToString.ToEntero) Then + TieneError = True + End If + End If + Next + End If + + Else TieneError = True Alert("Ocurrió un Error al actualizar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError) @@ -2483,7 +2511,6 @@ Partial Class ProductosyServicios Private Sub CreaDtSeccionAlmacen() DtSeccionAlmacen = New DataTable DtSeccionAlmacen.Columns.Add("CvePSAlmacenSeccion", GetType(Integer)) - DtSeccionAlmacen.Columns.Add("CvePS", GetType(Integer)) DtSeccionAlmacen.Columns.Add("CveAlmacen", GetType(Integer)) DtSeccionAlmacen.Columns.Add("Almacen", GetType(String)) DtSeccionAlmacen.Columns.Add("CveAlmacenSeccion", GetType(Integer)) @@ -2502,14 +2529,15 @@ Partial Class ProductosyServicios Private Sub CargaCombosSeccionAlmacen() - DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveAlmacen) + DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa) DdlAlmacen.Items.Add(New ListItem("Seleccione", "-1")) DdlAlmacen.DataBind() - DdlSeccionAlmacen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveAlmacen) + DdlSeccionAlmacen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa) DdlSeccionAlmacen.Items.Add(New ListItem("Seleccione", "-1")) DdlSeccionAlmacen.DataBind() + UpModalSeccionAlmacen.Update() End Sub Protected Sub LnkSeccionAlmacenAdd_Click(sender As Object, e As EventArgs) @@ -2518,30 +2546,58 @@ Partial Class ProductosyServicios RegistraScript("$('#DivAddSeccionAlmacen').modal();") UpModalSeccionAlmacen.Update() End Sub - Protected Sub LnkEditarSeccionAlmacen_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - DdlAlmacen.SelectedValueExist(gvRow.DataKey("CvAlmacen")) - DdlSeccionAlmacen.SelectedValueExist(gvRow.DataKey("CveAlmacenSeccion")) - RegistraScript("$('#DivAddSeccionAlmacen').modal();") - UpModalSeccionAlmacen.Update() - End Sub + 'Protected Sub LnkEditarSeccionAlmacen_Click(sender As Object, e As EventArgs) + ' Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + ' DdlAlmacen.SelectedValueExist(gvRow.DataKey("CvAlmacen")) + ' DdlSeccionAlmacen.SelectedValueExist(gvRow.DataKey("CveAlmacenSeccion")) + ' RegistraScript("$('#DivAddSeccionAlmacen').modal();") + ' UpModalSeccionAlmacen.Update() + 'End Sub Protected Sub LnkRemoveSeccionAlmacen_Click(sender As Object, e As EventArgs) Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) If gvRow.DataKey("CvePSAlmacenSeccion").ToEntero > 0 Then - DtSeccionAlmacen.Rows(gvRow.RowIndex)("CvePS") = -1 + DtSeccionAlmacen.Rows(gvRow.RowIndex)("CveAlmacen") = -1 Else DtSeccionAlmacen.Rows(gvRow.RowIndex.ToEntero).Delete() End If DtSeccionAlmacen.AcceptChanges() GvSeccionAlmacen.DataSource = DtSeccionAlmacen GvSeccionAlmacen.DataBind() + UpSeccionAlmacen.Update() End Sub Protected Sub BtnAddSeccionAlmacen_Click(sender As Object, e As EventArgs) + If DtSeccionAlmacen.FiltraParametros($"CveAlmacen = {DdlAlmacen.SelectedValue}").Rows.Count > 0 Then + Alert("No se puede especificar el mismo almacen en dos secciones", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Dim Row As DataRow = Nothing + Row = DtSeccionAlmacen.NewRow + Row("CvePSAlmacenSeccion") = -1 + Row("CveAlmacen") = DdlAlmacen.SelectedValue.ToEntero + Row("Almacen") = DdlAlmacen.SelectedItem.Text + Row("CveAlmacenSeccion") = DdlSeccionAlmacen.SelectedValue.ToEntero + Row("AlmacenSeccion") = DdlSeccionAlmacen.SelectedItem.Text + DtSeccionAlmacen.Rows.Add(Row) + DtSeccionAlmacen.AcceptChanges() + GvSeccionAlmacen.DataSource = DtSeccionAlmacen + GvSeccionAlmacen.DataBind() + UpSeccionAlmacen.Update() + + RegistraScript("$('#DivAddSeccionAlmacen').modal('hide');") + End Sub + + Protected Sub GvSeccionAlmacen_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + If Not e.Row.DBCampo("CveAlmacen").ToEntero > 0 Then + e.Row.Visible = False + End If + End If End Sub #End Region + End Class