From 50813f526987e4bb8bc1f70e35ebe81dcbd28fde Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Oct 2021 12:38:45 -0700 Subject: [PATCH 01/17] cambio en codigo modulo --- Bancos/DepositosCaja.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index a5a1fb0a0..da29b34eb 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -206,7 +206,7 @@ Partial Class Bancos_DepositosCaja CveCuentaBancariaDestino = drDestino("IdCtaContableSIG").ToString.ToEntero End If - NuevaCvePrePoliza = ObjContabilidad.AddPrePolizas("Vta", 13, TotalImportePrePoliza, TotalImportePrePoliza, CveMoneda, Fecha, "Depósito Bancario", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=1) + NuevaCvePrePoliza = ObjContabilidad.AddPrePolizas("DepCaja", 13, TotalImportePrePoliza, TotalImportePrePoliza, CveMoneda, Fecha, "Depósito Bancario", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=1) If ChkIntermediario.Checked Then From 11eb5f753b93b60a5460b5797eef76c1a0cddf8a Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Oct 2021 12:38:53 -0700 Subject: [PATCH 02/17] mejora --- Contabilidad2/CatCuentasAsignaciones.aspx | 2 +- Contabilidad2/CatCuentasAsignaciones.aspx.vb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx b/Contabilidad2/CatCuentasAsignaciones.aspx index 3cbdd83d6..4d4a155cd 100644 --- a/Contabilidad2/CatCuentasAsignaciones.aspx +++ b/Contabilidad2/CatCuentasAsignaciones.aspx @@ -92,7 +92,7 @@
+ Style=" width:100%" GridLines="None" Caption="Globales"> diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx.vb b/Contabilidad2/CatCuentasAsignaciones.aspx.vb index 9818cb0fc..70d115657 100644 --- a/Contabilidad2/CatCuentasAsignaciones.aspx.vb +++ b/Contabilidad2/CatCuentasAsignaciones.aspx.vb @@ -236,6 +236,7 @@ Partial Class Contabilidad2_CatCuentasAsignaciones DdlPersonal.ddl.DataSource = "" DdlPersonal.ddl.DataBind() DdlPersonal.setEsWebService(True) + HdnCveCuentaAsignacion.Value = "" End Sub Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click From 7b9d77581dd4a3c97924ebb51882cafb802c6f5a Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Oct 2021 12:39:06 -0700 Subject: [PATCH 03/17] -- fecha en carga balanza --- General/SaldosIniciales.aspx.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 4d9c3b474..80285172c 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -11,7 +11,7 @@ Partial Class General_SaldosIniciales Inherits ClsPaginas Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then - + TxtFecha.Text = Now.ToShortDateString End If End Sub @@ -1695,7 +1695,7 @@ Partial Class General_SaldosIniciales Dim Cuenta As String = "" Dim Reporte As New StringBuilder Dim SubProTemp As DataTable = GlobalDTSubProyectos(-1, -1, CveEmpresa:=UsuarioActual.CveEmpresa) - CvePrePoliza = ObjConta.AddPrePolizas("SI", 1, 0, 0, 1, Now.ToDate, "Saldos Iniciales", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + CvePrePoliza = ObjConta.AddPrePolizas("SI", 1, 0, 0, 1, TxtFecha.Text.ToDate, "Saldos Iniciales", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) For Each Row As DataRow In dt.Rows NombreCuenta = Row("NombreCuenta").ToString From b6fc2845ca58bffd58e3f55c2c17ad1a25d0bf6e Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Oct 2021 12:39:28 -0700 Subject: [PATCH 04/17] es complementaria --- Contabilidad/RegPrePolizaS.aspx | 6 +++- Contabilidad/RegPrePolizaS.aspx.vb | 48 ++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx index 63d603c39..4c6f38c09 100644 --- a/Contabilidad/RegPrePolizaS.aspx +++ b/Contabilidad/RegPrePolizaS.aspx @@ -342,7 +342,7 @@
@@ -392,6 +392,9 @@ Cargo +
ME: + TC: +
@@ -399,6 +402,7 @@ Abono +
ME:
diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index bb2f95516..c24a32347 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -334,6 +334,7 @@ Partial Class ContabilidadC_RegPrePolizaS .Add("ContadoObservaciones", Type.GetType("System.String")) .Add("PorcentajeImpuesto", Type.GetType("System.Double")) .Add("Modificado", Type.GetType("System.Boolean")) + .Add("EsComplementaria", Type.GetType("System.Boolean")) End With @@ -735,9 +736,11 @@ Partial Class ContabilidadC_RegPrePolizaS - Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero - - Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden") + Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero + + Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden") + + 'Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla, UsuarioActual.CveEmpresa) Dim Cuenta As String = "" Dim IdCuenta As Integer = 0 Dim CodigoCuenta As String = "" @@ -778,7 +781,8 @@ Partial Class ContabilidadC_RegPrePolizaS dr("CvePersonal") = drt("CvePersonal") dr("CveClasificacion") = -1 dr("MultipleSubProyecto") = drt("MultipleSubProyecto") - dr("CveCuenta") = drt("CveCuenta") + dr("CveCuenta") = drt("CveCuenta") + dr("EsComplementaria") = drt("EsComplementaria") 'dr("FolioPoliza") = 0 'drt("FolioPoliza") DtMovimientos.Rows.Add(dr) @@ -835,6 +839,12 @@ Partial Class ContabilidadC_RegPrePolizaS e.Row.FCDropDownList("DdlSubProyecto").Enabled = True End If + If e.Row.DBCampo("EsComplementaria") = "True" Then + If e.Row.DBCampo("TipoMovto") = "0" Then e.Row.FindControl("divCargoME").Visible = True + If e.Row.DBCampo("TipoMovto") = "1" Then e.Row.FindControl("divAbonoME").Visible = True + End If + + 'Agregamos la opcion para vincular los movimientos bancarios If e.Row.DataKey("CveConcepto").ToEntero.Contiene(41) Then Dim ObjMovimientos As New ClsMovimientos @@ -923,6 +933,8 @@ Partial Class ContabilidadC_RegPrePolizaS Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

" Dim idCuentaContabilizacion As Long = 1 Dim Importe As Double = 0 + Dim ImporteME As Decimal = 0 + Dim TipoCambio As Decimal = 1 Dim TipoMovto As Boolean = False Dim IdCtaContable As Integer = 0 @@ -946,17 +958,26 @@ Partial Class ContabilidadC_RegPrePolizaS 'If ObjIE.GetBancosIE(CveIE, -1, -1, "-1", -1, "-1", "-1", -1, -1, -1, -1, -1, MinFecha, MaxFecha, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then ' FolioIE = ObjIE.Folio 'End If - End If - - + End If + + ImporteME = 0 + TipoCambio = 1 If gvr.DataKey("TipoMovto").ToDouble > 0 Then Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble - TipoMovto = True - Else + TipoMovto = True + If gvr.DataKey("EsComplementaria") = "True" Then + ImporteME = gvr.FCTextBox("TxtAbonoME").Text.ToDecimal + TipoCambio = gvr.FCTextBox("TipoCambio").Text.ToDecimal + End If + Else Importe = gvr.FCTextBox("TxtCargo").Text.ToDouble TipoMovto = False - End If - + If gvr.DataKey("EsComplementaria") = "True" Then + ImporteME = gvr.FCTextBox("TxtCargoME").Text.ToDecimal + TipoCambio = gvr.FCTextBox("TxtTC").Text.ToDecimal + End If + End If + If gvr.DataKey("CveConcepto").ToEntero <> 30 Then If gvr.DataKey("CveConcepto").ToEntero = 41 Then @@ -982,7 +1003,8 @@ Partial Class ContabilidadC_RegPrePolizaS TxtFecha.Text.ToDate, IdCtaContable, -1, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CveIE:=CveIE, CveProveedor:=gvr.DataKey("CveProveedor").ToEntero, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero, - ImporteMX:=Importe, CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, + ImporteMX:=Importe, ImporteME:=ImporteME, TipoCambio:=TipoCambio, + CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCuenta:=tCveCuenta) Then Else MsgError = "No se pudo insertar el detalle de la póliza2" @@ -1951,8 +1973,10 @@ Partial Class ContabilidadC_RegPrePolizaS Dim worksheet = workbook.Worksheets.Add(NombreHoja) Dim CvePlantilla As Integer = DdlPlantilla2.SelectedValue.ToEntero + 'Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla, UsuarioActual.CveEmpresa) Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden") + Dim DtExcel As DataTable = (From row As DataRow In Dt.Rows Select New With { From b3449cf786956c4a9457172590e2be9f6870c0a2 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Oct 2021 12:40:06 -0700 Subject: [PATCH 05/17] descarga en carta porte --- Inventarios/RepTraspasoEmitido.aspx.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Inventarios/RepTraspasoEmitido.aspx.cs b/Inventarios/RepTraspasoEmitido.aspx.cs index d4778d08b..f0fd0f8df 100644 --- a/Inventarios/RepTraspasoEmitido.aspx.cs +++ b/Inventarios/RepTraspasoEmitido.aspx.cs @@ -43,7 +43,10 @@ public partial class Inventarios_RepTraspasoEmitido : ClsPaginas 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( UsuarioActual.Empresa.Funcionalidad(161) == "1") + e.Row.Cells[7].Text = String.Format("", Encripta(String.Format("OP=CARPOTIMBRE&CVEMOV={0}&EXT={1}&FOLIO={2}&TIPODOCTO={3}", e.Row.DBCampo("CveMovimiento"), "PDF", $"Tra-{e.Row.DBCampo("Folio")}", "Tra"))); + else + 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 = ""; From 971d1d1037530054275f9a57bf604c165977c84c Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Oct 2021 12:41:15 -0700 Subject: [PATCH 06/17] =?UTF-8?q?--=20sino=20existe=20el=20ie,=20no=20cons?= =?UTF-8?q?ulta=20bit=C3=A1cora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bancos/IE.aspx.vb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 6b6664e00..9fa47aee1 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -4886,6 +4886,8 @@ Partial Class Bancos_IE End Sub Private Sub CargaEventoBitacora() + If CveIE <= 0 Then Exit Sub + Dim ObjEventoBitacora As New ClsOIEventos() If ObjEventoBitacora.GetAgendaBitacora(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then 'GVEventoBitacora.DataSource = ObjEventoBitacora.DtResultados From ffc0ff71c9541115ecf315e056969dc88a43fbbc Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Oct 2021 12:41:32 -0700 Subject: [PATCH 07/17] cambio en concetpos de ajuste --- Inventarios/AjustesSeccionAlmacen.aspx.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Inventarios/AjustesSeccionAlmacen.aspx.vb b/Inventarios/AjustesSeccionAlmacen.aspx.vb index cbfd3c09c..7cd5d7c6c 100644 --- a/Inventarios/AjustesSeccionAlmacen.aspx.vb +++ b/Inventarios/AjustesSeccionAlmacen.aspx.vb @@ -86,7 +86,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen Dim Fecha As Date = DateTime.Now 'AGREGAMOS LA ENTRADA - Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacen, 3, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, + Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacen, 44, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="", Modulo:="ASA/G1") Folio = ObjInventario.Folio @@ -161,7 +161,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then Dim resultado As DataTable = ObjInventario.DtResultados - CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacen, 2, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="", CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="ASA/G1") + CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacen, 43, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="", CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="ASA/G1") Dim ind As Integer = 0 For Each Row As DataRow In resultado.Rows From 065ebb0f219afb174a6990111b2128c5fbf4baef Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Oct 2021 12:42:04 -0700 Subject: [PATCH 08/17] =?UTF-8?q?validaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inventarios/Kardex.aspx.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Inventarios/Kardex.aspx.vb b/Inventarios/Kardex.aspx.vb index 9dffa4eec..eef5d9dd9 100644 --- a/Inventarios/Kardex.aspx.vb +++ b/Inventarios/Kardex.aspx.vb @@ -207,7 +207,7 @@ Partial Class Inventarios_Kardex If CveProducto > 0 Then Dim DtTemp = CargarKardex(CveProducto) - If DtTemp IsNot Nothing Then + If DtTemp IsNot Nothing AndAlso DtTemp.Rows.Count > 0 Then Dim AplicaSeccion, AplicaLote, AplicaCaducidad, AplicaSerie As Boolean AplicaSerie = DtTemp.MAX("Serie") <> "" AplicaSeccion = DtTemp.MAX("SeccionAlmacen") <> "" @@ -223,7 +223,7 @@ Partial Class Inventarios_Kardex If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvM.Columns(11).HeaderText = UsuarioActual.Empresa.Funcionalidad(147) - Dim Drp As datarow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CveProducto).FiltroPrimero("") + Dim Drp As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CveProducto).FiltroPrimero("") Dim AuxAplicaSerie As Boolean Dim AuxAplicaCad As Boolean If Drp IsNot Nothing Then From ddd8f3ed9b8293b8bdbbc44030f14bc8d259a164 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Oct 2021 12:44:18 -0700 Subject: [PATCH 09/17] tipomensaje.msgdosbotones --- App_Code/modExtensiones.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 791107d73..6fc80096c 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -305,7 +305,7 @@ Namespace Extensiones MsgInformacion = 2 MsgConfirmacion = 3 MsgAdvertencia = 4 - MsgVentasDosBotones = 9 + MsgDosBotones = 9 ToastInformacion = 5 'succes ToastInformacionB = 6 'info @@ -355,7 +355,7 @@ Namespace Extensiones onEscape = "" headerclas = " header-blue " - Case TipoMensaje.MsgVentasDosBotones + Case TipoMensaje.MsgDosBotones Titulo = " Información" b1title = TextoConfirmacion b1clas = "green" From 52bd3dff620110259e484c0a11a66683deec3453 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Oct 2021 12:44:35 -0700 Subject: [PATCH 10/17] - --- App_Code/ClsPaginas.vb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 16a836392..57d834854 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3178,6 +3178,27 @@ Public Class ClsPaginas Application("GlobalDTContaPlantillasPolizasDetalle") = value End Set End Property + 'Property GlobalDTContaPlantillasPolizasDetalle(CvePlantillaPoliza As Integer, CveEmpresa As Integer) As DataTable + ' Get + ' Dim AppNombre As String = String.Format("GlobalDTContaPlantillasPolizas-{0}", CveEmpresa) + ' 'sino existe, recarga los datos + ' If Application(AppNombre) Is Nothing Then + ' Using ObjContabilidad As New ClsContabilidad + ' If ObjContabilidad.GetConta_PlantillasPolizasDetalle(-1, CveEmpresa) Then Application(AppNombre) = ObjContabilidad.DtResultados Else Application(AppNombre) = Nothing + ' End Using + ' End If + + ' Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CvePlantillaPoliza = {0}", CvePlantillaPoliza), "Orden", DataViewRowState.CurrentRows) + ' GlobalDTContaPlantillasPolizasDetalle = Dv.ToTable + ' Dv.Dispose() + + + ' End Get + ' Set(value As DataTable) + ' Dim AppNombre As String = String.Format("GlobalDTContaPlantillasPolizas-{0}", CveEmpresa) + ' Application(AppNombre) = value + ' End Set + 'End Property From e3f0e8824ab0b3fbc50ce1be44e08141a1592e11 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Oct 2021 12:45:37 -0700 Subject: [PATCH 11/17] validaexistencia E140 --- Ventas/Ventas.aspx.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 81667253d..0b8aaac12 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -7130,7 +7130,7 @@ Partial Class Ventas If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then 'VALIDA EXISTENCIA - If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) Then + If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153}) Then If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia) Exit Sub @@ -8822,7 +8822,7 @@ Partial Class Ventas Liga2 = $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}"";" End If - Alert(MensajeAlert.ToString(), TipoMensaje.MsgVentasDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2) + Alert(MensajeAlert.ToString(), TipoMensaje.MsgDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2) MensajeAlert.Clear() @@ -13484,7 +13484,7 @@ Partial Class Ventas Exit For End If - If CveConceptoAlmacen = 3 AndAlso UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") AndAlso Dr("EntregaDirecta").ToString().ToEntero() < 1 Then + If CveConceptoAlmacen = 3 AndAlso UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 141}) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing") AndAlso Dr("EntregaDirecta").ToString().ToEntero() < 1 Then Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, UsuarioActual.CveEmpresa, CveAlmacen, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) If Existencia < Cantidad Then OcurrioError = True @@ -16740,7 +16740,7 @@ Partial Class Ventas If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Then 'VALIDA EXISTENCIA - If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153}) Then + If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153}) Then If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia) Return False From bc5f5dd1ca6a28e22ad0d6f82170274be57eb47e Mon Sep 17 00:00:00 2001 From: rakcsle Date: Thu, 14 Oct 2021 15:20:57 -0700 Subject: [PATCH 12/17] Rep Productos por caducar --- Acarreos/CatChoferes.aspx | 39 ++++-- Acarreos/CatChoferes.aspx.vb | 1 + App_Code/ClsInventarios.vb | 3 +- Inventarios/RepProductosPorCaducar.aspx | 136 ++++++++++++++++++++- Inventarios/RepProductosPorCaducar.aspx.cs | 74 ++++++++++- 5 files changed, 237 insertions(+), 16 deletions(-) diff --git a/Acarreos/CatChoferes.aspx b/Acarreos/CatChoferes.aspx index 47982c348..af85b3f0d 100644 --- a/Acarreos/CatChoferes.aspx +++ b/Acarreos/CatChoferes.aspx @@ -6,9 +6,7 @@ @@ -19,6 +65,12 @@
  • Excel
  • + +
  • + Personalizar +
  • + + @@ -36,7 +88,7 @@
    -
    +
    @@ -73,7 +125,15 @@
    - + +
    + + + + +
    + +
    @@ -92,14 +152,30 @@
    - +
    + + + +
    + +
    +
    + + Elaboración + Caducidad + +
    + + + + @@ -109,10 +185,64 @@ + + + + + + + + +
    + + + + + + + + + + + + + + + + diff --git a/Inventarios/RepProductosPorCaducar.aspx.cs b/Inventarios/RepProductosPorCaducar.aspx.cs index d5e8b486c..8187791ce 100644 --- a/Inventarios/RepProductosPorCaducar.aspx.cs +++ b/Inventarios/RepProductosPorCaducar.aspx.cs @@ -9,6 +9,7 @@ using System.Data; using Microsoft.Reporting.WebForms; using System.Text; + public partial class Inventarios_RepProductosPorCaducar : ClsPaginas { private DataTable DTDatos @@ -30,11 +31,16 @@ public partial class Inventarios_RepProductosPorCaducar : ClsPaginas { CargaFiltros(); CargarDatos(); + CargaAlamacenes(); + } } private void CargarDatos() { + + string Cves_Alamcenes = ddlAlmacen.GetSelectedValuesM(); + DateTime FI = ModExtensiones.MinFecha; if (TxtFechaInicio.Text != "") FI = TxtFechaInicio.Text.ToDate(); @@ -44,7 +50,7 @@ public partial class Inventarios_RepProductosPorCaducar : ClsPaginas // aqui siempre se visualiza la caducidad, sin importar la condición, porque siempre se valida la caducidad ClsInventarios ObjInventarios = new ClsInventarios(); if (ObjInventarios.GetProductosCaducidad(DdlProveedor.SelectedValue.ToEntero(), FI, TxtFechaFin.Text.ToDate(), DdlSucursal.SelectedValue.ToEntero(), - DdlClasificacion.SelectedValue.ToEntero(), CvePS, 1,"1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) + DdlClasificacion.SelectedValue.ToEntero(), CvePS, 1, Cves_Alamcenes, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Opcion:DdlOpcion.SelectedValue.ToEntero())) { GvDatos.DataSource = ObjInventarios.DtResultados; DTDatos = ObjInventarios.DtResultados; @@ -60,6 +66,7 @@ public partial class Inventarios_RepProductosPorCaducar : ClsPaginas CargarSucursales(); CargarClasificaciones(); + } private void CargarFechaText() @@ -89,6 +96,9 @@ public partial class Inventarios_RepProductosPorCaducar : ClsPaginas DdlSucursal.DataSource = get_GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1); DdlSucursal.DataBind(); DdlSucursal.Items.Insert(0, new ListItem("Todas", "-1")); + + + } private void CargarClasificaciones() @@ -104,6 +114,32 @@ public partial class Inventarios_RepProductosPorCaducar : ClsPaginas DdlClasificacion.Items.Insert(0,new ListItem("Todas","-1")); } + + + + private void CargaAlamacenes(int CveSubProyectoFiltro = -1) + { + + ddlAlmacen.Items.Clear(); + + if (CveSubProyectoFiltro > 0) + { + ddlAlmacen.DataSource = get_GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros($"CveSubProyecto = {CveSubProyectoFiltro}"); + } + else + { + ddlAlmacen.DataSource = get_GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1); + } + + ddlAlmacen.DataBind(); + ddlAlmacen.Items.Insert(0, new ListItem("Todos", "-1")); + + UPFiltros.Update(); + } + + + + protected void BtnConsultar_Click(object sender, EventArgs e) { CargarDatos(); @@ -134,6 +170,11 @@ public partial class Inventarios_RepProductosPorCaducar : ClsPaginas @params.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)); @params.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)); + @params.Add(new ReportParameter("OcultaCaducidad", ChkTiempoCaducidad.Checked ? "0": "1" )); + + + + 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)); if (Imagen.Exists) @@ -148,4 +189,35 @@ public partial class Inventarios_RepProductosPorCaducar : ClsPaginas ImprimirPDF("Empresas/Grales/Formatos/RepProductosCaducidad.rdlc", DTDatos, @params, "Reporte de Productos por Caducar", formato); } + + + + + + protected void DdlSucursal_SelectedIndexChanged(object sender, EventArgs e) + { + CargaAlamacenes(DdlSucursal.SelectedValue.ToEntero()); + } + + + + protected void BtnPersonalizar_Click(object sender, EventArgs e) + { + Personaliza(); + } + + private void Personaliza() + { + if (ChkTiempoCaducidad.Checked) + { + GvDatos.Columns[5].Visible = true; + } + else + { + GvDatos.Columns[5].Visible = false; + } + CargarDatos();//Si no se recarga no se muestran los valores dela la columna de tiempo caducindad laprimera vez que pasa de oculta a mostrarse + UpDatos.Update(); + } + } \ No newline at end of file From 3b0001e5698abb81492594fad83f91cb273e32ac Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 14 Oct 2021 16:03:29 -0700 Subject: [PATCH 13/17] Aplicacion de anticipos multiples a una factura --- Ventas/Ventas.aspx.vb | 422 ++++++++++++++++++++++++------------------ 1 file changed, 245 insertions(+), 177 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 81667253d..c44945cb0 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -1337,6 +1337,15 @@ Partial Class Ventas ViewState("Adjunto") = value End Set End Property + + Private Property ListaAnticiposAplicados As List(Of MAnticipoRelacionado) + Get + Return If(IsNothing(ViewState("ListaAnticiposAplicados")), Nothing, CType(ViewState("ListaAnticiposAplicados"), List(Of MAnticipoRelacionado))) + End Get + Set(value As List(Of MAnticipoRelacionado)) + ViewState("ListaAnticiposAplicados") = value + End Set + End Property #End Region #Region "Propiedades PuntoVenta" @@ -4091,8 +4100,14 @@ Partial Class Ventas CveVenta = If(CveCotizacion > 0, CveCotizacion, CveVenta) CveVenta = If(CvePedido > 0, CvePedido, CveVenta) + Dim DtAntRelacionados As DataTable = Nothing + Dim ObjVentas As New ClsVentas() + If ObjVentas.GetVentasRelacionadas(CveVenta, UsuarioActual.CveEmpresa) Then + DtAntRelacionados = ObjVentas.DtResultados.Copy() + End If + Dim SerieFolioPadre As String If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then @@ -4527,7 +4542,17 @@ Partial Class Ventas If DbRowVenta("CveTipoRelacion").ToString().ToEntero() > 0 Then TrTipoRelacion.Visible = True DdlTiposRelacion.SelectedValueExist(DbRowVenta("CveTipoRelacion").ToString().ToEntero()) - HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString() + + 'RELACIONAR ANTICIPOS APLICADOS + If DbRowVenta("CveTipoRelacion").ToString().ToEntero() = 7 AndAlso DtAntRelacionados IsNot Nothing AndAlso DtAntRelacionados.Rows.Count > 0 Then + DdlTipoRelacionAnticipo.SelectedValueExist(7) + ListaAnticiposAplicados = New List(Of MAnticipoRelacionado)() + For Each RowAnt As DataRow In DtAntRelacionados.Rows + ListaAnticiposAplicados.Add(New MAnticipoRelacionado() With {.CveVenta = RowAnt("CveVentaRelacionada").ToString().ToEntero(), .FolioFiscal = RowAnt("FolioFiscal").ToString()}) + Next + Else + HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString() + End If End If If DbRowVenta("Saldo").ToString().ToDouble < 0.01 Then @@ -4617,6 +4642,9 @@ Partial Class Ventas TrTipoRelacion2.Visible = True LblTipoRelacion.Text = DbRowVenta("TipoRelacion").ToString() HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString() + + + End If @@ -6093,9 +6121,9 @@ Partial Class Ventas Using ObjVentas As New ClsVentas If ObjVentas.GetVentasRelacionadas(CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then 'SI LA FACTURA NO SE TIMBRO QUE VUELVA A INTENTAR FACTURAR - If LblSeTimbro.Text = "No" Then - Me.AplicaRelacionManual = True - End If + 'If LblSeTimbro.Text = "No" Then + ' Me.AplicaRelacionManual = True + 'End If For Each RowRelacionada As DataRow In ObjVentas.DtResultados.Rows Dim Row As DataRow = TmpDTFacturasRelacionadas.NewRow() @@ -8343,6 +8371,11 @@ Partial Class Ventas ' cambiar la condicion para saber si hay seleccionado If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse NCDescuento Then Try + 'LIMPIA LOS ANTICIPOS RELACIONADOS QUE YA SE APLICARON + If ListaAnticiposAplicados IsNot Nothing Then + ListaAnticiposAplicados.Clear() + End If + Dim CveVentaRelacionada As Integer = -1 If NuevaFactura = 1 Then CveVentaRelacionada = ObjFactura.CveVenta @@ -8822,7 +8855,7 @@ Partial Class Ventas Liga2 = $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}"";" End If - Alert(MensajeAlert.ToString(), TipoMensaje.MsgVentasDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2) + Alert(MensajeAlert.ToString(), TipoMensaje.MsgVentasDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2, ShowCloseButton:=False) MensajeAlert.Clear() @@ -10167,15 +10200,24 @@ Partial Class Ventas 'Amortizacion ObjFactura.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero() - If ObjFactura.CveTipoRelacion > 0 Then - Select Case ObjFactura.CveTipoRelacion - Case 7 - ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "07" - ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo" - ObjFactura.Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value) - End Select - End If + 'If ObjFactura.CveTipoRelacion > 0 Then + ' Select Case ObjFactura.CveTipoRelacion + ' Case 7 + ' ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "07" + ' ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo" + + ' If ListaAnticiposAplicados IsNot Nothing Then + ' For Each Ant As MAnticipoRelacionado In ListaAnticiposAplicados + ' ObjFactura.Timbre.CFDIRelacionados.UUID.Add(Ant.FolioFiscal) + ' Next + ' End If + + ' 'ObjFactura.Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value) + ' End Select + + 'End If + ObjFactura.AplicaDevolucion = Me.AplicaDevolucion ObjFactura.CveTipoAmortizacionAnticipo = DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() @@ -10705,8 +10747,14 @@ Partial Class Ventas Timbre.CFDIRelacionados.UUID.Add(Dr("FolioFiscal").ToString()) Next Else - If Not String.IsNullOrEmpty(HdnFolioFiscalNC.Value.Trim()) Then - Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value) + If ListaAnticiposAplicados IsNot Nothing AndAlso ListaAnticiposAplicados.Count > 0 Then + For Each Ant As MAnticipoRelacionado In ListaAnticiposAplicados + Timbre.CFDIRelacionados.UUID.Add(Ant.FolioFiscal) + Next + Else + If Not String.IsNullOrEmpty(HdnFolioFiscalNC.Value.Trim()) AndAlso HdnFolioFiscalNC.Value <> "0" Then + Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value) + End If End If End If @@ -11371,9 +11419,17 @@ Partial Class Ventas 'SI TIENE UN ANTICIPO TAMBIEN DEBE RELACIONARLO If CveAnticipoPadre > 0 Then - If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, CveAnticipoPadre) Then - ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico") + If ListaAnticiposAplicados IsNot Nothing Then + For Each Ant As MAnticipoRelacionado In ListaAnticiposAplicados + If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, Ant.CveVenta) Then + ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico") + End If + Next End If + + 'If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, CveAnticipoPadre) Then + ' ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico") + 'End If End If End If @@ -13711,195 +13767,195 @@ Partial Class Ventas Return ErrorPrepoliza End Function - Private Function generaNC(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, ByRef ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ByRef ObjBancos As ClsBancos, ByRef ObjEventos As ClsOIEventos) As List(Of Object) - Dim Obj As New List(Of Object) - Dim CveVentaNueva As Integer = ObjVentas.CveVenta - Dim BanderaGeneraNC As Boolean = True - 'If UsuarioActual.CveEmpresa.Contiene(1, 119) Then BanderaGeneraNC = True + 'Private Function generaNC(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, ByRef ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ByRef ObjBancos As ClsBancos, ByRef ObjEventos As ClsOIEventos) As List(Of Object) + ' Dim Obj As New List(Of Object) + ' Dim CveVentaNueva As Integer = ObjVentas.CveVenta + ' Dim BanderaGeneraNC As Boolean = True + ' 'If UsuarioActual.CveEmpresa.Contiene(1, 119) Then BanderaGeneraNC = True - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then - If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then - Dim drv As DataRow = ObjVentas.DtResultados.Rows(0) - Dim TmpDTconceptos As DataTable = Nothing - Dim CveNCaVincular As Integer = DdlNCFactura.SelectedValue.ToEntero() - 'CargaCliente - Dim CveCliente As Integer = drv("CveCliente").ToString().ToEntero() - If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not CveCliente.Contiene(10450, 10460, 10458) Then - Return Nothing - ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not CveCliente.Contiene(27448) Then - Return Nothing - End If - factura.TipoDocto = drv("TipoDocto").ToString() - factura.Serie = drv("Serie").ToString() - factura.FechaEjecucion = drv("FechaEjecucion").ToString().ToDateTime - factura.Fecha = drv("Fecha").ToString().ToDateTime - factura.CveSubProyectoEjecucion = drv("CveSubProyectoEjecucion").ToString().ToEntero() - factura.CveSubProyectoCobranza = drv("CveSubProyectoCobranza").ToString().ToEntero() - factura.CveClienteSucursal = drv("CveClienteSucursal").ToString().ToEntero() - factura.CveSubProyecto = drv("CveSubProyecto").ToString().ToEntero() + ' If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + ' If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + ' Dim drv As DataRow = ObjVentas.DtResultados.Rows(0) + ' Dim TmpDTconceptos As DataTable = Nothing + ' Dim CveNCaVincular As Integer = DdlNCFactura.SelectedValue.ToEntero() + ' 'CargaCliente + ' Dim CveCliente As Integer = drv("CveCliente").ToString().ToEntero() + ' If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not CveCliente.Contiene(10450, 10460, 10458) Then + ' Return Nothing + ' ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not CveCliente.Contiene(27448) Then + ' Return Nothing + ' End If + ' factura.TipoDocto = drv("TipoDocto").ToString() + ' factura.Serie = drv("Serie").ToString() + ' factura.FechaEjecucion = drv("FechaEjecucion").ToString().ToDateTime + ' factura.Fecha = drv("Fecha").ToString().ToDateTime + ' factura.CveSubProyectoEjecucion = drv("CveSubProyectoEjecucion").ToString().ToEntero() + ' factura.CveSubProyectoCobranza = drv("CveSubProyectoCobranza").ToString().ToEntero() + ' factura.CveClienteSucursal = drv("CveClienteSucursal").ToString().ToEntero() + ' factura.CveSubProyecto = drv("CveSubProyecto").ToString().ToEntero() - 'Carga Detalle Sucursal - CargaClienteSucursal(drv("CveClienteSucursal").ToString().ToEntero(), ObjVentas) + ' 'Carga Detalle Sucursal + ' CargaClienteSucursal(drv("CveClienteSucursal").ToString().ToEntero(), ObjVentas) - 'CargaDetalle - If ObjVentas.GetVentaDetalle(CveVenta) Then - TmpDTconceptos = ObjVentas.DtResultados - TmpDTconceptos.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) - GvPS.DataSource = TmpDTconceptos - GvPS.DataBind() - End If + ' 'CargaDetalle + ' If ObjVentas.GetVentaDetalle(CveVenta) Then + ' TmpDTconceptos = ObjVentas.DtResultados + ' TmpDTconceptos.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) + ' GvPS.DataSource = TmpDTconceptos + ' GvPS.DataBind() + ' End If - 'Carga Totales - factura.SubTotal = drv("SubTotal").ToString().ToDecimal - factura.Descuento = drv("Descuento").ToString().ToDecimal - factura.Amortizacion = drv("Amortizacion").ToString().ToDecimal - factura.IVA = drv("IVA").ToString().ToDecimal - factura.RetIVA = drv("RetIVA").ToString().ToDecimal - factura.RetISR = drv("RetISR").ToString().ToDecimal - factura.Total = drv("Total").ToString().ToDecimal - factura.MotivoDescuento = drv("MotivoDescuento").ToString() - factura.Observaciones = drv("Observaciones").ToString() - factura.CveMoneda = drv("CveMoneda").ToString().ToEntero() - factura.TipoCambio = drv("TipoCambio").ToString().ToDecimal - factura.CveVendedor = drv("CveVendedor").ToString().ToEntero() - factura.RefDocto = drv("Ref").ToString() - 'factura.SerieFolioPadre = drv("SerieFolio").ToString() - HdnFolioFiscalNC.Value = drv("FolioFiscal").ToString() + ' 'Carga Totales + ' factura.SubTotal = drv("SubTotal").ToString().ToDecimal + ' factura.Descuento = drv("Descuento").ToString().ToDecimal + ' factura.Amortizacion = drv("Amortizacion").ToString().ToDecimal + ' factura.IVA = drv("IVA").ToString().ToDecimal + ' factura.RetIVA = drv("RetIVA").ToString().ToDecimal + ' factura.RetISR = drv("RetISR").ToString().ToDecimal + ' factura.Total = drv("Total").ToString().ToDecimal + ' factura.MotivoDescuento = drv("MotivoDescuento").ToString() + ' factura.Observaciones = drv("Observaciones").ToString() + ' factura.CveMoneda = drv("CveMoneda").ToString().ToEntero() + ' factura.TipoCambio = drv("TipoCambio").ToString().ToDecimal + ' factura.CveVendedor = drv("CveVendedor").ToString().ToEntero() + ' factura.RefDocto = drv("Ref").ToString() + ' 'factura.SerieFolioPadre = drv("SerieFolio").ToString() + ' HdnFolioFiscalNC.Value = drv("FolioFiscal").ToString() - ViewState("FolioFiscal") = drv("FolioFiscal").ToString() + ' ViewState("FolioFiscal") = drv("FolioFiscal").ToString() - 'JJMQ 20160506: Se agrego para la validacion de pago de contado. - 'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "") + ' 'JJMQ 20160506: Se agrego para la validacion de pago de contado. + ' 'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "") - UpContado.Update() - If factura.CveCliente > 0 Then - If Not IsNothing(TmpDTconceptos) AndAlso TmpDTconceptos.Rows.Count > 0 Then + ' UpContado.Update() + ' If factura.CveCliente > 0 Then + ' If Not IsNothing(TmpDTconceptos) AndAlso TmpDTconceptos.Rows.Count > 0 Then - If Not drv("Total").ToString().ToDecimal = factura.Total Then - Return Nothing - End If + ' If Not drv("Total").ToString().ToDecimal = factura.Total Then + ' Return Nothing + ' End If - If FolioFiscal = "" Then - CveEstatus = 4 - Else - CveEstatus = 5 - End If + ' If FolioFiscal = "" Then + ' CveEstatus = 4 + ' Else + ' CveEstatus = 5 + ' End If - '[IPP] - CANCELA INVENTARIO DE VENTA NUEVA Y NO TRASPASA MOVTOS DE ALMACEN - 'If UsuarioActual.CveEmpresa.Contiene(1) Then - 'QUEMA DOCUMENTO NUEVO - If Not ObjInventario.ActualizarEsDevolucionVenta(CveVentaNueva, 2) Then - Return Nothing - End If - 'Else - ' 'TRASPASA ALMACEN A DOCUMENTO NUEVO - ' If Not CancelarMovimientoInventario(ObjInventario, ObjConta, CveVentaNueva, CveDevolucion) Then - ' Return Nothing - ' End If - 'End If + ' '[IPP] - CANCELA INVENTARIO DE VENTA NUEVA Y NO TRASPASA MOVTOS DE ALMACEN + ' 'If UsuarioActual.CveEmpresa.Contiene(1) Then + ' 'QUEMA DOCUMENTO NUEVO + ' If Not ObjInventario.ActualizarEsDevolucionVenta(CveVentaNueva, 2) Then + ' Return Nothing + ' End If + ' 'Else + ' ' 'TRASPASA ALMACEN A DOCUMENTO NUEVO + ' ' If Not CancelarMovimientoInventario(ObjInventario, ObjConta, CveVentaNueva, CveDevolucion) Then + ' ' Return Nothing + ' ' End If + ' 'End If - 'CANCELA PAGOS - If ObjFacturaDevolucion.TipoDocto.Contiene("Ing", "Ant") Then - If Not ObjConta.PrePolizasCancelarPagos(CveDevolucion, ObjFactura.CvePrePoliza) Then - Return Nothing - End If - End If + ' 'CANCELA PAGOS + ' If ObjFacturaDevolucion.TipoDocto.Contiene("Ing", "Ant") Then + ' If Not ObjConta.PrePolizasCancelarPagos(CveDevolucion, ObjFactura.CvePrePoliza) Then + ' Return Nothing + ' End If + ' End If - 'CANCELA FACTURA + ' 'CANCELA FACTURA - BanderaGeneraNC = True - '2019.05.10- RMF. se activa la bandera a true, para que siempre se cancele, y no genere la NC + ' BanderaGeneraNC = True + ' '2019.05.10- RMF. se activa la bandera a true, para que siempre se cancele, y no genere la NC - If Month(factura.Fecha) = Month(Now) OrElse BanderaGeneraNC = True Then - If CancelarFactura(ObjVentas, ObjConta, ObjContPaq, ObjBancos) Then - Obj.Add(factura) - Else - Return Nothing - End If - Else - ObjFacturaDevolucion.TipoDocto = "Egs" - ObjFacturaDevolucion.Fecha = Now - If RegistrarNC(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, TmpDTconceptos, ObjEventos) Then - Obj.Add(ObjFacturaDevolucion) - Else - Return Nothing - End If - End If + ' If Month(factura.Fecha) = Month(Now) OrElse BanderaGeneraNC = True Then + ' If CancelarFactura(ObjVentas, ObjConta, ObjContPaq, ObjBancos) Then + ' Obj.Add(factura) + ' Else + ' Return Nothing + ' End If + ' Else + ' ObjFacturaDevolucion.TipoDocto = "Egs" + ' ObjFacturaDevolucion.Fecha = Now + ' If RegistrarNC(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, TmpDTconceptos, ObjEventos) Then + ' Obj.Add(ObjFacturaDevolucion) + ' Else + ' Return Nothing + ' End If + ' End If - 'TRASPASA PAGADO - If Not ObjConta.TraspasarSaldosPrePolizas(CveDevolucion, ObjFactura.CveVenta, ObjFactura.CvePrePoliza) Then - Return Nothing - End If + ' 'TRASPASA PAGADO + ' If Not ObjConta.TraspasarSaldosPrePolizas(CveDevolucion, ObjFactura.CveVenta, ObjFactura.CvePrePoliza) Then + ' Return Nothing + ' End If - If Not ObjInventario.TraspasaEntregaDirectaOCInv(ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then - Return Nothing - End If + ' If Not ObjInventario.TraspasaEntregaDirectaOCInv(ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then + ' Return Nothing + ' End If - End If - End If - End If - End If + ' End If + ' End If + ' End If + ' End If - If Obj.Count > 0 Then - Return Obj - Else - Return Nothing - End If + ' If Obj.Count > 0 Then + ' Return Obj + ' Else + ' Return Nothing + ' End If - End Function - Private Function RegistrarNC(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos) As Boolean - Dim ProcesoCorrecto As Boolean = True - RefacturacionGeneroNC = True + 'End Function + 'Private Function RegistrarNC(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos) As Boolean + ' Dim ProcesoCorrecto As Boolean = True + ' RefacturacionGeneroNC = True - ''Generamos el nuevo folio - 'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL()) - 'If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then - ' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue)) - ' If DT.Rows.Count > 0 Then - ' factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero() - ' Else - ' ProcesoCorrecto = False - ' End If - ' DT.Dispose() - 'End If - factura.Folio = -1 + ' ''Generamos el nuevo folio + ' 'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL()) + ' 'If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then + ' ' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue)) + ' ' If DT.Rows.Count > 0 Then + ' ' factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero() + ' ' Else + ' ' ProcesoCorrecto = False + ' ' End If + ' ' DT.Dispose() + ' 'End If + ' factura.Folio = -1 - 'Registramos la venta - GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, TmpDTconceptos, -1, ObjContPaq, ObjBancos) - 'CargaNCDT(factura.CveVentaPadre, factura.Total) + ' 'Registramos la venta + ' GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, TmpDTconceptos, -1, ObjContPaq, ObjBancos) + ' 'CargaNCDT(factura.CveVentaPadre, factura.Total) - 'ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion) - ''Timbramos - 'If factura.TipoDocto.Contiene("Ing", "Egs", "Ant") AndAlso FolioFiscal <> "" Then - ' If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso UsuarioActual.Empresa.FacturaProduccion Then + ' 'ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion) + ' ''Timbramos + ' 'If factura.TipoDocto.Contiene("Ing", "Egs", "Ant") AndAlso FolioFiscal <> "" Then + ' ' If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso UsuarioActual.Empresa.FacturaProduccion Then - ' Dim sw As New Diagnostics.Stopwatch - ' sw.Start() + ' ' Dim sw As New Diagnostics.Stopwatch + ' ' sw.Start() - ' 'FACTURA INGRESO/EGRESO - ' Dim ObjTimbrado As New Modelos.Timbrado - ' Dim FM As New Modelos.FemsaFactura - ' Dim TmpDT7Eleven As New DataTable - ' Dim TmpDTComplementosTimbrado As New DataTable + ' ' 'FACTURA INGRESO/EGRESO + ' ' Dim ObjTimbrado As New Modelos.Timbrado + ' ' Dim FM As New Modelos.FemsaFactura + ' ' Dim TmpDT7Eleven As New DataTable + ' ' Dim TmpDTComplementosTimbrado As New DataTable - ' PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado) + ' ' PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado) - ' ObjTimbrado.TimbrarFactura(UsuarioActual, factura, FM, TmpDT, TmpDTImpuestos, TmpDT7Eleven, TmpDTComplementosTimbrado, Ruta, LstFordASN, TxtFordGSDB.Text, ObjVentas) + ' ' ObjTimbrado.TimbrarFactura(UsuarioActual, factura, FM, TmpDT, TmpDTImpuestos, TmpDT7Eleven, TmpDTComplementosTimbrado, Ruta, LstFordASN, TxtFordGSDB.Text, ObjVentas) - ' sw.Stop() - ' GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString(), UsuarioActual.Empresa.CvePAC) + ' ' sw.Stop() + ' ' GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString(), UsuarioActual.Empresa.CvePAC) - ' ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" Then - ' GeneraPDFCBB(ObjFactura.Fecha, Nothing, ObjFactura.SerieFolio, False) - ' End If - 'End If + ' ' ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" Then + ' ' GeneraPDFCBB(ObjFactura.Fecha, Nothing, ObjFactura.SerieFolio, False) + ' ' End If + ' 'End If - If ErrorList.Count > 0 Then - ProcesoCorrecto = False - End If + ' If ErrorList.Count > 0 Then + ' ProcesoCorrecto = False + ' End If - Return ProcesoCorrecto - End Function + ' Return ProcesoCorrecto + 'End Function #End Region #Region " VISTA PREVIA NEW " @@ -15003,12 +15059,19 @@ Partial Class Ventas Dim Amortizacion As Decimal = 0 Dim ImpuestosLocalesTemporal As Decimal = 0 + If ListaAnticiposAplicados IsNot Nothing Then + ListaAnticiposAplicados.Clear() + Else + ListaAnticiposAplicados = New List(Of MAnticipoRelacionado) + End If + HdnIVACalculado.Value = HdnIVAOriginal.Value For Each gvr As GridViewRow In GVAnticipos.Rows If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal ' - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal) HdnIVACalculado.Value = (HdnIVACalculado.Value.ToDouble - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)).FormatoNumero(2) - HdnFolioFiscalNC.Value = gvr.DataKey("FolioFiscal") + ListaAnticiposAplicados.Add(New MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal")}) + 'HdnFolioFiscalNC.Value = gvr.DataKey("FolioFiscal") 'CvePSAmortizacion = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", "CveConceptoContable = 11").ToEntero() End If @@ -32425,5 +32488,10 @@ Partial Class Ventas End Select UpModalSolicitud.Update() End Sub + + Public Class MAnticipoRelacionado + Public Property CveVenta As Integer + Public Property FolioFiscal As String + End Class End Class From ed76e783b92547e2dc8e06d7580b691f0f732784 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Fri, 15 Oct 2021 09:44:06 -0700 Subject: [PATCH 14/17] Dll SAT pais, estado, municipio, localidad, colonia --- Acarreos/CatChoferes.aspx | 1 + App_Code/ClsSubProyectos.vb | 7 +- Planeacion/CatSubProyectos.aspx | 127 +++++++++++++++++++------- Planeacion/CatSubProyectos.aspx.vb | 142 +++++++++++++++++++++++------ 4 files changed, 213 insertions(+), 64 deletions(-) diff --git a/Acarreos/CatChoferes.aspx b/Acarreos/CatChoferes.aspx index af85b3f0d..740010af5 100644 --- a/Acarreos/CatChoferes.aspx +++ b/Acarreos/CatChoferes.aspx @@ -147,6 +147,7 @@ +
    diff --git a/App_Code/ClsSubProyectos.vb b/App_Code/ClsSubProyectos.vb index f07ce9213..97c8bd94d 100644 --- a/App_Code/ClsSubProyectos.vb +++ b/App_Code/ClsSubProyectos.vb @@ -335,7 +335,7 @@ Public Class ClsSubProyectos Public Function AddCentroCosto(SubProyecto As String, IdSegNeg As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveProyecto As Integer, Optional Serie As String = "", Optional IVA As Double = 0.0, Optional Calle As String = "", Optional NoExt As String = "", Optional NoInt As String = "", Optional Colonia As String = "", Optional Localidad As String = "", Optional Municipio As String = "", Optional Estado As String = "", Optional Pais As String = "", Optional CP As String = "", Optional TipoSucursal As Integer = 0, Optional EsSucursal As Integer = 0, Optional CvePais As Integer = -1, Optional CveEstado As Integer = -1, Optional CveMunicipio As Integer = -1, Optional CveColonia As Integer = -1, Optional AplicaComercioExterior As Boolean = False, Optional Correo As String = "", Optional CvePrecioLista As Integer = -1, - Optional Telefono As String = "", Optional NoVerificaAlmacen As Boolean = False, Optional CodigoSucursal As String = "") As Boolean + Optional Telefono As String = "", Optional NoVerificaAlmacen As Boolean = False, Optional CodigoSucursal As String = "", Optional CveLocalidad As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_CentroCostoAdd") @@ -369,6 +369,7 @@ Public Class ClsSubProyectos .Add("@Telefono", SqlDbType.VarChar).Value = Telefono .Add("@NoVerificaAlmacen", SqlDbType.Bit).Value = NoVerificaAlmacen .Add("@CodigoSucursal", SqlDbType.VarChar).Value = CodigoSucursal + .Add("@CveSubProyecto", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -391,7 +392,7 @@ Public Class ClsSubProyectos Public Function UpdateCentroCosto(CveSubProyecto As Integer, SubProyecto As String, IdSegNeg As Integer, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveProyecto As Integer, Optional Serie As String = "", Optional IVA As Double = 0.0, Optional Calle As String = "", Optional NoExt As String = "", Optional NoInt As String = "", Optional Colonia As String = "", Optional Localidad As String = "", Optional Municipio As String = "", Optional Estado As String = "", Optional Pais As String = "", Optional CP As String = "", Optional TipoSucursal As Integer = 0, Optional EsSucursal As Integer = 0, Optional CvePais As Integer = -1, Optional CveEstado As Integer = -1, Optional CveMunicipio As Integer = -1, Optional CveColonia As Integer = -1, Optional AplicaComercioExterior As Boolean = False, Optional Correo As String = "", Optional CvePrecioLista As Integer = -1, - Optional Telefono As String = "", Optional HorarioVerano As Integer = Nothing, Optional HorarioInvierno As Integer = Nothing, Optional NoVerificaAlmacen As Boolean = False, Optional CodigoSucursal As String = "") As Boolean + Optional Telefono As String = "", Optional HorarioVerano As Integer = Nothing, Optional HorarioInvierno As Integer = Nothing, Optional NoVerificaAlmacen As Boolean = False, Optional CodigoSucursal As String = "", Optional CveLocalidad As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_CentroCostoUpdate") @@ -429,6 +430,8 @@ Public Class ClsSubProyectos .Add("@HorarioInvierno", SqlDbType.Int).Value = HorarioInvierno .Add("@NoVerificaAlmacen", SqlDbType.Bit).Value = NoVerificaAlmacen .Add("@CodigoSucursal", SqlDbType.VarChar).Value = CodigoSucursal + .Add("@CveLocalidad", SqlDbType.Int).Value = CveLocalidad + End With Try diff --git a/Planeacion/CatSubProyectos.aspx b/Planeacion/CatSubProyectos.aspx index 03c8f97f5..4535b4e75 100644 --- a/Planeacion/CatSubProyectos.aspx +++ b/Planeacion/CatSubProyectos.aspx @@ -83,7 +83,7 @@
    @@ -120,6 +120,11 @@
    + +
    + +
    + @@ -180,7 +185,7 @@
    - +
    @@ -273,18 +278,81 @@
    - +
    - + + +
    + + + +
    +
    +
    + + + + + +
    +
    + +
    +
    + + + + + +
    +
    +
    + + +
    + + +
    +
    + + + +
    +
    +
    + +
    + + +
    + +
    + +
    + +
    +
    + +
    + + + + +
    + +
    +
    + +
    @@ -322,38 +390,19 @@ - + + + + + +<%-- -
    -
    - - - -
    -
    -
    -
    - - - -
    -
    -
    -
    - - - -
    -
    -
    -
    - - - -
    -
    + + + +
    -
    +
    --%> @@ -375,7 +424,7 @@ - diff --git a/Planeacion/CatSubProyectos.aspx.vb b/Planeacion/CatSubProyectos.aspx.vb index 1d89bde3c..eff61c7fb 100644 --- a/Planeacion/CatSubProyectos.aspx.vb +++ b/Planeacion/CatSubProyectos.aspx.vb @@ -74,6 +74,7 @@ Partial Class CatSubProyectos CargaEstado() CargaMunicipio() CargaColonia() + CargaLocalidad() CargaPrecioLista() @@ -301,7 +302,9 @@ Partial Class CatSubProyectos DdlMunicipio.SelectedValueExist(GvRow.DataKey("CveMunicipio")) CargaColonia() DdlColonia.SelectedValueExist(GvRow.DataKey("CveColonia")) - AplicaComercio() + CargaLocalidad() + DdlLocalidad.SelectedValueExist(GvRow.DataKey("CveLocalidad")) + 'AplicaComercio() ChkNoVerificaAlmacen.Checked = If(GvRow.DataKey("NoVerificaAlmacen").ToString = "True", True, False) TxtCodigoSucursal.Text = (GvRow.DataKey("CodigoSucursal")) @@ -368,12 +371,52 @@ Partial Class CatSubProyectos Dim IdSeg As Integer If DdlSegmentoNegocio.Visible = True Then IdSeg = DdlSegmentoNegocio.SelectedValue.ToEntero Else IdSeg = 0 - 'CREA SUBPROYECTO + + + Dim StrPais As String = "" + Dim StrEstado As String = "" + Dim StrMunicipio As String = "" + Dim StrLocalidad As String = "" + Dim StrColonia As String = "" + + + + If DdlPais.SelectedValue.ToEntero > 0 Then + StrPais = DdlPais.SelectedItem.Text + Else + StrPais = TxtPais.Text + End If + + If DdlEstado.SelectedValue.ToEntero > 0 Then + StrEstado = DdlEstado.SelectedItem.Text + Else + StrEstado = TxtEstado.Text + End If + + If DdlMunicipio.SelectedValue.ToEntero > 0 Then + StrMunicipio = DdlMunicipio.SelectedItem.Text + Else + StrMunicipio = TxtMunicipio.Text + End If + + If DdlLocalidad.SelectedValue.ToEntero > 0 Then + StrLocalidad = DdlLocalidad.SelectedItem.Text + Else + StrLocalidad = TxtLocalidad.Text + End If + + If DdlColonia.SelectedValue.ToEntero > 0 Then + StrColonia = DdlColonia.SelectedItem.Text + Else + StrColonia = TxtColonia.Text + End If + + 'CREA SUBPROYECTO If HdnModalidad.Value = "I" Then If Not ObjSubproyectos.AddCentroCosto(TxtCentroCosto.Text.Trim, IdSeg, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero, Serie:=TxtSerie.Text.Trim, IVA:=TxtIVA.Text.ToDecimal, Calle:=TxtCalle.Text.Trim, NoExt:=TxtNoExt.Text.Trim, - NoInt:=TxtNoInt.Text.Trim, Colonia:=TxtColonia.Text.Trim, Localidad:=TxtLocalidad.Text.Trim, Municipio:=TxtMunicipio.Text.Trim, Estado:=TxtEstado.Text.Trim, Pais:=TxtPais.Text.Trim, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal, + NoInt:=TxtNoInt.Text.Trim, Colonia:=StrColonia, Localidad:=StrLocalidad, Municipio:=StrMunicipio, Estado:=StrEstado, Pais:=StrPais, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal, CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, Correo:=TxtCorreo.Text, CvePrecioLista:=DdlPrecioLista.SelectedValue.ToEntero, - Telefono:=TxtTelefono.Text, NoVerificaAlmacen:=ChkNoVerificaAlmacen.Checked, CodigoSucursal:=TxtCodigoSucursal.Text.Trim) Then + Telefono:=TxtTelefono.Text, NoVerificaAlmacen:=ChkNoVerificaAlmacen.Checked, CodigoSucursal:=TxtCodigoSucursal.Text.Trim, CveLocalidad:=DdlLocalidad.SelectedValue.ToEntero) Then TieneError = True Else CveSubProyecto = ObjSubproyectos.CveSubProyecto @@ -381,9 +424,9 @@ Partial Class CatSubProyectos Else If (HorarioVerano > -13 And HorarioVerano < 13) And (HorarioInvierno > -13 And HorarioInvierno < 13) Then If Not ObjSubproyectos.UpdateCentroCosto(CveCentroCosto, TxtCentroCosto.Text.Trim, IdSeg, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero, Serie:=TxtSerie.Text.Trim, IVA:=TxtIVA.Text.ToDecimal, Calle:=TxtCalle.Text.Trim, NoExt:=TxtNoExt.Text.Trim, - NoInt:=TxtNoInt.Text.Trim, Colonia:=TxtColonia.Text.Trim, Localidad:=TxtLocalidad.Text.Trim, Municipio:=TxtMunicipio.Text.Trim, Estado:=TxtEstado.Text.Trim, Pais:=TxtPais.Text.Trim, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal, + NoInt:=TxtNoInt.Text.Trim, Colonia:=StrColonia, Localidad:=TxtLocalidad.Text.Trim, Municipio:=StrMunicipio, Estado:=StrEstado, Pais:=StrPais, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal, CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, Correo:=TxtCorreo.Text, CvePrecioLista:=DdlPrecioLista.SelectedValue.ToEntero, - Telefono:=TxtTelefono.Text, HorarioVerano:=TxtHorarioVerano.Text.ToEntero, HorarioInvierno:=TxtHorarioInvierno.Text.ToEntero, NoVerificaAlmacen:=ChkNoVerificaAlmacen.Checked, CodigoSucursal:=TxtCodigoSucursal.Text.Trim) Then + Telefono:=TxtTelefono.Text, HorarioVerano:=TxtHorarioVerano.Text.ToEntero, HorarioInvierno:=TxtHorarioInvierno.Text.ToEntero, NoVerificaAlmacen:=ChkNoVerificaAlmacen.Checked, CodigoSucursal:=TxtCodigoSucursal.Text.Trim, CveLocalidad:=DdlLocalidad.SelectedValue.ToEntero) Then TieneError = True End If Else @@ -668,7 +711,7 @@ Partial Class CatSubProyectos ChkEsMatriz.Checked = False ChkEsSucursal.Checked = False ChkAplicaComercioExterior.Checked = False - TabComercioExterior.Visible = False + 'TabComercioExterior.Visible = False TxtSerie.Text = "" TxtIVA.Text = "0.16" @@ -689,6 +732,7 @@ Partial Class CatSubProyectos CargaEstado() CargaMunicipio() CargaColonia() + CargaLocalidad() If UsuarioActual.Empresa.UsaContabilidad Then CargaSegmentosNegocio() @@ -790,36 +834,80 @@ Partial Class CatSubProyectos End If DdlColonia.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlColonia.DataBind() + End Sub + + + Protected Sub CargaLocalidad() + + DdlLocalidad.Items.Clear() + + If DdlEstado.SelectedValue.ToEntero > 0 Then + DdlLocalidad.DataSource = GlobalDTLocalidad(DdlEstado.SelectedValue.ToEntero, DdlMunicipio.SelectedValue.ToEntero) + DdlLocalidad.DataBind() + End If + + DdlLocalidad.Items.Insert(0, New ListItem("Seleccione una", "-1")) + End Sub Protected Sub DdlPais_SelectedIndexChanged(sender As Object, e As EventArgs) CargaEstado() CargaMunicipio() CargaColonia() + CargaLocalidad() End Sub Protected Sub DdlEstado_SelectedIndexChanged(sender As Object, e As EventArgs) CargaMunicipio() CargaColonia() - End Sub - Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaColonia() - End Sub - - Protected Sub ChkAplicaComercioExterior_CheckedChanged(sender As Object, e As EventArgs) - AplicaComercio() - End Sub - - Private Sub AplicaComercio() - If ChkAplicaComercioExterior.Checked Then - TabComercioExterior.Visible = True - Else - TabComercioExterior.Visible = False - End If - UpBodyCentroCosto.Update() - End Sub - + CargaLocalidad() + End Sub + + Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaColonia() + CargaLocalidad() + End Sub + + 'Protected Sub ChkAplicaComercioExterior_CheckedChanged(sender As Object, e As EventArgs) + ' AplicaComercio() + 'End Sub + + 'Private Sub AplicaComercio() + ' If ChkAplicaComercioExterior.Checked Then + ' TabComercioExterior.Visible = True + ' Else + ' TabComercioExterior.Visible = False + ' End If + ' UpBodyCentroCosto.Update() + 'End Sub + #End Region - - + + Protected Sub BtnValidar_Click(sender As Object, e As EventArgs) + validaCodigoPostal() + End Sub + + + Protected Sub DdlColonia_SelectedIndexChanged(sender As Object, e As EventArgs) + validaCodigoPostal() + End Sub + + Private Sub validaCodigoPostal() + + Dim CPTxt As Integer = TxtCP.Text.ToEntero() + + Dim CveColonia As Integer = DdlColonia.SelectedValue.ToEntero + + If CPTxt > 0 And CveColonia > 0 Then + Dim CP As Integer = GlobalDTColonia("-1").FiltroPrimeroValor("CP", $"CveColonia = {CveColonia}").ToEntero + If CPTxt <> CP Then + Alert("El codigo postal selecionado es diferente del codigo postal de la Colonia.", TipoMensaje.MsgAdvertencia) + End If + End If + + End Sub + + + + End Class From 2bdb0fa8632fe259773760a37126fbdfb2e53dd5 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Fri, 15 Oct 2021 15:41:27 -0700 Subject: [PATCH 15/17] CxC Pop de pago no se mostraba correctamente --- Ventas/Clientes.aspx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index 82c774b14..d05fb3407 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -2078,6 +2078,11 @@ + + + + +
    @@ -6569,6 +6574,11 @@ $("#C_Tab_TabContratos_tab").click(function () { CargaContratos(); }); } + var isAsyncPostback = Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack(); + if (isAsyncPostback) { + tb_init('a.thickbox'); + } + } $(document).on('mouseenter', ".truncate", function () { var $this = $(this); @@ -7293,6 +7303,13 @@ $get("BtnCambiaPorcentaje").click(); } + + + + + + + From a167fb86693ded2c52dc9780edddae239e7d2d96 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Fri, 15 Oct 2021 18:17:51 -0700 Subject: [PATCH 16/17] Requerir combos SAT cuando es sucursal --- Compras/eFacturas.aspx.vb | 8 ++++++-- Planeacion/CatSubProyectos.aspx | 12 +++++++----- Planeacion/CatSubProyectos.aspx.vb | 21 ++++++++++++++++++++- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index 3bd8d405b..322ac5493 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -2924,14 +2924,18 @@ Partial Class Compras_eFacturas For Each dRow2 As DataRow In DTDocumentosRelacionados.Rows - If dRow2("IdDocumento").ToString.ToUpper = drow("IdDocumento").ToString.ToUpper And drow("CveIE").ToString.ToEntero > 0 Then + If dRow2("IdDocumento").ToString.ToUpper = drow("IdDocumento").ToString.ToUpper Then dRow2("CveCompra") = drow("CveCompra").ToString.ToEntero dRow2("CveFactura") = drow("CveFactura").ToString.ToEntero dRow2("CveMetodoPago") = drow("CveMetodoPago").ToString.ToEntero dRow2("SerieFolioCompra") = drow("SerieFolioCompra").ToString Try - dRow2("CvePrePolizaDetalle") = drow("CvePrePolizaDetalle").ToString + + If drow("CveIE").ToString.ToEntero > 0 Then + dRow2("CvePrePolizaDetalle") = drow("CvePrePolizaDetalle").ToString + End If + Catch ex As Exception dRow2("CvePrePolizaDetalle") = 0 End Try diff --git a/Planeacion/CatSubProyectos.aspx b/Planeacion/CatSubProyectos.aspx index 4535b4e75..a0f58e6cf 100644 --- a/Planeacion/CatSubProyectos.aspx +++ b/Planeacion/CatSubProyectos.aspx @@ -300,7 +300,7 @@
    - +
    @@ -310,7 +310,7 @@
    - +
    @@ -323,8 +323,9 @@
    - - + + +
    @@ -332,6 +333,7 @@
    +
    @@ -345,7 +347,7 @@
    - +
    diff --git a/Planeacion/CatSubProyectos.aspx.vb b/Planeacion/CatSubProyectos.aspx.vb index eff61c7fb..02500da0f 100644 --- a/Planeacion/CatSubProyectos.aspx.vb +++ b/Planeacion/CatSubProyectos.aspx.vb @@ -743,7 +743,8 @@ Partial Class CatSubProyectos RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarCentroCosto")) End Sub - Private Sub CargaRequired() + Private Sub CargaRequired() + If ChkEsSucursal.Checked = True Then RFVSerie.Enabled = True RFVIVA.Enabled = True @@ -767,6 +768,14 @@ Partial Class CatSubProyectos RFVPais.Visible = True RFVCP.Visible = True + RFVCP.Visible = True + RFVDdlPais.Visible = True + RFVDdlEstado.Visible = True + RFVMunicipio.Visible = True + RFVLocalidad.Visible = True + RFVColonia.Visible = True + + Else RFVSerie.Enabled = False RFVIVA.Enabled = False @@ -790,6 +799,14 @@ Partial Class CatSubProyectos RFVPais.Visible = False RFVCP.Visible = False + + RFVCP.Visible = False + RFVDdlPais.Visible = False + RFVDdlEstado.Visible = False + RFVMunicipio.Visible = False + RFVLocalidad.Visible = False + RFVColonia.Visible = False + End If End Sub @@ -909,5 +926,7 @@ Partial Class CatSubProyectos + + End Class From d3c2b30ff69560fd0859d7773323a297ebc64093 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 15 Oct 2021 19:22:22 -0700 Subject: [PATCH 17/17] =?UTF-8?q?Candado=20de=20autorizaci=C3=B3nes=20en?= =?UTF-8?q?=20cotizaciones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ventas/Ventas.aspx.vb | 257 ++++++++++++++++++++++++++++-------------- 1 file changed, 174 insertions(+), 83 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index c44945cb0..19ee8aa5b 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5079,69 +5079,7 @@ Partial Class Ventas End If 'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR - If TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") Then - - If UsuarioActual.TienePermisoProceso(199) Then - BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True) - Else - BtnGenerarRemision.Visible = False - End If - - If UsuarioActual.TienePermisoProceso(60) Then BtnsFacturar.Visible = True 'puede facturar - - If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso UsuarioActual.TienePermisoProceso(60) Then - - Select Case UsuarioActual.Empresa.Funcionalidad(135) - Case "1" ' POR SUPERVISOR - Dim ObjVendedores As New ClsVtaVendedores - - If ObjVendedores.GetVendedores(UsuarioActual.CveEmpresa) Then - Dim DTVendedores As New DataTable - If DbRowVenta("CveVendedor").ToString().ToEntero() > 0 AndAlso UsuarioActual.CveVendedor > 0 Then - DTVendedores = ObjVendedores.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", DbRowVenta("CveVendedor").ToString())).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor)) - End If - - 'Verifico si es su supervisor asignado - If DTVendedores.Rows.Count > 0 Then - If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then - BtnsFacturar.Visible = True - - If UsuarioActual.TienePermisoProceso(199) Then - BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True) - Else - BtnGenerarRemision.Visible = False - End If - - Else - BtnsFacturar.Visible = False - BtnGenerarRemision.Visible = False - End If - End If - - DTVendedores.Dispose() - End If - ObjVendedores.Dispose() - - Case "2" ' POR PERMISO - If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then - BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60) - - If UsuarioActual.TienePermisoProceso(199) Then - BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True) - Else - BtnGenerarRemision.Visible = False - End If - Else - BtnsFacturar.Visible = False - BtnGenerarRemision.Visible = False - End If - - End Select - - End If - - LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) - End If + VerificarBtnFacturarCotizacion(DbRowVenta("CveVendedor").ToString().ToEntero()) End If If UsuarioActual.Empresa.Funcionalidad(280) = "1" Then @@ -5255,6 +5193,75 @@ Partial Class Ventas ObjVentas.Dispose() Return Retorno End Function + + Private Sub VerificarBtnFacturarCotizacion(CveVendedor As Integer, Optional MostrarGenerarRemision As Boolean = True) + If TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") Then + + If UsuarioActual.TienePermisoProceso(199) Then + BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True) + Else + BtnGenerarRemision.Visible = False + End If + + If UsuarioActual.TienePermisoProceso(60) Then BtnsFacturar.Visible = True 'puede facturar + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso UsuarioActual.TienePermisoProceso(60) Then + + Select Case UsuarioActual.Empresa.Funcionalidad(135) + Case "1" ' POR SUPERVISOR + Dim ObjVendedores As New ClsVtaVendedores + + If ObjVendedores.GetVendedores(UsuarioActual.CveEmpresa) Then + Dim DTVendedores As New DataTable + If CveVendedor > 0 AndAlso UsuarioActual.CveVendedor > 0 Then + DTVendedores = ObjVendedores.DtResultados.FiltraParametros(String.Format("CveVendedor = {0}", CveVendedor)).FiltraParametros(String.Format("CveSupervisor = {0}", UsuarioActual.CveVendedor)) + End If + + 'Verifico si es su supervisor asignado + If DTVendedores.Rows.Count > 0 Then + If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then + BtnsFacturar.Visible = True + + If UsuarioActual.TienePermisoProceso(199) Then + BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True) + Else + BtnGenerarRemision.Visible = False + End If + + Else + BtnsFacturar.Visible = False + BtnGenerarRemision.Visible = False + End If + End If + + DTVendedores.Dispose() + End If + ObjVendedores.Dispose() + + Case "2" ' POR PERMISO + If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then + BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60) + + If UsuarioActual.TienePermisoProceso(199) Then + BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True) + Else + BtnGenerarRemision.Visible = False + End If + Else + BtnsFacturar.Visible = False + BtnGenerarRemision.Visible = False + End If + + End Select + + End If + + If BtnGenerarRemision.Visible AndAlso Not MostrarGenerarRemision Then + BtnGenerarRemision.Visible = False + End If + LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) + End If + End Sub Private Sub CargaTiposDocumentos() DdlTipoComprobante.DataSource = GlobalDTTiposDocumentos() DdlTipoComprobante.DataBind() @@ -6278,17 +6285,23 @@ Partial Class Ventas Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595) 'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO - If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso EsCreaApartirDe)) Then + If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then RBLPago.SelectedValue = "2" RBLPago.Items(0).Enabled = False RBLPago_SelectedIndexChanged(Nothing, Nothing) 'GENERAR UNA AUTORIZACIÓN SI EL CLIENTE NO PERMITE CREDITO If UsuarioActual.Empresa.Funcionalidad(595) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) Then - DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización") - DdlTipoComprobante.SelectedValue = "PA" + 'SI LLEGÓ POR LA OPCIÓN DE COTIZACIÓN NO DEBE DE RESTRINGUIR + If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then + DdlTipoComprobante.SelectedValue = "Cot" + BtnGenerarRemision.Visible = False + Else + DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización") + DdlTipoComprobante.SelectedValue = "PA" + End If + TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString - 'si llegó por la opción de cotización no debe de restringuir - If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) If Not UsuarioActual.TienePermisoProceso(325) Then DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) @@ -6302,7 +6315,7 @@ Partial Class Ventas 'CARGAR CREDITO DISPONIBLE AL GENERAR UNA FACTURA End If - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta <= 0 AndAlso RBLPago.SelectedValue = "1" AndAlso PermiteCredito Then + If ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta <= 0) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) AndAlso RBLPago.SelectedValue = "1" AndAlso PermiteCredito Then 'FUNCIONALIDAD 702 - NO VERIFICAR LIMITE DE CRÉDITO Y CANDADOS DE VENTA If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then RBLPago.SelectedValue = "1" @@ -6316,7 +6329,7 @@ Partial Class Ventas LblCreditoDisponible.Text = CreditoDispo.FormatoNumero If PorcentajeCredito > 80 Then TrPorcentajeCredito.Visible = True : LblPorcentajeCredito.Text = $"{PorcentajeCredito.FormatoNumero}%" - If Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") AndAlso (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("2")) Then + If Not UsuarioActual.TienePermisoProceso(268) AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) AndAlso (Not UsuarioActual.Empresa.Funcionalidad(702).Contiene("2")) Then Dim Vta As New ClsVentas Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

    {0}", Vta.SerieVenta) @@ -6332,7 +6345,7 @@ Partial Class Ventas DdlTipoComprobante.SelectedValue = "PA" TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString 'si llegó por la opción de cotización no debe de restringuir - If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" + If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then DdlTipoComprobante.SelectedValue = "Cot" 'quito remisión y factura DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) If Not UsuarioActual.TienePermisoProceso(325) Then @@ -6391,7 +6404,7 @@ Partial Class Ventas DdlTipoComprobante.SelectedValue = "PA" TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString 'si llegó por la opción de cotización no debe de restringuir - If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" + If IfNull(Request("Op"), "").ToString() = "Cot" OrElse (DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0) Then DdlTipoComprobante.SelectedValue = "Cot" DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) If Not UsuarioActual.TienePermisoProceso(325) Then DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) @@ -6403,6 +6416,27 @@ Partial Class Ventas LnkPedido2SinFacturar.Visible = False LnkCotizaciones.Visible = False LnkOCs.Visible = False + Else + 'VERIFICAR LIMITE DE CREDITO + If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 AndAlso RBLPago.SelectedValue = "1" Then + If CreditoDispo < 0 Then + BtnsFacturar.Visible = False + BtnGenerarRemision.Visible = False + Alert("El límite de crédito se ha excedido", TipoMensaje.MsgAdvertencia) + End If + End If + + If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 Then + Dim Vta As New ClsVentas + Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) + Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

    {0}", Vta.SerieVenta) + Vta.Dispose() + If Opcion > 0 Then + BtnsFacturar.Visible = False + BtnGenerarRemision.Visible = False + Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) + End If + End If End If Case "2" 'Autorizacion desde una solicitud del catalogo de autorizaciones 'RMF. validacion temporal @@ -6427,6 +6461,18 @@ Partial Class Ventas Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) End If Else + 'VERIFICAR CANDADOS DE VENTA + If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 Then + Dim Vta As New ClsVentas + Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) + Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

    {0}", Vta.SerieVenta) + Vta.Dispose() + If Opcion > 0 Then + BtnsFacturar.Visible = False + BtnGenerarRemision.Visible = False + Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) + End If + End If If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then RBLPago.SelectedValue = "2" @@ -6449,9 +6495,25 @@ Partial Class Ventas End If End If - UPPCreditoDisponible.Update() + Else + + 'VERIFICAR RESTRICCIONES DEL CLIENTE + If DdlTipoComprobante.SelectedValue = "Cot" AndAlso CveVenta > 0 AndAlso RBLPago.SelectedValue = "2" Then + Dim Vta As New ClsVentas + Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) + Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

    {0}", Vta.SerieVenta) + Vta.Dispose() + If Opcion > 0 Then + Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) + End If + BtnsFacturar.Visible = False + BtnGenerarRemision.Visible = False + End If + End If + UPPCreditoDisponible.Update() + 'Puede hacer pedido If CveVenta <= 0 Then If Not UsuarioActual.TienePermisoProceso(177) Then @@ -20830,7 +20892,7 @@ Partial Class Ventas End If Case 2 'CONTADO - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") Or (UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 And DdlTipoComprobante.SelectedValue = "Cot") Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") OrElse (UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 And DdlTipoComprobante.SelectedValue = "Cot") OrElse (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Cot" AndAlso Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then DivContado.Visible = True If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then DivTransferencia.Visible = False @@ -21195,6 +21257,12 @@ Partial Class Ventas saldo = TxtTotal.Text.Replace(",", "").ToDouble - abonado 'CVImporteContado.ValueToCompare = (saldo.FormatoNumero(2).ToDouble).ToString() + If (Not UsuarioActual.CveEmpresa.Contiene(119, 158)) AndAlso Me.CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Cot" AndAlso Not ValidaPagosContado(MostrarAlertas:=False) Then + VerificarBtnFacturarCotizacion(DdlVendedor.SelectedValue.ToEntero(), MostrarGenerarRemision:=False) + + UpFacturar.Update() + End If + CargaGridContado() UpContado.Update() @@ -21202,7 +21270,7 @@ Partial Class Ventas Private Sub RBLPago_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RBLPago.SelectedIndexChanged LimpiaEscondeContado() End Sub - Private Function ValidaPagosContado() As Boolean + Private Function ValidaPagosContado(Optional MostrarAlertas As Boolean = True) As Boolean Dim Retorno = False Dim AmortizacionNC As Decimal = 0 @@ -21222,7 +21290,10 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso CveVenta <= 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then If Not PermiteCredito AndAlso Not TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then - Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia) + If MostrarAlertas Then + Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia) + End If + Retorno = True Return Retorno End If @@ -21231,7 +21302,10 @@ Partial Class Ventas Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + AmortizacionNC If TotalPago < TxtTotal.Text.ToDecimal Then - Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia) + If MostrarAlertas Then + Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia) + End If + Retorno = True Return Retorno End If @@ -21242,7 +21316,10 @@ Partial Class Ventas 'SI TIENE SALDO PENDIENTE VALIDA SI TIENE PAGOS If Me.SaldoVenta > 0 Then If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso (UsuarioActual.Empresa.Funcionalidad(531) = "1") AndAlso (Not PermiteCredito) AndAlso Not TienePagos And TxtTotal.Text.ToDecimal > 0 Then - Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia) + If MostrarAlertas Then + Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia) + End If + Retorno = True End If @@ -21252,7 +21329,10 @@ Partial Class Ventas Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + AmortizacionNC If TotalPago < TxtTotal.Text.ToDecimal Then - Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia) + If MostrarAlertas Then + Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia) + End If + Retorno = True Return Retorno End If @@ -21264,18 +21344,27 @@ Partial Class Ventas Dim TotalNC As Decimal = If((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0), LblTotalAPagar.Text.Trim().ToDecimal(), 0) If TotalNC > 0 Then If (DtPagos.SUM("Importe").ToString().ToDecimal() + AmortizacionNC + Total - TxtCambio.Text.ToDecimal) > TotalNC Then - Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) + If MostrarAlertas Then + Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) + End If + Retorno = True End If Else If (DtPagos.SUM("Importe").ToString().ToDecimal() + AmortizacionNC + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then - Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) + If MostrarAlertas Then + Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) + End If + Retorno = True End If End If Else If (DtPagos.SUM("Importe").ToString().ToDecimal() + AmortizacionNC + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then - Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) + If MostrarAlertas Then + Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) + End If + Retorno = True End If End If @@ -28265,7 +28354,9 @@ Partial Class Ventas TxtTotal.Attributes("readonly") = "readonly" RBLPago.Enabled = True - RBLPago.Items(0).Enabled = True + If Me.PermiteCredito Then + RBLPago.Items(0).Enabled = True + End If GvImpuestosLocales2.Enabled = True