From ac4bb271a73b210183750ba989d22dfb4478a9f0 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 28 Feb 2024 11:05:30 -0700 Subject: [PATCH 1/4] --Pago con devoluciones --- Ventas/Ventas.aspx | 4 +- Ventas/Ventas.aspx.vb | 167 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 147 insertions(+), 24 deletions(-) diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 65aa3a9ca..1dcf43f65 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -1613,7 +1613,7 @@ Amort. Ant.: -   +   @@ -10247,7 +10247,7 @@ $get("HdnTipoDescuento").value = "3"; //si es con.nc,es.el.total - var Total = ToDouble($get(TipoAnticipo == 2 ? 'TxtTotal' : 'TxtSubTotal').value); + var Total = ToDouble($get((TipoAnticipo == 2 || TipoAnticipo == 4) ? 'TxtTotal' : 'TxtSubTotal').value); var SaldoCompra = parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2)); if (ToDouble($get('HdnCveVenta').value) == 0) SaldoCompra = Total; diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index d0c65fca6..5636dd9da 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -157,6 +157,15 @@ Partial Class Ventas End Set End Property + Private Property TmpDTAnticiposNCIxCCliente As DataTable + Get + Return If(IsNothing(ViewState("TmpDTAnticiposNCIxCCliente")), Nothing, CType(ViewState("TmpDTAnticiposNCIxCCliente"), DataTable)) + End Get + Set(value As DataTable) + ViewState("TmpDTAnticiposNCIxCCliente") = value + End Set + End Property + Private Property TmpDTError As DataTable Get Return If(IsNothing(ViewState("TmpDTError")), Nothing, CType(ViewState("TmpDTError"), DataTable)) @@ -2572,7 +2581,7 @@ Partial Class Ventas ImgDescTotal.Visible = False ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';") - ImgAntiPend.Attributes.Add("onclick", "$get('HdnTipoDescuento').value = '3'; MuestraAnticipos();") + 'ImgAntiPend.Attributes.Add("onclick", "$get('HdnTipoDescuento').value = '3'; MuestraAnticipos();") ImgOtrosConceptos.Attributes.Add("onclick", "javascript:$('#ModalOtrosConceptos').modal();") 'LkbAgregarComplementos.Attributes.Add("onclick", "javascript:$('#ModalComplementos').modal();") 'ImgCerrar.Attributes.Add("OnClick", "$('#DivAnticipos').hide();") @@ -3532,11 +3541,11 @@ Partial Class Ventas Private Sub ValidaUsuarioAcceso() 'VERIFICAR SI LA SESION SE ENCUENTRA BLOQUEADA If UsuarioActual.Empresa.Funcionalidad(599) = "1" Then - Dim DrUsuario As DataRow = GlobalDTUsuarios(CveUsuario:=UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0) + Dim DrUsuario As DataRow = GlobalDTUsuarios(CveUsuario:=UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("") - If DrUsuario("CodigoAcceso").ToString() <> "" Then + If DrUsuario IsNot Nothing AndAlso DrUsuario("CodigoAcceso").ToString() <> "" Then If UsuarioActual.SesionBloqueada Then - DivBloqueoacceso.Visible = False + DivBloqueoAcceso.Visible = False Dim strScript As New StringBuilder strScript.Append("window.onload = function MuestraBloqueo() { document.getElementById(""C_BtnShowBloqueoAcceso"").click(); setTimeout(function(){ $('#C_TxtCodigoAcceso').focus(); ") If UsuarioActual.ErrorDesbloqueo Then @@ -3553,10 +3562,10 @@ Partial Class Ventas BtnEmitirImprimir.Visible = False Exit Sub Else - DivBloqueoacceso.Visible = True + DivBloqueoAcceso.Visible = True End If Else - DivBloqueoacceso.Visible = False + DivBloqueoAcceso.Visible = False End If Else DivBloqueoacceso.Visible = False @@ -14777,6 +14786,11 @@ Partial Class Ventas Next Else + + 'If DdlTipoAmortizacionAnticipo.SelectedValue <> "4" Then + + 'End If + For Each row2 As GridViewRow In GVAnticipos.Rows If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 12 Then @@ -15362,6 +15376,49 @@ Partial Class Ventas End If End If + + 'If Not ErrorPrepoliza AndAlso UsuarioActual.Empresa.Funcionalidad(109) = "1" AndAlso ObjFactura.TipoDocto = "Ing" AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "4" AndAlso ObjFactura.CveMoneda = 1 Then + + ' For Each row2 As GridViewRow In GVAnticipos.Rows + ' If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 12 Then + ' If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then + + ' importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal) + + ' Dim ImporteAnticipo As Decimal = importeMovimiento + ' Dim CveMonedaAnticipo As Integer = row2.DataKey("CveMoneda").ToString().ToEntero() + + ' Dim ObjFacturaRef As New Modelos.Factura(UsuarioActual, row2.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa, CargaDTDetalle:=False, VerificaAlmacen:=False, CargaDatosCliente:=False, CargaDatosRelacionados:=False) + + ' Dim ventaRef As New Venta(ObjFacturaRef, UsuarioActual) + + ' ObjFacturaRef.Dispose() + + ' If ventaRef.TipoDocto = "Dev" Then + ' Dim Pago As New VentaPago + ' Pago.Fecha = ObjFactura.Fecha + ' Pago.FechaDocumentoRelacionado = ObjFactura.Fecha + ' Pago.ImportePagoVenta = importeMovimiento + ' Pago.ImportePago = importeMovimiento + ' Pago.CveMonedaPago = ObjFactura.CveMoneda + ' Pago.TCPago = ObjFactura.TipoCambio + ' Pago.TipoPago = "NC" + ' Pago.CveVentaAmortizacion = ObjFactura.CveVenta 'Dr("CveVenta").ToString().ToEntero() + ' Pago.AplicaTraslado = False + ' Pago.Referencia = Concepto + ' 'Pago.CveConceptoPago = 251 + ' ErrorPrepoliza = AplicaPrePolizaPagoVenta(ventaRef, Pago, ObjFactura.CvePrePoliza, ObjConta) + + ' Else + ' ErrorPrepoliza = True + ' ErrorList.Add("No se puede aplicar un documento diferente a una devolución") + ' End If + + ' End If + ' End If + ' Next + 'End If + If ObjConta.ValidacionesPrePoliza(ObjFactura.CvePrePoliza, UsuarioActual, Opcion:=2, AutoConta:=AutoConta) Then If ObjConta.ValorPolizaDescuadre > 0 Then If ObjConta.ValorPolizaDescuadre = 2 Then @@ -16046,7 +16103,9 @@ Partial Class Ventas Dim ObjMovtos As New ClsMovimientos() If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then - Dim DtMovtos As DataTable = ObjMovtos.DtResultados.FiltraParametros($"Saldo > 0 AND SaldoSubtotal > 0 {If(CveVenta < 0, $"AND Tipo = 'Ant' ", "")} {If(DdlTipoComprobante.SelectedValue = "Ant", "AND Tipo = 'NC'", "")}") + Me.TmpDTAnticiposNCIxCCliente = ObjMovtos.DtResultados.Copy() + Dim DtMovtos As DataTable = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"Saldo > 0 AND SaldoSubtotal > 0 {If(CveVenta < 0, $"AND Tipo = 'Ant' ", "")} {If(DdlTipoComprobante.SelectedValue = "Ant", "AND Tipo = 'NC'", "")}") + If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) Then DtMovtos = DtMovtos.FiltraParametros($"{If(CveVenta < 0, $"Tipo = 'Ant'{If(DdlTipoComprobante.SelectedValue = "Ing", $" AND CveMoneda ={DdlMoneda.SelectedValue.ToEntero()}", "")} ", "")}") End If @@ -16153,7 +16212,7 @@ Partial Class Ventas saldo = e.Row.DataKey("Saldo").ToString().ToDecimal If CveVenta <= 0 Then - If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then 'cuando es por NC, debe de tomar el total de su saldo respectivo + If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("2") Then 'cuando es por NC, debe de tomar el total de su saldo respectivo saldo = e.Row.DataKey("SaldoConImpuestos").ToString().ToDecimal Else saldo = e.Row.DataKey("SaldoSubTotal").ToString().ToDecimal @@ -16165,6 +16224,10 @@ Partial Class Ventas e.Row.FCLiteral("LtlAnticipos").Text = saldo.FormatoNumero End If + If CveVenta <= 0 AndAlso DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("4") Then + saldo = e.Row.DataKey("Saldo").ToString().ToDecimal + End If + End If saldo = saldo.RoundSQL() @@ -16458,7 +16521,7 @@ Partial Class Ventas 'cuando no se ha registrado la venta - If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("1", "2", "3") Then + If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("1", "2", "3", "4") Then Dim Amortizacion As Decimal = 0 Dim ImpuestosLocalesTemporal As Decimal = 0 @@ -16604,6 +16667,27 @@ Partial Class Ventas HdnTieneAnticiposVinculados.Value = "1" End If + + + 'cuando es PAGO CON DEVOLUCION + If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then + + 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(12) 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) + End If + Next + + LblAntAplicados.Text = String.Format("Pago con devolución: {0:C}", Amortizacion) : LblAntAplicados.Visible = True + HdnAnticipos.Value = Amortizacion.RoundSQL(2).ToString() + Amortizacion = 0 + HdnTipoDescuento.Value = "-1" + HdnDescuento.Value = "0" + RegistraScript("BorraDescuentos();") + HdnTieneAnticiposVinculados.Value = "1" + End If + + CalculaTotalesVenta(ValidarDescuentos:=True) End If End If @@ -21497,22 +21581,24 @@ Partial Class Ventas Exit Sub End If - Dim ObjContrato As New ClsContratos - If ObjContrato.GetEstimacionesPorFacturar(-1, CveCliente, DdlContrato.SelectedValue.ToEntero(), 0, UsuarioActual.CveEmpresa) Then - GvEst.DataSource = ObjContrato.DtResultados - If ObjContrato.DtResultados.Rows.Count > 0 Then - 'BtnEstimacion.Visible = True - DdlContrato.Items.Clear() - DdlContrato.Items.Add(New ListItem("Todos", "-1")) - DdlContrato.DataSource = ObjContrato.DtResultados.FiltraParametros("CveContrato > 0", "NumeroContrato", DistinctColumns:={"CveContrato", "NumeroContrato"}) + If DdlContrato.SelectedValue.ToEntero() > 0 Then + Dim ObjContrato As New ClsContratos + If ObjContrato.GetEstimacionesPorFacturar(-1, CveCliente, DdlContrato.SelectedValue.ToEntero(), 0, UsuarioActual.CveEmpresa) Then + GvEst.DataSource = ObjContrato.DtResultados + If ObjContrato.DtResultados.Rows.Count > 0 Then + 'BtnEstimacion.Visible = True + DdlContrato.Items.Clear() + DdlContrato.Items.Add(New ListItem("Todos", "-1")) + DdlContrato.DataSource = ObjContrato.DtResultados.FiltraParametros("CveContrato > 0", "NumeroContrato", DistinctColumns:={"CveContrato", "NumeroContrato"}) + End If End If + + ObjContrato.Dispose() + + DdlContrato.DataBind() + GvEst.DataBind() End If - ObjContrato.Dispose() - - DdlContrato.DataBind() - GvEst.DataBind() - UPEstimaciones.Update() End Sub @@ -30494,6 +30580,22 @@ Partial Class Ventas divAnticipoMsg.Visible = False + If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + If DdlTipoComprobante.SelectedValue = "Ing" AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then + Dim DtMovtos As DataTable = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"Saldo > 0 And SaldoSubtotal > 0 {If(CveVenta < 0, $"AND Tipo = 'NC' ", "")}") + divAmortizacionTipoRelacion.Visible = False + GVAnticipos.DataSource = DtMovtos + GVAnticipos.DataBind() + Else + Dim DtMovtos As DataTable = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"Saldo > 0 AND SaldoSubtotal > 0 {If(CveVenta < 0, $"AND Tipo = 'Ant' ", "")} {If(DdlTipoComprobante.SelectedValue = "Ant", "AND Tipo = 'NC'", "")}") + divAmortizacionTipoRelacion.Visible = True + If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) Then + DtMovtos = DtMovtos.FiltraParametros($"{If(CveVenta < 0, $"Tipo = 'Ant'{If(DdlTipoComprobante.SelectedValue = "Ing", $" AND CveMoneda ={DdlMoneda.SelectedValue.ToEntero()}", "")} ", "")}") + End If + End If + End If + + If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("1", "2") Then 'cuando es amortización por descuento, debe tener seleccionado descuentos previamente registrados If DdlTipoAmortizacionAnticipo.SelectedValue = "1" AndAlso LblDescuentos.Text.ToDecimal <= 0 Then @@ -37207,5 +37309,26 @@ Partial Class Ventas End If End Using End Sub + Protected Sub ImgAntiPend_Click(sender As Object, e As EventArgs) + ' $get('HdnTipoDescuento').value = '3'; MuestraAnticipos(); + HdnTipoDescuento.Value = "3" + + If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + If DdlTipoAmortizacionAnticipo.Items.FindByValue("4") Is Nothing Then + DdlTipoAmortizacionAnticipo.Items.Insert(1, New ListItem("Pago con devolución", "4")) + End If + DdlTipoAmortizacionAnticipo.SelectedValueExist("4") + + DdlTipoRelacionAnticipo.SelectedValueExist("-1") + + DdlTipoAmortizacionAnticipo_SelectedIndexChanged(DdlTipoAmortizacionAnticipo, EventArgs.Empty) + + divAmortizacionTipoRelacion.Visible = False + End If + + UpAnticipos.Update() + + RegistraScript("MuestraAnticipos();", "AE") + End Sub End Class From 8420af01e6541940b3647433e90831476caade04 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 27 Feb 2024 20:25:43 -0700 Subject: [PATCH 2/4] SMS 2024.02.26 --- App_Code/ClsInventarios.vb | 3 +- Ashx/SIGWeb.ashx | 3 +- General/SaldosIniciales.aspx.vb | 22 +++++-- Scripts/custom.js | 3 +- Ventas/Ventas.aspx.vb | 107 ++++++++++++++++++++------------ 5 files changed, 89 insertions(+), 49 deletions(-) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index fcef9ea54..fd07547a1 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -2178,7 +2178,7 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetExistenciasProductosLike(PS As String, CveClasificacion As Integer, CveSubProyecto As Integer, Estatus As Integer, AplicaParaVenta As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional MostrarTodosAlmacenes As Boolean = False) As Boolean + Public Function GetExistenciasProductosLike(PS As String, CveClasificacion As Integer, CveSubProyecto As Integer, Estatus As Integer, AplicaParaVenta As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional MostrarTodosAlmacenes As Boolean = False, Optional CveAlmacen As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_ProductosServiciosInventario") @@ -2191,6 +2191,7 @@ Public Class ClsInventarios .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveMarca", SqlDbType.Int).Value = CveMarca .Add("@MostrarTodosAlmacenes", SqlDbType.Bit).Value = MostrarTodosAlmacenes + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen End With Try diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index afd2898b0..9d6cd2c89 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -927,6 +927,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Dim UsoClasificacion = IfNull(context.Request("usoclasificacion"), "-1").ToString.ToEntero Dim AplicaParaVenta = IfNull(context.Request("aplicaparaventa"), "1").ToString.ToEntero Dim CveMarca = IfNull(context.Request("cvemarca"), "-1").ToString.ToEntero + Dim CveAlmacen = IfNull(context.Request("cvealmacen"), "-1").ToString.ToEntero Dim UsaGlobal As Boolean = True Dim MostrarTodosAlmacenes As Boolean = False @@ -941,7 +942,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Dim objInv As New ClsInventarios Try - If objInv.GetExistenciasProductosLike(Name, CveClasificacion, CveSubProyecto, Estatus.ToEntero, AplicaParaVenta, CveEmpresa, CveMarca, MostrarTodosAlmacenes:=MostrarTodosAlmacenes) Then + If objInv.GetExistenciasProductosLike(Name, CveClasificacion, CveSubProyecto, Estatus.ToEntero, AplicaParaVenta, CveEmpresa, CveMarca, MostrarTodosAlmacenes:=MostrarTodosAlmacenes, CveAlmacen:=CveAlmacen) Then ' limpio los almacenes donde no tiene ningun producto existencia diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 618cb935f..21187f697 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -1627,6 +1627,12 @@ Partial Class General_SaldosIniciales TotalDetalles = (CantidadDetalle * PUDetalle) + IVA - RetIVA - RetISR + IEPSDetalle End If + If Math.Abs(TotalDetalles - Total) > 0.01 Then + ErrorCompras = True + Alert($"Registro {CountRow} El total no councide con el calculo de los detalles, total: {Total.ToString("###,###,###.00")} calculo detatalles: {TotalDetalles.ToString("###,###,###.00")}", TipoMensaje.MsgAdvertencia) + Exit For + End If + If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, CveSubProyecto, -1, 0, CantidadDetalle, PUDetalle, (CantidadDetalle * PUDetalle) * PorcentajeIVA, TotalDetalles, 0, "Carga Inicial", -1, IVAPorcentaje:=PorcentajeIVA, RetIVAPorcentaje:=RetIVAPorcentaje, RetISRPorcentaje:=RetISRPorcentaje, IEPSPS:=IEPSDetalle) Then ErrorCompras = True Exit For @@ -1756,6 +1762,7 @@ Partial Class General_SaldosIniciales Dim FolioFiscal As String = If(dt.Columns.Contains("Folio Fiscal"), Row("Folio Fiscal").ToString(), "") Dim PorcentajeIVA As Decimal = If(dt.Columns.Contains("PorcentajeIVA"), Round(Row("PorcentajeIVA").ToString().ToDecimal, 4), 0) Dim PorcentajeRetIVA As Decimal = If(dt.Columns.Contains("PorcentajeRetIVA"), Round(Row("PorcentajeRetIVA").ToString().ToDecimal, 4), 0) + Dim PorcentajeRetISR As Decimal = If(dt.Columns.Contains("PorcentajeRetISR"), Round(Row("PorcentajeRetISR").ToString().ToDecimal, 4), 0) Dim PedidoContrato As String = If(dt.Columns.Contains("Pedido"), Row("Pedido").ToString(), "") @@ -1882,9 +1889,14 @@ Partial Class General_SaldosIniciales TotalDetalles = (CantidadDetalle * PUDetalle) + IVA - RetIVA - RetISR + IEPSDetalle End If + If Math.Abs(TotalDetalles - Total) > 0.01 Then + ErrorVentas = True + Alert($"Registro {CountRow} El total no councide con el calculo de los detalles, total: {Total.ToString("###,###,###.00")} calculo detatalles: {TotalDetalles.ToString("###,###,###.00")}", TipoMensaje.MsgAdvertencia) + Exit For + End If If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, CantidadDetalle, CveUnidadMedida, PUDetalle * CantidadDetalle, IVADetalle, TotalDetalles, "Saldo Inicial", 0, 0, Sucursal.ToEntero(), 0, - PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA, IEPS:=IEPSDetalle) Then + PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA, IEPS:=IEPSDetalle, PorcentajeRetISR:=PorcentajeRetISR) Then ErrorVentas = True Exit For End If @@ -1926,12 +1938,12 @@ Partial Class General_SaldosIniciales 'If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, Folio.ToString(), 38, String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=IEPS) Then ErrorVentas = True : Exit For If RetIVA > 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetIVA, RetIVA, 8, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetIVA, RetIVA, 8, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeRetIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For End If - 'If RetISR > 0 Then - ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetISR, RetISR, 9, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=Porce, Contabilizable:=False) Then ErrorVentas = True : Exit For - 'End If + If RetISR > 0 Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetISR, RetISR, 9, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeRetISR, Contabilizable:=False) Then ErrorVentas = True : Exit For + End If If ImpuestoLocal > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImpuestoLocal, ImpuestoLocal, 27, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For diff --git a/Scripts/custom.js b/Scripts/custom.js index bf0f194b8..5f92540ff 100644 --- a/Scripts/custom.js +++ b/Scripts/custom.js @@ -1274,7 +1274,8 @@ function setwebservice(idDdlWS, idhdValue, idhdText, btn) { aplicaparaventa: (!(DdlWS.data('aplicaparaventa')) || DdlWS.data('aplicaparaventa') == '') ? -1 : DdlWS.data('aplicaparaventa'), cvemarca: (!(DdlWS.data('cvemarca')) || DdlWS.data('cvemarca') == '') ? -1 : DdlWS.data('cvemarca'), esdistribuidor: (!(DdlWS.data('esdistribuidor')) || DdlWS.data('esdistribuidor') == '') ? -1 : DdlWS.data('esdistribuidor'), - cveclienteclasificacion: (!(DdlWS.data('cveclienteclasificacion')) || DdlWS.data('cveclienteclasificacion') == '') ? -1 : DdlWS.data('cveclienteclasificacion') + cveclienteclasificacion: (!(DdlWS.data('cveclienteclasificacion')) || DdlWS.data('cveclienteclasificacion') == '') ? -1 : DdlWS.data('cveclienteclasificacion'), + cvealmacen: (!(DdlWS.data('cvealmacen')) || DdlWS.data('cvealmacen') == '') ? -1 : DdlWS.data('cvealmacen') //Metodo: metodo diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 5636dd9da..8bf412498 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2320,6 +2320,21 @@ Partial Class Ventas End Property + Public Property CveAlamcenFiltroDdl As Integer + Get + If ViewState("CveAlamcenFiltroDdl") Is Nothing Then + ViewState("CveAlamcenFiltroDdl") = -1 + End If + Return ViewState("CveAlamcenFiltroDdl").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveAlamcenFiltroDdl") = value + End Set + End Property + + + + #Region "VENTA MEDICA" Property EsVentaMedica As Boolean @@ -8049,8 +8064,16 @@ Partial Class Ventas Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas") Objeto.ddlWS.Attributes.Add("data-AplicaparaVenta", "1") End If + + If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then + Objeto.Attributes.Add("data-CveAlmacen", $"{CveAlamcenFiltroDdl}") + Objeto.ddlWS.Attributes.Add("data-CveAlmacen", $"{CveAlamcenFiltroDdl}") + End If + End If + + End Sub Private Sub CargaPSRemision(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost) @@ -13472,7 +13495,17 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso EsVentaMedica Then - CveAlmacenTraspasoDestino = CveAlmacenAsignado + If DdlSucursalCliente.SelectedValue.ToEntero > 0 Then + Dim objclientes As New ClsClientes + If objclientes.GetSucursales(CveCliente, -1) Then + CveAlmacenTraspasoDestino = objclientes.DtResultados.FiltroPrimeroValor("CveAlmacenAsignado", $" CveClienteSucursal = {DdlSucursalCliente.SelectedValue.ToEntero}").ToEntero + End If + objclientes.Dispose() + End If + + If Not CveAlmacenTraspasoDestino > 0 Then + CveAlmacenTraspasoDestino = CveAlmacenAsignado + End If If RBLTipoVenta.SelectedValue.ToEntero = 2 Then If Not ChkRequiereTecnico.Checked Then @@ -36627,34 +36660,6 @@ Partial Class Ventas End Sub - 'Private Sub CargaSucursalesModal(CveClienteSeleccionado As Integer) - - ' DdlSucursalClienteModal.Items.Clear() - ' DdlSucursalClienteModal.ClearSelection() - ' DdlSucursalClienteModal.SelectedValue = Nothing - - ' Dim ObjCliente As New ClsClientes - ' If ObjCliente.GetSucursales(CveClienteSeleccionado) Then - ' DdlSucursalClienteModal.DataSource = ObjCliente.DtResultados - ' If ObjCliente.DtResultados.Rows.Count > 0 Then - ' DvModalClientesucursal.Visible = True - ' Else - ' DvModalClientesucursal.Visible = False - ' End If - ' Else - ' DvModalClientesucursal.Visible = False - ' DdlSucursalClienteModal.DataSource = Nothing - ' End If - ' ObjCliente.Dispose() - - ' DdlSucursalClienteModal.DataBind() - ' DdlSucursalClienteModal.Items.Insert(0, New ListItem("Matriz", "-1")) - - ' UpDvModalTipoVenta.FindDataSourceControl - - 'End Sub - - Private Sub CargaDdlClientesSucursal() @@ -36751,13 +36756,6 @@ Partial Class Ventas UpDvModalTipoVenta.Update() End Sub - 'Protected Sub DdlClientesWS_selectedindexchange(sender As Object, e As EventArgs) - - ' CargaPSProcedimiento(DdlProcedimiento.SelectedValue.ToEntero, DdlClientesWS.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedValue.ToEntero) - ' 'CargaSucursalesModal(DdlClientesWS.SelectedValue.ToEntero) - - 'End Sub - Protected Sub DdlClienteSucursal_SelectedIndexChanged(sender As Object, e As EventArgs) Dim CveClienteSplit As Integer = -1 @@ -36821,9 +36819,7 @@ Partial Class Ventas ChkRequiereTecnicoModal.Enabled = True - 'DdlClientesWS.txtText.Value = "" - 'DdlClientesWS.txtValue.Value = "" - 'DdlClientesWS.ddl.SelectedValueExist(-1) + DdlClienteSucursal.SelectedValueExist(-1) DvModalRequiereOSFecha.Visible = False @@ -36885,8 +36881,6 @@ Partial Class Ventas End If End If - - For Each GvRow As GridViewRow In GvProductosProcedimiento.Rows Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidad").Text.ToDecimal Dim CveUnidadMedida As Integer = GvRow.DataKey("CveUnidadMedida").ToEntero @@ -36968,6 +36962,9 @@ Partial Class Ventas End If + + + DdlTipoComprobante.Enabled = False CargaCliente(CveCliente) @@ -37020,10 +37017,17 @@ Partial Class Ventas UpParametros.Update() End If + If RBLTipoVenta.SelectedValue.Contiene("5", "6") Then + AsignaAlamacenWS() + CargaPS(-1, DdlPS) + End If + RegistraScript("$('#DvModalTipoVenta').modal('hide');") UpCliente.Update() End Sub + + Protected Sub GvProductosProcedimiento_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DataKey("Precio").ToDecimal = 0 Then @@ -37183,6 +37187,27 @@ Partial Class Ventas CargaProcedimientos(HdnCveProcedimientoNuevo.Value.ToEntero) End Sub + Private Sub AsignaAlamacenWS() + + CveAlamcenFiltroDdl = -1 + + If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then + If DdlSucursalCliente.SelectedValue.ToEntero > 0 Then + Dim objclientes As New ClsClientes + If objclientes.GetSucursales(CveCliente, -1) Then + CveAlamcenFiltroDdl = objclientes.DtResultados.FiltroPrimeroValor("CveAlmacenAsignado", $" CveClienteSucursal = {DdlSucursalCliente.SelectedValue.ToEntero}").ToEntero + End If + objclientes.Dispose() + End If + If Not CveAlamcenFiltroDdl > 0 Then + CveAlamcenFiltroDdl = If(CveAlmacenAsignado > 0, CveAlmacenAsignado, -1) + End If + + End If + + End Sub + + #End Region 'Protected Sub LnkCancelarSoloCFDI_Click(sender As Object, e As EventArgs) From 7f04e095df76ac2a543e326700758bf584d3a942 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Wed, 28 Feb 2024 17:57:42 -0700 Subject: [PATCH 3/4] =?UTF-8?q?SMS=20-=202024.02.22=20Retro=20Os=20Folio?= =?UTF-8?q?=20Fiscal=20Adicional=20desde=20inicio=20y=20editable=20en=20os?= =?UTF-8?q?,=20Ventas=20llevarse=20campo=20alfa1=20(Folio=20remisi=C3=B3n?= =?UTF-8?q?=20=20es=20el=20Folio=20adicional=20de=20la=20os)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsOS.vb | 7 +++++-- App_Code/ClsPaginas.vb | 1 + Empresas/186/Formatos/Factura.mrt | 6 ++++-- OS/OrdenesServicios.aspx | 2 +- OS/OrdenesServicios.aspx.vb | 16 ++++++++++------ Ventas/Ventas.aspx.vb | 10 +++++++++- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/App_Code/ClsOS.vb b/App_Code/ClsOS.vb index a36292b85..1f1c44696 100644 --- a/App_Code/ClsOS.vb +++ b/App_Code/ClsOS.vb @@ -652,7 +652,7 @@ Public Class ClsOS CveUsuario As Integer, CveEmpresa As Integer, CveCotizacion As Integer, CveVenta As Integer, CveOSPadre As Integer, CveOSTipo As Integer, Optional CveClienteSucursal As Integer = -1, Optional Direccion As String = "-1", Optional Telefono As String = "", Optional CveModeloAuto As Integer = -1, Optional Año As String = "-1", Optional Correo As String = "", Optional Condiciones As String = "", Optional CveMedico As Integer = -1, Optional CveProcedimiento As Integer = -1, Optional CveTipoVenta As Integer = -1, Optional FechaCita As DateTime = MinFecha, - Optional Paciente As String = "-1", Optional IdentificadorCliente As String = "-1") As Boolean + Optional Paciente As String = "-1", Optional IdentificadorCliente As String = "-1", Optional FolioAdicional As String = "-1") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OS_OrdenesServiciosAdd") @@ -686,6 +686,8 @@ Public Class ClsOS .Add("@Paciente", SqlDbType.VarChar).Value = Paciente .Add("@IdentificadorCliente", SqlDbType.VarChar).Value = IdentificadorCliente + .Add("@FolioAdicional", SqlDbType.VarChar).Value = FolioAdicional + .Add("@CveOS", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output @@ -732,7 +734,7 @@ Public Class ClsOS CveOSTipo As Integer, Optional CveClienteSucursal As Integer = -1, Optional Direccion As String = "-1", Optional Telefono As String = "", Optional CveModeloAuto As Integer = -1, Optional Año As String = "-1", Optional CveSubProyecto As Integer = -1, Optional Correo As String = "-1", Optional Condiciones As String = "", Optional CveMedico As Integer = -1, Optional CveProcedimiento As Integer = -1, Optional CveTipoVenta As Integer = -1, Optional FechaCita As DateTime = MinFecha, - Optional Paciente As String = "-1", Optional IdentificadorCliente As String = "-1") As Boolean + Optional Paciente As String = "-1", Optional IdentificadorCliente As String = "-1", Optional FolioAdicional As String = "-1") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OS_OrdenesServiciosUpdate") @@ -761,6 +763,7 @@ Public Class ClsOS .Add("@FechaCita", SqlDbType.DateTime).Value = FechaCita .Add("@Paciente", SqlDbType.VarChar).Value = Paciente .Add("@IdentificadorCliente", SqlDbType.VarChar).Value = IdentificadorCliente + .Add("@FolioAdicional", SqlDbType.VarChar).Value = FolioAdicional End With diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index cc4a19bb2..b433d440c 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -7020,6 +7020,7 @@ Public Class ClsPaginas params.Add(New ReportParameter("FechaCirugia", Vta.FechaEjecucion.ToString("dd/MM/yyyy HH:mm"))) params.Add(New ReportParameter("Paciente", Vta.Paciente)) params.Add(New ReportParameter("Episodio", Vta.Episodio)) + params.Add(New ReportParameter("Alfa1", Vta.Alfa1)) End If 'VSH diff --git a/Empresas/186/Formatos/Factura.mrt b/Empresas/186/Formatos/Factura.mrt index 944b3ad49..dc5dbf634 100644 --- a/Empresas/186/Formatos/Factura.mrt +++ b/Empresas/186/Formatos/Factura.mrt @@ -85,7 +85,7 @@ - + ReportParameters,ClienteCodigo,ClienteCodigo,ReportParameter1,System.String,,False,False,True,False,_x003C__x003F_xml_x0020_version_x003D__x0022_1.0_x0022__x0020_encoding_x003D__x0022_utf-16_x0022__x0020_standalone_x003D__x0022_yes_x0022__x003F__x003E__x003C_StiSerializer_x0020_version_x003D__x0022_1.02_x0022__x0020_type_x003D__x0022_Net_x0022__x0020_application_x003D__x0022_State_x0022__x003E__x003C_SortDirection_x003E_None_x003C__x002F_SortDirection_x003E__x003C_BindingVariable_x0020_isNull_x003D__x0022_true_x0022__x0020__x002F__x003E__x003C_Keys_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_Values_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_CheckedStates_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C__x002F_StiSerializer_x003E_,_x0035_4a879e0a10d464ba2f01e0372efb9ca ReportParameters,ClienteTelefono,ClienteTelefono,ReportParameter1,System.String,,False,False,True,False,,_x0036_22a3a61b2f247a6ab5d7dc6c66568db ReportParameters,ClienteContacto,ClienteContacto,ReportParameter1,System.String,,False,False,True,False,,_x0035_c52eccfce4d4681a1c62017e690c7c1 @@ -179,6 +179,7 @@ ReportParameters,FechaCirugia,FechaCirugia,,System.String,,False,False,True,False,_x003C__x003F_xml_x0020_version_x003D__x0022_1.0_x0022__x0020_encoding_x003D__x0022_utf-16_x0022__x0020_standalone_x003D__x0022_yes_x0022__x003F__x003E__x003C_StiSerializer_x0020_version_x003D__x0022_1.02_x0022__x0020_type_x003D__x0022_Net_x0022__x0020_application_x003D__x0022_State_x0022__x003E__x003C_SortDirection_x003E_None_x003C__x002F_SortDirection_x003E__x003C_BindingVariable_x0020_isNull_x003D__x0022_true_x0022__x0020__x002F__x003E__x003C_Keys_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_Values_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_CheckedStates_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_DateTimeType_x003E_DateAndTime_x003C__x002F_DateTimeType_x003E__x003C__x002F_StiSerializer_x003E_,_x0039_11bc963c59b4b6cb4b0ce36a86c40e1 ReportParameters,Paciente,Paciente,ReportParameter1,System.String,,False,False,True,False,_x003C__x003F_xml_x0020_version_x003D__x0022_1.0_x0022__x0020_encoding_x003D__x0022_utf-16_x0022__x0020_standalone_x003D__x0022_yes_x0022__x003F__x003E__x003C_StiSerializer_x0020_version_x003D__x0022_1.02_x0022__x0020_type_x003D__x0022_Net_x0022__x0020_application_x003D__x0022_State_x0022__x003E__x003C_SortDirection_x003E_None_x003C__x002F_SortDirection_x003E__x003C_BindingVariable_x0020_isNull_x003D__x0022_true_x0022__x0020__x002F__x003E__x003C_Keys_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_Values_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_CheckedStates_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_DateTimeType_x003E_DateAndTime_x003C__x002F_DateTimeType_x003E__x003C_CheckedColumn_x003E_null_x003B__x003C__x002F_CheckedColumn_x003E__x003C__x002F_StiSerializer_x003E_ ReportParameters,Episodio,Episodio,ReportParameter1,System.String,,False,False,True,False,_x003C__x003F_xml_x0020_version_x003D__x0022_1.0_x0022__x0020_encoding_x003D__x0022_utf-16_x0022__x0020_standalone_x003D__x0022_yes_x0022__x003F__x003E__x003C_StiSerializer_x0020_version_x003D__x0022_1.02_x0022__x0020_type_x003D__x0022_Net_x0022__x0020_application_x003D__x0022_State_x0022__x003E__x003C_SortDirection_x003E_None_x003C__x002F_SortDirection_x003E__x003C_BindingVariable_x0020_isNull_x003D__x0022_true_x0022__x0020__x002F__x003E__x003C_Keys_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_Values_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_CheckedStates_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_DateTimeType_x003E_DateAndTime_x003C__x002F_DateTimeType_x003E__x003C_CheckedColumn_x003E_null_x003B__x003C__x002F_CheckedColumn_x003E__x003C__x002F_StiSerializer_x003E_ + ReportParameters,Alfa1,Alfa1,ReportParameter1,System.String,,False,False,True,False,_x003C__x003F_xml_x0020_version_x003D__x0022_1.0_x0022__x0020_encoding_x003D__x0022_utf-16_x0022__x0020_standalone_x003D__x0022_yes_x0022__x003F__x003E__x003C_StiSerializer_x0020_version_x003D__x0022_1.02_x0022__x0020_type_x003D__x0022_Net_x0022__x0020_application_x003D__x0022_State_x0022__x003E__x003C_SortDirection_x003E_None_x003C__x002F_SortDirection_x003E__x003C_BindingVariable_x0020_isNull_x003D__x0022_true_x0022__x0020__x002F__x003E__x003C_Keys_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_Values_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_CheckedStates_x0020_isList_x003D__x0022_true_x0022__x0020_count_x003D__x0022_0_x0022__x0020__x002F__x003E__x003C_DateTimeType_x003E_DateAndTime_x003C__x002F_DateTimeType_x003E__x003C_CheckedColumn_x003E_null_x003B__x003C__x002F_CheckedColumn_x003E__x003C__x002F_StiSerializer_x003E_ EngineV2 @@ -1488,7 +1489,8 @@ Sello digital del SAT: Paciente: {Paciente} -Episodio: {Episodio} +Episodio: {Episodio} +Folio Remisión: {Alfa1} Black Expression diff --git a/OS/OrdenesServicios.aspx b/OS/OrdenesServicios.aspx index 9473ff5d1..631c7fad0 100644 --- a/OS/OrdenesServicios.aspx +++ b/OS/OrdenesServicios.aspx @@ -297,7 +297,7 @@
- +
diff --git a/OS/OrdenesServicios.aspx.vb b/OS/OrdenesServicios.aspx.vb index c287ceff2..ac79814f3 100644 --- a/OS/OrdenesServicios.aspx.vb +++ b/OS/OrdenesServicios.aspx.vb @@ -473,7 +473,7 @@ Partial Class OS_OrdenesServicios DVFechaCita2.Visible = True DVEpisodioPaciente.Visible = True - + DivFolioAdicional.Visible = True DvTxtPacienteModal.Visible = True DvTxtEpisodioModal.Visible = True DvTxtFolioRemisionModal.Visible = True @@ -733,8 +733,8 @@ Partial Class OS_OrdenesServicios TxtPaciente.Text = ObjOS.Paciente TxtIdentificadorCliente.Text = ObjOS.IdentificadorCliente - LblFolioAdicional.Text = ObjOS.FolioAdicional - DivFolioAdicional.Visible = If(ObjOS.FolioAdicional.Trim.Length > 0, True, False) + TxtFolioAdicional.Text = ObjOS.FolioAdicional + @@ -1351,7 +1351,7 @@ Partial Class OS_OrdenesServicios UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCotizacion, -1, -1, DdlTipoOrdenOS.SelectedValue.ToEntero, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero, Direccion:=TxtDireccion.Text, Telefono:=TxtTelefono.Text, CveModeloAuto:=DdlModeloAuto.SelectedValue.ToEntero, Año:=TxtAnio.Text, CveMedico:=DdlMedico.SelectedValue.ToEntero, CveProcedimiento:=DdlProcedimiento.SelectedValue.ToEntero, CveTipoVenta:=DdlTipoVenta.SelectedValue.ToEntero, FechaCita:=FechaCita, - Paciente:=TxtPaciente.Text.Trim, IdentificadorCliente:=TxtIdentificadorCliente.Text.Trim) Then + Paciente:=TxtPaciente.Text.Trim, IdentificadorCliente:=TxtIdentificadorCliente.Text.Trim, FolioAdicional:=TxtFolioAdicional.Text.Trim) Then Errores = True End If CargaCliente(CveCliente) @@ -1455,7 +1455,7 @@ Partial Class OS_OrdenesServicios DdlTipoOrdenOS.SelectedValue.ToEntero, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero, Direccion:=TxtDireccion.Text, Telefono:=TxtTelefono.Text, CveModeloAuto:=DdlModeloAuto.SelectedValue.ToEntero, Año:=TxtAnio.Text, CveMedico:=DdlMedico.SelectedValue.ToEntero, CveProcedimiento:=DdlProcedimiento.SelectedValue.ToEntero, CveTipoVenta:=DdlTipoVenta.SelectedValue.ToEntero, FechaCita:=FechaCita, - Paciente:=TxtPaciente.Text.Trim, IdentificadorCliente:=TxtIdentificadorCliente.Text.Trim) Then + Paciente:=TxtPaciente.Text.Trim, IdentificadorCliente:=TxtIdentificadorCliente.Text.Trim, FolioAdicional:=TxtFolioAdicional.Text.Trim) Then For Each Row As DataRow In TmpDT.Rows If Not Errores Then Dim CvePS As Integer = Row("CvePS").ToString.ToEntero @@ -3037,7 +3037,10 @@ Partial Class OS_OrdenesServicios Select Case DdlTipoVenta.SelectedValue.ToEntero - Case 2, 3 + Case 1, 2 + Opcion = 1 + Exit Select + Case 3 ' por el momento ya no se usa Opcion = 2 Exit Select Case 5 @@ -3074,6 +3077,7 @@ Partial Class OS_OrdenesServicios If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then TxtPacienteModal.Text = TxtPaciente.Text TxtEpisodioModal.Text = TxtIdentificadorCliente.Text + TxtFolioRemisionModal.Text = TxtFolioAdicional.Text End If If DdlTipoVenta.SelectedValue.ToEntero = 5 Then diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 8bf412498..ae52c43a7 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -4936,6 +4936,13 @@ Partial Class Ventas End If End If + + + If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then + TxtAlfa1.Text = DbRowVenta("Alfa1").ToString + End If + + End Using End If @@ -36588,9 +36595,10 @@ Partial Class Ventas DdlProcedimiento.SelectedValueExist(dRow("CveProcedimiento").ToString.ToEntero) TxtPaciente.Text = dRow("Paciente").ToString TxtEpisodio.Text = dRow("Episodio").ToString - SeEstaFActurandoVentaMedica = True + TxtAlfa1.Text = dRow("Alfa1").ToString CveTipoVenta = dRow("CveTipoVenta").ToString.ToEntero ChkRequiereTecnico_CheckedChanged(Nothing, Nothing) + SeEstaFActurandoVentaMedica = True End If objVenta.Dispose() End If From c860d9fda599593fb1ac1ec6c459ea0a68af9987 Mon Sep 17 00:00:00 2001 From: AbrahamCastilloV Date: Wed, 28 Feb 2024 18:43:47 -0700 Subject: [PATCH 4/4] - --- App_Code/ClsContratos.vb | 3 +- Transportes/RepContratoDetalle.aspx | 87 +++++++- Transportes/RepContratoDetalle.aspx.vb | 292 ++++++++++++++++++------- Transportes/RepContratos.aspx | 47 +++- Transportes/RepContratos.aspx.vb | 57 ++++- 5 files changed, 387 insertions(+), 99 deletions(-) diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index 90de7ccc0..4846346b8 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -423,7 +423,7 @@ Public Class ClsContratos Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1.0, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, - Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = Nothing, Optional CveChofer As Integer = Nothing, Optional CveChofer2 As Integer = Nothing, Optional CveAF As Integer = Nothing, Optional CantidadPasajeros As Integer = Nothing, Optional CveRuta As Integer = Nothing, Optional CvePartida As Integer = Nothing, Optional CveDestino As Integer = Nothing, Optional CveMasivo As Integer = Nothing) As Boolean + Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = Nothing, Optional CveChofer As Integer = Nothing, Optional CveChofer2 As Integer = Nothing, Optional CveAF As Integer = Nothing, Optional CantidadPasajeros As Integer = Nothing, Optional CvePartida As Integer = Nothing, Optional CveDestino As Integer = Nothing, Optional CveMasivo As Integer = Nothing) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Con_ContratosUpdate") @@ -484,7 +484,6 @@ Public Class ClsContratos .Add("@CveChofer2", SqlDbType.Int).Value = CveChofer2 .Add("@CveAF", SqlDbType.Int).Value = CveAF .Add("@CantidadPasajeros", SqlDbType.Int).Value = CantidadPasajeros - .Add("@CveRuta", SqlDbType.Int).Value = CveRuta .Add("@CvePartida", SqlDbType.Int).Value = CvePartida .Add("@CveDestino", SqlDbType.Int).Value = CveDestino .Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo diff --git a/Transportes/RepContratoDetalle.aspx b/Transportes/RepContratoDetalle.aspx index 4a51e9570..895ad85c7 100644 --- a/Transportes/RepContratoDetalle.aspx +++ b/Transportes/RepContratoDetalle.aspx @@ -26,8 +26,8 @@ cursor: pointer; color: #45b6af; text-align: center; - font-weight:bold; - border-radius:5px; + font-weight: bold; + border-radius: 5px; } .disponible:hover, .disponible.activo { @@ -43,11 +43,11 @@ border: 2px solid #F3565D; background-color: #F3565D; margin: .1px; - cursor:no-drop; + cursor: no-drop; color: white; text-align: center; - font-weight:bold; - border-radius:5px; + font-weight: bold; + border-radius: 5px; } .nodisponible:hover { @@ -89,14 +89,15 @@ - + + <%-- Pestañas --%> <%-- Información General --%> - <%-- Datos del Contrato --%>
+ <%-- Datos del Contrato --%>
@@ -114,6 +115,7 @@
+
@@ -246,8 +248,45 @@
+ +
+
+ +
+ <%-- Contrato Digitalizado --%> +
+
+
+
+ +
+
+ Contrato Digitalizado +
+
+ +
+ Descargar + + + +
+
+
+
@@ -341,7 +380,6 @@ - <%-- Modal Editar Boleto --%> @@ -789,6 +827,39 @@ + <%--Modal subir archivo--%> + diff --git a/Transportes/RepContratoDetalle.aspx.vb b/Transportes/RepContratoDetalle.aspx.vb index f264985cc..99b9d0e52 100644 --- a/Transportes/RepContratoDetalle.aspx.vb +++ b/Transportes/RepContratoDetalle.aspx.vb @@ -1,6 +1,7 @@ Option Explicit On Option Strict On Imports System.Data +Imports System.IO Imports ADSNetLibrary.Helpers Imports ADSNetLibrary.SIGAPI.Helpers Imports Extensiones @@ -18,6 +19,22 @@ Partial Class RepContratoDetalle ViewState("CveContrato") = value End Set End Property + Private Property CveContratoTipo As Integer + Get + Return CType(ViewState("CveContratoTipo"), Integer) + End Get + Set(value As Integer) + ViewState("CveContratoTipo") = value + End Set + End Property + Private Property CveMasivo As Integer + Get + Return CType(ViewState("CveMasivo"), Integer) + End Get + Set(value As Integer) + ViewState("CveMasivo") = value + End Set + End Property Private Property CveViajePasajero As Integer Get Return CType(ViewState("CveViajePasajero"), Integer) @@ -60,6 +77,7 @@ Partial Class RepContratoDetalle End Property #End Region +#Region "Carga Página" Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Request("CveContrato") Is Nothing Then Response.Redirect($"~/Transportes/RepContratos.aspx") @@ -85,8 +103,11 @@ Partial Class RepContratoDetalle If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then Contrato = ObjContratos.DtResultados If Contrato IsNot Nothing AndAlso Contrato.Rows.Count > 0 Then + CveContratoTipo = Contrato.Rows(0)("CveContratoTipo").ToString.ToEntero SubProyecto = Contrato.Rows(0)("SubProyecto").ToString + CveMasivo = Contrato.Rows(0)("CveMasivo").ToString.ToEntero LbFolio.Text = Contrato.Rows(0)("NumeroContrato").ToString + LbCveSubProyecto.Text = Contrato.Rows(0)("CveSubProyecto").ToString DdlClientes.SelectedText = Contrato.Rows(0)("NombreComercial").ToString DdlClientes.SelectedValue = Contrato.Rows(0)("CveCliente").ToString TxtDescripcion.Text = Contrato.Rows(0)("DescripcionContrato").ToString @@ -99,6 +120,12 @@ Partial Class RepContratoDetalle TxtDolares.Text = Contrato.Rows(0)("Importe").ToString TxtPesos.Text = Contrato.Rows(0)("ImporteMax").ToString TxtAnticipo.Text = Contrato.Rows(0)("ImporteMin").ToString + If Not String.IsNullOrEmpty(Contrato.Rows(0)("Archivo").ToString) Then + BtnDescargar.Visible = True + LbArchivo.Text = Contrato.Rows(0)("Archivo").ToString + LbArchivo.Visible = True + ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "CONTRATOS", ObjContratos.Archivo) + End If 'Boletos Vendidos If Contrato.Rows(0)("CveContratoTipo").ToString() = "35" Then TabBoletos.Visible = True @@ -117,73 +144,133 @@ Partial Class RepContratoDetalle Response.Redirect($"~/Transportes/RepContratos.aspx") End If ObjContratos.Dispose() + End Sub - Protected Sub BtnCancelar_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - CveViajePasajero = GvRow.DataKey("CveViajePasajero").ToEntero - LbPartida.Text = GvRow.DataKey("Partida").ToString() - LbDestino.Text = GvRow.DataKey("Destino").ToString() - LbImporte.Text = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C") - LbNombre.Text = GvRow.DataKey("Nombre").ToString() - LbVisa.Text = GvRow.DataKey("Visa").ToString() - LbCelular.Text = GvRow.DataKey("Celular").ToString() - LbSexo.Text = GvRow.DataKey("Sexo").ToString() - LbObservacion.Text = GvRow.DataKey("Observacion").ToString() - LbEstatus.Text = GvRow.DataKey("Estatus").ToString() - LbCreado.Text = GvRow.DataKey("FechaIng").ToString() - TxtAsiento.Text = GvRow.DataKey("Asiento").ToString() - Dim Estatus As Boolean = Not LbEstatus.Text.ToBool - Dim ObjTransportes As New ClsTransportes +#End Region + +#Region "Información General" + Protected Sub GuardarArchivo(sender As Object, e As EventArgs) + Dim FileExtension As String = "-1" + Dim Filesgral As List(Of Archivo) = Anexo.getfiles().Archivos + Dim Filename As String = "" + Dim folderContratosPath As String = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos") + + If Not Directory.Exists(folderContratosPath) Then + Directory.CreateDirectory(folderContratosPath) + End If + + If Not Directory.Exists(Path.Combine(folderContratosPath, "Temp")) Then + Directory.CreateDirectory(Path.Combine(folderContratosPath, "Temp")) + End If + + For Each fileItem As Archivo In Filesgral + + FileExtension = IO.Path.GetExtension($"{AppDomain.CurrentDomain.BaseDirectory}Temp\{fileItem.filename}").Replace(".", "") + Session("FileExtension") = FileExtension + Dim tempArray() As String + tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) + + + ViewState("extencion") = FileExtension + ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos", "Temp", fileItem.filename) + + File.Move(fileItem.FileUrl, ViewState("FUrl").ToString) + TxtArchivo.Text = tempArray(1) + ' imgFileOk.Visible = True + 'ImgArchivo.Src = "/imagenes/accept.png" + Next + + UpTabContainer.Update() + RegistraScript("$('#ModalUpload').modal('hide')", "hidemodal1") + Button1.Visible = True + If Not FileExtension = "-1" Then + BtnDescargar.Visible = True + End If + UpdateContrato(sender, e) + End Sub + Protected Sub DescargarArchivo(sender As Object, e As EventArgs) + Dim File As New FileInfo(ViewState("FUrl").ToString) + + If File.Exists Then 'set appropriate headers + Response.Clear() + Response.ClearHeaders() + Response.ClearContent() + Response.AddHeader("Content-Disposition", "attachment; filename=" & LbFolio.Text & ".pdf") + Response.AddHeader("Content-Length", File.Length.ToString()) + 'Response.ContentType = "text/plain" + Response.ContentType = "application/octet-stream" + Response.Flush() + ' Response.TransmitFile(File.FullName) + Response.WriteFile(File.FullName) + Response.End() + 'if file does not exist + + Alert("Descargado Correctamente.", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrio un error al descargar el archivo", TipoMensaje.MsgAdvertencia, "window.close()") + + End If 'nothing in the URL as HTTP GET + End Sub + Protected Sub UpdateContrato(sender As Object, e As EventArgs) + Dim ObjContratos As New ClsContratos Try - ObjTransportes.IniciaTransacSQL() - - If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, CveContrato, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, LbNombre.Text, LbVisa.Text, LbCelular.Text, LbObservacion.Text, Estatus, UsuarioActual.CveUsuario, LbSexo.Text.ToBool) Then - Alert($"El boleto ha modificado el estatus de su boleto correctamente.") - - ObjTransportes.Commit() + If ObjContratos.UpdateContratos(CveContrato, LbFolio.Text, TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", LbCveSubProyecto.Text.ToEntero, -1, -1, -1, -1, LbArchivo.Text, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, -1) Then + Alert("Contrato actualizado correctamente") End If + ObjContratos.Commit() Catch ex As Exception - ObjTransportes.RollBack() - Alert($"No se pudo cambiar el estatus del boleto", TipoMensaje.MsgError) + Alert($"Ocurrió un ocurrió un error al actualizar su boleto", TipoMensaje.MsgError) + ObjContratos.RollBack() Finally - ObjTransportes.Dispose() + Alert("Contrato actualizado correctamente") + ObjContratos.Dispose() CargaDatos() End Try End Sub - Protected Sub CambiarBoleto(sender As Object, e As EventArgs) - DdlRuta.ClearSelection() - PnEditarViaje.Visible = True - PnEditarUsuario.Visible = False - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - - CveViajePasajero = GvRow.DataKey("CveViajePasajero").ToEntero - LbPartida.Text = GvRow.DataKey("Partida").ToString() - LbDestino.Text = GvRow.DataKey("Destino").ToString() - LbImporte.Text = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C") - LbNombre.Text = GvRow.DataKey("Nombre").ToString() - LbVisa.Text = GvRow.DataKey("Visa").ToString() - LbCelular.Text = GvRow.DataKey("Celular").ToString() - LbSexo.Text = GvRow.DataKey("Sexo").ToString() - LbObservacion.Text = GvRow.DataKey("Observacion").ToString() - LbEstatus.Text = GvRow.DataKey("Estatus").ToString() - LbCreado.Text = GvRow.DataKey("FechaIng").ToString() - TxtAsiento.Text = GvRow.DataKey("Asiento").ToString() - - 'Seleccionamos la ruta que tiene el usuario actual - DdlRuta.ClearSelection() + Protected Sub EliminarContrato(sender As Object, e As EventArgs) Dim ObjContratos As New ClsContratos - If ObjContratos.GetContratosReporte(UsuarioActual.CveEmpresa, MinFecha, MaxFecha, -1, CveEstatus:=-1, CveTipoContrato:=35) Then - For Each row As DataRow In ObjContratos.DtResultados.Rows - Dim fecha As DateTime = row("FechaInicial").ToString.ToDateTime - ' Asigna los valores de la columna deseada al ListItem - Dim listItem As New ListItem(row("SubProyecto").ToString() + " - " + fecha.ToShortDateString + " - " + fecha.ToShortTimeString, row("CveContrato").ToString()) - ' Agrega el ListItem al DropDownList - DdlRuta.Items.Add(listItem) - Next + If (CveContratoTipo = 35) Then + If CveMasivo <> 0 Then + If ObjContratos.RemoveContrato(CveContrato, UsuarioActual.CveEmpresa, CveMasivo:=CveMasivo) Then + Alert("Viajes masivos eliminados correctamente") + ObjContratos.Dispose() + Response.Redirect("RepViajes.aspx") + End If + Else + If ObjContratos.RemoveContrato(CveContrato, UsuarioActual.CveEmpresa) Then + Alert("Viaje eliminado correctamente") + ObjContratos.Dispose() + Response.Redirect("RepViajes.aspx") + End If + End If + Else + If ObjContratos.RemoveContrato(CveContrato, UsuarioActual.CveEmpresa) Then + Alert("Contrato eliminado correctamente") + ObjContratos.Dispose() + Response.Redirect("RepContratos.aspx") + End If End If - DdlRuta.SelectedValue = GvRow.DataKey("CveViaje") - ObjContratos.Dispose() + + End Sub +#End Region + +#Region "Boletos" + Protected Sub OnLinkButtonClick(sender As Object, e As EventArgs) + 'Limpiamos la selección anterior + If AsientoSeleccionado <> "" Then + Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder) + Dim lnk As LinkButton = CType(cph.FindControl(AsientoSeleccionado), LinkButton) + lnk.CssClass = "disponible" + End If + 'Seleccionamos un asiento + Dim linkButton As LinkButton = DirectCast(sender, LinkButton) + Dim buttonID As String = linkButton.ID + linkButton.CssClass += " activo" + AsientoSeleccionado = buttonID + TxtAsiento.Text = buttonID.Substring(1) + + UpBoletos.Update() RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar")) End Sub Protected Sub UpdateBoleto(sender As Object, e As EventArgs) @@ -211,26 +298,6 @@ Partial Class RepContratoDetalle CargaDatos() End Try End Sub - Protected Sub EditarBoleto(sender As Object, e As EventArgs) - - End Sub - Protected Sub OnLinkButtonClick(sender As Object, e As EventArgs) - 'Limpiamos la selección anterior - If AsientoSeleccionado <> "" Then - Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder) - Dim lnk As LinkButton = CType(cph.FindControl(AsientoSeleccionado), LinkButton) - lnk.CssClass = "disponible" - End If - 'Seleccionamos un asiento - Dim linkButton As LinkButton = DirectCast(sender, LinkButton) - Dim buttonID As String = linkButton.ID - linkButton.CssClass += " activo" - AsientoSeleccionado = buttonID - TxtAsiento.Text = buttonID.Substring(1) - - UpBoletos.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar")) - End Sub Protected Sub OnChangeRuta(sender As Object, e As EventArgs) Dim ObjTransportes As New ClsTransportes @@ -292,6 +359,79 @@ Partial Class RepContratoDetalle 'Empresas/188/Formatos/Boleto.mrt End Sub + Protected Sub EditarBoleto(sender As Object, e As EventArgs) + + End Sub + Protected Sub CambiarBoleto(sender As Object, e As EventArgs) + DdlRuta.ClearSelection() + PnEditarViaje.Visible = True + PnEditarUsuario.Visible = False + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + CveViajePasajero = GvRow.DataKey("CveViajePasajero").ToEntero + LbPartida.Text = GvRow.DataKey("Partida").ToString() + LbDestino.Text = GvRow.DataKey("Destino").ToString() + LbImporte.Text = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C") + LbNombre.Text = GvRow.DataKey("Nombre").ToString() + LbVisa.Text = GvRow.DataKey("Visa").ToString() + LbCelular.Text = GvRow.DataKey("Celular").ToString() + LbSexo.Text = GvRow.DataKey("Sexo").ToString() + LbObservacion.Text = GvRow.DataKey("Observacion").ToString() + LbEstatus.Text = GvRow.DataKey("Estatus").ToString() + LbCreado.Text = GvRow.DataKey("FechaIng").ToString() + TxtAsiento.Text = GvRow.DataKey("Asiento").ToString() + + 'Seleccionamos la ruta que tiene el usuario actual + DdlRuta.ClearSelection() + Dim ObjContratos As New ClsContratos + If ObjContratos.GetContratosReporte(UsuarioActual.CveEmpresa, MinFecha, MaxFecha, -1, CveEstatus:=-1, CveTipoContrato:=35) Then + For Each row As DataRow In ObjContratos.DtResultados.Rows + Dim fecha As DateTime = row("FechaInicial").ToString.ToDateTime + ' Asigna los valores de la columna deseada al ListItem + Dim listItem As New ListItem(row("SubProyecto").ToString() + " - " + fecha.ToShortDateString + " - " + fecha.ToShortTimeString, row("CveContrato").ToString()) + ' Agrega el ListItem al DropDownList + DdlRuta.Items.Add(listItem) + Next + End If + DdlRuta.SelectedValue = GvRow.DataKey("CveViaje") + ObjContratos.Dispose() + RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar")) + End Sub + Protected Sub BtnCancelar_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + CveViajePasajero = GvRow.DataKey("CveViajePasajero").ToEntero + LbPartida.Text = GvRow.DataKey("Partida").ToString() + LbDestino.Text = GvRow.DataKey("Destino").ToString() + LbImporte.Text = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C") + LbNombre.Text = GvRow.DataKey("Nombre").ToString() + LbVisa.Text = GvRow.DataKey("Visa").ToString() + LbCelular.Text = GvRow.DataKey("Celular").ToString() + LbSexo.Text = GvRow.DataKey("Sexo").ToString() + LbObservacion.Text = GvRow.DataKey("Observacion").ToString() + LbEstatus.Text = GvRow.DataKey("Estatus").ToString() + LbCreado.Text = GvRow.DataKey("FechaIng").ToString() + TxtAsiento.Text = GvRow.DataKey("Asiento").ToString() + Dim Estatus As Boolean = Not LbEstatus.Text.ToBool + Dim ObjTransportes As New ClsTransportes + Try + ObjTransportes.IniciaTransacSQL() + + If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, CveContrato, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, LbNombre.Text, LbVisa.Text, LbCelular.Text, LbObservacion.Text, Estatus, UsuarioActual.CveUsuario, LbSexo.Text.ToBool) Then + Alert($"El boleto ha modificado el estatus de su boleto correctamente.") + + ObjTransportes.Commit() + End If + + Catch ex As Exception + ObjTransportes.RollBack() + Alert($"No se pudo cambiar el estatus del boleto", TipoMensaje.MsgError) + Finally + ObjTransportes.Dispose() + CargaDatos() + End Try + End Sub +#End Region + End Class diff --git a/Transportes/RepContratos.aspx b/Transportes/RepContratos.aspx index e023b1602..d4ce87e78 100644 --- a/Transportes/RepContratos.aspx +++ b/Transportes/RepContratos.aspx @@ -243,7 +243,8 @@
-
-
@@ -388,13 +388,21 @@
+ +
+ + +
@@ -434,7 +442,40 @@ + <%--MODAL UPLOAD--%> + diff --git a/Transportes/RepContratos.aspx.vb b/Transportes/RepContratos.aspx.vb index 7ad7c339e..fe0f03ee8 100644 --- a/Transportes/RepContratos.aspx.vb +++ b/Transportes/RepContratos.aspx.vb @@ -1,6 +1,7 @@ Option Explicit On Option Strict On Imports System.Data +Imports System.IO Imports Extensiones Imports Extensiones.ModExtensiones Imports Microsoft.Reporting.WebForms @@ -18,6 +19,8 @@ Partial Class ListadoContratos End Set End Property #End Region + +#Region "Carga Página" Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load txtFechaI.Text = DateTime.Now.AddMonths(-1).ToShortDateString txtFechaF.Text = DateTime.Now.AddDays(7).ToShortDateString @@ -71,6 +74,8 @@ Partial Class ListadoContratos UpTitulos.Update() End Sub +#End Region + Protected Sub MostrarModal() RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar")) End Sub @@ -84,6 +89,15 @@ Partial Class ListadoContratos Exit Sub End If + 'Agregamos Contrato + Dim ObjContratos As New ClsContratos + ObjContratos.IniciaTransacSQL() + If ObjContratos.AddContratos(LbFolio.Text, TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, LbArchivo.Text, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, 0, CveContratoTipo:=34, CveContratosEstatus:=50, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero, Observaciones:=TxtObservaciones.Text) > 0 Then + ObjContratos.Commit() + Alert("Agregado Correctamente.") + End If + ObjContratos.Dispose() + 'Aumentamos Folio Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, -1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero Dim ObjFolios As New ClsGralFolios @@ -91,15 +105,6 @@ Partial Class ListadoContratos ObjFolios.Dispose() End If - 'Agregamos Contrato - Dim ObjContratos As New ClsContratos - ObjContratos.IniciaTransacSQL() - If ObjContratos.AddContratos(LbFolio.Text, TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero, 0, CveContratoTipo:=34, CveContratosEstatus:=50, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero, Observaciones:=TxtObservaciones.Text) > 0 Then - ObjContratos.Commit() - Alert("Agregado Correctamente.") - End If - ObjContratos.Dispose() - 'Reiniciamos modal TxtDescripcion.Text = "" TxtFechaSalida.Text = "" @@ -112,10 +117,11 @@ Partial Class ListadoContratos TxtPesos.Text = "" TxtAnticipo.Text = "" TxtCantidadPasajeros.Text = "" + LbArchivo.Text = "" UpModal.Update() CargaDatos() - + RegistraScript("$('#ModalAgregar').modal('hide')", "hidemodal1") End Sub Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click GvContratos.ExportToExcel("ReporteCompras" & NowADS().ToShortDateString) @@ -153,4 +159,35 @@ Partial Class ListadoContratos GvContratos.Columns(8).Visible = ChkUnidad.Checked UpTitulos.Update() End Sub + Protected Sub GuardarArchivo(sender As Object, e As EventArgs) + Dim FileExtension As String = "-1" + Dim Filesgral As List(Of Archivo) = Anexo.getfiles().Archivos + Dim Filename As String = "" + Dim folderContratosPath As String = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos") + + If Not Directory.Exists(folderContratosPath) Then + Directory.CreateDirectory(folderContratosPath) + End If + + If Not Directory.Exists(Path.Combine(folderContratosPath, "Temp")) Then + Directory.CreateDirectory(Path.Combine(folderContratosPath, "Temp")) + End If + + For Each fileItem As Archivo In Filesgral + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Session("FileExtension") = FileExtension + Dim tempArray() As String + tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) + + + ViewState("extencion") = FileExtension + ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos", "Temp", fileItem.filename) + + File.Move(fileItem.FileUrl, ViewState("FUrl").ToString) + LbArchivo.Text = fileItem.filenameO + Next + + UpModal.Update() + RegistraScript("$('#ModalUpload').modal('hide')", "hidemodal1") + End Sub End Class