--Mejoras en facturacion masiva

This commit is contained in:
2022-09-07 20:53:45 -07:00
parent 2646bd5ab5
commit 6df1128493
6 changed files with 186 additions and 9 deletions

View File

@@ -319,7 +319,7 @@ Public Class ClsContratos
Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1, 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 CvePeriodo As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CvePeriodo 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 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) As Integer Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, Optional DiaMesFacturacion As Integer = 1, Optional ObservacionesGenerales As String = "") As Integer
Dim Retorno As Integer = -1 Dim Retorno As Integer = -1
DataAdapter("PA_Con_ContratosAdd") DataAdapter("PA_Con_ContratosAdd")
@@ -374,6 +374,7 @@ Public Class ClsContratos
.Add("@FacturacionCicilica", SqlDbType.Bit).Value = FacturacionCicilica .Add("@FacturacionCicilica", SqlDbType.Bit).Value = FacturacionCicilica
.Add("@FacturacionCiclicaAutomatico", SqlDbType.Bit).Value = FacturacionCiclicaAutomatico .Add("@FacturacionCiclicaAutomatico", SqlDbType.Bit).Value = FacturacionCiclicaAutomatico
.Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion .Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion
.Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales
End With End With
@@ -399,7 +400,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 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 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 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) As Boolean Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "") As Boolean
Dim Retorno = False Dim Retorno = False
DataAdapter("PA_Con_ContratosUpdate") DataAdapter("PA_Con_ContratosUpdate")
@@ -453,7 +454,9 @@ Public Class ClsContratos
.Add("@FacturacionCicilica", SqlDbType.Bit).Value = FacturacionCicilica .Add("@FacturacionCicilica", SqlDbType.Bit).Value = FacturacionCicilica
.Add("@FacturacionCiclicaAutomatico", SqlDbType.Bit).Value = FacturacionCiclicaAutomatico .Add("@FacturacionCiclicaAutomatico", SqlDbType.Bit).Value = FacturacionCiclicaAutomatico
.Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion .Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion
.Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
.Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales
End With End With
Try Try

View File

@@ -1973,6 +1973,16 @@
<asp:Button ID="BtnVerPlantilla" runat="server" Text="Ver Plantilla" CssClass="btn btn-sm btn-primary" Width="100%" OnClick="BtnVerPlantilla_Click"/> <asp:Button ID="BtnVerPlantilla" runat="server" Text="Ver Plantilla" CssClass="btn btn-sm btn-primary" Width="100%" OnClick="BtnVerPlantilla_Click"/>
</div> </div>
</div> </div>
<br />
<div class="row">
<label class="col-md-3 truncate ">Observación General:</label>
<div class="col-md-7">
<asp:TextBox ID="TxtObsGeneral" runat="server" Width="100%" TextMode="MultiLine" Rows="2"></asp:TextBox>
</div>
<div class="col-md-2">
<asp:Button ID="BtnVerPlantilla2" runat="server" Text="Ver Plantilla" CssClass="btn btn-sm btn-primary" Width="100%" OnClick="BtnVerPlantilla2_Click"/>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-md-12" style="vertical-align: middle;" align="center"> <div class="col-md-12" style="vertical-align: middle;" align="center">
<div style="z-index: 5; position: relative;"> <div style="z-index: 5; position: relative;">

View File

@@ -1383,7 +1383,8 @@ Partial Class Contratos_Default
CveAlmacenOrigen:=DdlAlmacenOrigen.SelectedValue.ToEntero, CveAlmacenDestino:=DdlAlmacenDestino.SelectedValue.ToEntero, PorcentajeComision:=TxtPorcentajeComision.Text.ToEntero, CveAlmacenOrigen:=DdlAlmacenOrigen.SelectedValue.ToEntero, CveAlmacenDestino:=DdlAlmacenDestino.SelectedValue.ToEntero, PorcentajeComision:=TxtPorcentajeComision.Text.ToEntero,
TipoGarantia:=DdlTipoGarantia.SelectedValue.ToEntero, Folio:=TxtFolio.Text.ToEntero, FechaVenc:=txtFechaVenc.Text.ToDate, EstatusFianza:=DdlEstatusFianza.SelectedValue.ToEntero, CveContratoPlantilla:=DdlPlantillaContrato.SelectedValue.ToEntero, TipoGarantia:=DdlTipoGarantia.SelectedValue.ToEntero, Folio:=TxtFolio.Text.ToEntero, FechaVenc:=txtFechaVenc.Text.ToDate, EstatusFianza:=DdlEstatusFianza.SelectedValue.ToEntero, CveContratoPlantilla:=DdlPlantillaContrato.SelectedValue.ToEntero,
CveCuentaEquipo:=DdlCuentaEquipo.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=DdlClienteDireccionEnvio.SelectedValue.ToEntero, AplicaImpuestosLocales:=ChkImpuestosLocales.Checked, CveCuentaEquipo:=DdlCuentaEquipo.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=DdlClienteDireccionEnvio.SelectedValue.ToEntero, AplicaImpuestosLocales:=ChkImpuestosLocales.Checked,
CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), FacturacionCicilica:=ChkAplicaFacCiclica.Checked, FacturacionCiclicaAutomatico:=ChkFacAutomatica.Checked, DiaMesFacturacion:=If(DdlDiaFact.SelectedValue.ToEntero() < 0, 0, DdlDiaFact.SelectedValue.ToEntero()), CvePeriodo:=DdlPeriodo.SelectedValue.ToEntero()) Then CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), FacturacionCicilica:=ChkAplicaFacCiclica.Checked, FacturacionCiclicaAutomatico:=ChkFacAutomatica.Checked, DiaMesFacturacion:=If(DdlDiaFact.SelectedValue.ToEntero() < 0, 0, DdlDiaFact.SelectedValue.ToEntero()),
CvePeriodo:=DdlPeriodo.SelectedValue.ToEntero(), ObservacionesGenerales:=TxtObsGeneral.Text.Trim) Then
TieneError = Not GuardaFianzas(ObjContratos) TieneError = Not GuardaFianzas(ObjContratos)
@@ -4028,7 +4029,8 @@ Partial Class Contratos_Default
TxtUbicacion.Text, TxtResponsable.Text, DdlSubProyectoContrato.SelectedValue.ToEntero, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble, TxtUbicacion.Text, TxtResponsable.Text, DdlSubProyectoContrato.SelectedValue.ToEntero, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble,
TxtPorGarantia.Text.ToDouble, "." & Session("FileExtension").ToString, "", CveContrato, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, Minimo, Maximo, Total, TxtPorGarantia.Text.ToDouble, "." & Session("FileExtension").ToString, "", CveContrato, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, Minimo, Maximo, Total,
DdlMoneda.SelectedValue.ToEntero, ModalidadDetalle, If(UsuarioActual.Empresa.CvePlataforma = 3, 1, CveEstatusInicial), TipoContrato, TxtTipoCambio.Text.ToDouble, CveSucursalCliente:=DdlSucursalCliente.SelectedValue.ToEntero, CveAlmacenOrigen:=DdlAlmacenOrigen.SelectedValue.ToEntero, CveAlmacenDestino:=DdlAlmacenDestino.SelectedValue.ToEntero, PorcentajeComision:=TxtPorcentajeComision.Text.ToEntero, DdlMoneda.SelectedValue.ToEntero, ModalidadDetalle, If(UsuarioActual.Empresa.CvePlataforma = 3, 1, CveEstatusInicial), TipoContrato, TxtTipoCambio.Text.ToDouble, CveSucursalCliente:=DdlSucursalCliente.SelectedValue.ToEntero, CveAlmacenOrigen:=DdlAlmacenOrigen.SelectedValue.ToEntero, CveAlmacenDestino:=DdlAlmacenDestino.SelectedValue.ToEntero, PorcentajeComision:=TxtPorcentajeComision.Text.ToEntero,
TipoGarantia:=DdlTipoGarantia.SelectedValue.ToEntero, Folio:=TxtFolio.Text.ToEntero, FechaVenc:=txtFechaVenc.Text.ToDate, EstatusFianza:=DdlEstatusFianza.SelectedValue.ToEntero, CvePeriodo:=DdlPeriodo.SelectedValue.ToEntero, CveCuentaEquipo:=DdlCuentaEquipo.SelectedValue.ToEntero, CveContratoPlantilla:=DdlPlantillaContrato.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero) TipoGarantia:=DdlTipoGarantia.SelectedValue.ToEntero, Folio:=TxtFolio.Text.ToEntero, FechaVenc:=txtFechaVenc.Text.ToDate, EstatusFianza:=DdlEstatusFianza.SelectedValue.ToEntero, CvePeriodo:=DdlPeriodo.SelectedValue.ToEntero, CveCuentaEquipo:=DdlCuentaEquipo.SelectedValue.ToEntero, CveContratoPlantilla:=DdlPlantillaContrato.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero,
ObservacionesGenerales:=TxtObsGeneral.Text.Trim)
If CveContratoHijo > 0 Then If CveContratoHijo > 0 Then
@@ -4578,6 +4580,61 @@ Partial Class Contratos_Default
Plantilla = Plantilla.ToString().Replace("{FINMESANTERIOR}", mesAnterior) Plantilla = Plantilla.ToString().Replace("{FINMESANTERIOR}", mesAnterior)
End If End If
Alert(Plantilla)
End Sub
Protected Sub BtnVerPlantilla2_Click(sender As Object, e As EventArgs)
Dim Plantilla As String = TxtObsGeneral.Text
If Plantilla.Contains("{DIA}") Then
Plantilla = Plantilla.Replace("{DIA}", DateTime.Now.Day.ToString())
End If
If Plantilla.Contains("{MES}") Then
Dim fecha As DateTime = DateTime.Now
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
Plantilla = Plantilla.ToString().Replace("{MES}", nombreMes)
End If
If Plantilla.Contains("{AÑO}") Then
Plantilla = Plantilla.Replace("{AÑO}", DateTime.Now.Year.ToString())
End If
If Plantilla.Contains("{TC}") Then
Plantilla = Plantilla.Replace("{TC}", GlobalTipoCambio(Now).FormatoNumero)
End If
If Plantilla.Contains("{MESANTERIOR}") Then
Dim fecha As DateTime = DateTime.Now.AddMonths(-1)
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
Plantilla = Plantilla.ToString().Replace("{MESANTERIOR}", nombreMes)
End If
If Plantilla.Contains("{INICIOMESANTERIOR}") Then
Dim fecha As DateTime = DateTime.Now.AddMonths(-1)
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
Dim mesAnterior As String = String.Format("01 {0} {1}", nombreMes, fecha.Year)
Plantilla = Plantilla.ToString().Replace("{INICIOMESANTERIOR}", mesAnterior)
End If
If Plantilla.Contains("{FINMESANTERIOR}") Then
Dim fecha As DateTime = DateTime.Now.AddMonths(-1)
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
Dim LastDayOfMonth = DateTime.DaysInMonth(fecha.Year, fecha.Month)
Dim mesAnterior As String = String.Format("{0} {1} {2}", LastDayOfMonth, nombreMes, fecha.Year)
Plantilla = Plantilla.ToString().Replace("{FINMESANTERIOR}", mesAnterior)
End If
Alert(Plantilla) Alert(Plantilla)
End Sub End Sub
End Class End Class

View File

@@ -142,6 +142,14 @@ Partial Class Contratos_FacturacionMasiva
Row("Observaciones") = Row("Observaciones").ToString().Replace("{MES}", nombreMes) Row("Observaciones") = Row("Observaciones").ToString().Replace("{MES}", nombreMes)
End If End If
If Row("Observaciones").ToString().Contains("{MESANTERIOR}") Then
Dim fecha As DateTime = DateTime.Now.AddMonths(-1)
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
Row("Observaciones") = Row("Observaciones").ToString().Replace("{MESANTERIOR}", nombreMes)
End If
If Row("Observaciones").ToString().Contains("{AÑO}") Then If Row("Observaciones").ToString().Contains("{AÑO}") Then
Row("Observaciones") = Row("Observaciones").ToString().Replace("{AÑO}", DateTime.Now.Year.ToString()) Row("Observaciones") = Row("Observaciones").ToString().Replace("{AÑO}", DateTime.Now.Year.ToString())
End If End If

View File

@@ -6886,7 +6886,7 @@
<div class="row" id="DivGvCxC" style="max-height: 5px" runat="server" visible="false"> <div class="row" id="DivGvCxC" style="max-height: 5px" runat="server" visible="false">
<div class="col-md-12" style="height: 440px; overflow: auto"> <div class="col-md-12" style="height: 440px; overflow: auto">
<asp:GridView ID="GvCxC" runat="server" AutoGenerateColumns="False" OnRowDataBound="GvCxC_RowDataBound" <asp:GridView ID="GvCxC" runat="server" AutoGenerateColumns="False" OnRowDataBound="GvCxC_RowDataBound"
DataKeyNames="CveVenta,CveMetodoPago33,CveFormaPago33" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None"> DataKeyNames="CveVenta,CveMetodoPago33,CveFormaPago33,CveMoneda" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
<Columns> <Columns>
<asp:TemplateField> <asp:TemplateField>
<ItemTemplate> <ItemTemplate>

View File

@@ -3986,9 +3986,12 @@ Partial Class Ventas
UpPS.Update() UpPS.Update()
Exit Sub Exit Sub
Else Else
Dim ObsPlantilla As String = PlantillaContrato(Row.DataKey("Observaciones"))
SeleccionadoContrato += Row.FCTextBox("TxtCant").Text.ToEntero() * Row.FCLiteral("LtlPU").Text.ToDouble SeleccionadoContrato += Row.FCTextBox("TxtCant").Text.ToEntero() * Row.FCLiteral("LtlPU").Text.ToDouble
AgregarProductoServicio(Row.FCTextBox("TxtCant").Text.ToEntero(), Row.DataKey("CveUM").ToEntero(), Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero(), AgregarProductoServicio(Row.FCTextBox("TxtCant").Text.ToEntero(), Row.DataKey("CveUM").ToEntero(), Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero(),
Row.DataKey("Clasificacion"), Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, Row.DataKey("Observaciones"), $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDecimal, 0, Row.DataKey("Clasificacion"), Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, ObsPlantilla, $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDecimal, 0,
DrContrato("CveProyecto").ToString().ToEntero(), DrContrato("ProyectoContrato").ToString(), DrContrato("CveSubProyecto").ToString().ToEntero(), DrContrato("SubProyectoContrato").ToString(), CveContratoDetalle:=Row.DataKey("CveContratoDetalle").ToEntero()) DrContrato("CveProyecto").ToString().ToEntero(), DrContrato("ProyectoContrato").ToString(), DrContrato("CveSubProyecto").ToString().ToEntero(), DrContrato("SubProyectoContrato").ToString(), CveContratoDetalle:=Row.DataKey("CveContratoDetalle").ToEntero())
'AddPS(Row.FCTextBox("TxtCant").Text.ToEntero(), Row.DataKey("CveUM").ToEntero(), Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero(), Row.DataKey("Clasificacion"), 'AddPS(Row.FCTextBox("TxtCant").Text.ToEntero(), Row.DataKey("CveUM").ToEntero(), Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero(), Row.DataKey("Clasificacion"),
' Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, Row.DataKey("Observaciones"), $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDouble, If(Row.DataKey("IVA").ToDouble = -1, ViewState("IVA").ToString().ToDouble, Row.DataKey("IVA").ToDouble), 0, 0, 1, 0, True, "", ' Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, Row.DataKey("Observaciones"), $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDouble, If(Row.DataKey("IVA").ToDouble = -1, ViewState("IVA").ToString().ToDouble, Row.DataKey("IVA").ToDouble), 0, 0, 1, 0, True, "",
@@ -7825,6 +7828,21 @@ Partial Class Ventas
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False
End If End If
If CveCicloComercial > 0 Then
For Each gvr As GridViewRow In GvContratoDetalles.Rows
If gvr.RowType = DataControlRowType.DataRow Then
If gvr.DataKey("Cantidad").ToString().ToDecimal() = GvPS.Rows(e.NewEditIndex).DataKey("Cantidad").ToString().ToDecimal() AndAlso gvr.DataKey("CvePS").ToString().ToEntero() = GvPS.Rows(e.NewEditIndex).DataKey("CvePS").ToString().ToEntero() Then
If gvr.DataKey("LimitarCantidad").ToString() = "False" Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtCantidad").Enabled = True
Exit For
End If
End If
End If
Next
End If
End Sub End Sub
Protected Sub GvPS_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvPS.RowCancelingEdit Protected Sub GvPS_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvPS.RowCancelingEdit
GvPS.EditIndex = -1 GvPS.EditIndex = -1
@@ -12538,7 +12556,7 @@ Partial Class Ventas
CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM, CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM,
DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False), DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False),
Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=factura.CveTipoRetencion, CorreoNotificacion:=TxtCorreoNotificaciones.Text, Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=factura.CveTipoRetencion, CorreoNotificacion:=TxtCorreoNotificaciones.Text,
FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia) Then FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible) Then
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico") ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else Else
If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 OrElse CveAnticipoPadre > 0 Then If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 OrElse CveAnticipoPadre > 0 Then
@@ -24088,7 +24106,15 @@ Partial Class Ventas
DdlContratosModal.DataSource = ObjContratos.DtResultados DdlContratosModal.DataSource = ObjContratos.DtResultados
DdlContratosModal.SelectedValue = ObjContratos.DtResultados(0)("CveContrato").ToString() DdlContratosModal.SelectedValue = ObjContratos.DtResultados(0)("CveContrato").ToString()
DdlContratosModal_SelectedIndexChanged(Nothing, Nothing) DdlContratosModal_SelectedIndexChanged(Nothing, Nothing)
GvContratoDetalles.HeaderRow.Cells(1).Style.Add("display", "none")
If GvContratoDetalles.HeaderRow IsNot Nothing Then
If GvContratoDetalles.HeaderRow.Cells.Count > 0 Then
GvContratoDetalles.HeaderRow.Cells(1).Style.Add("display", "none")
End If
End If
TxtObsFact.Text = PlantillaContrato(ObjContratos.DtResultados(0)("ObservacionesGenerales").ToString())
BtnCargarContratoDetalles_Click(Nothing, Nothing) BtnCargarContratoDetalles_Click(Nothing, Nothing)
LbAgregar.Visible = True LbAgregar.Visible = True
UpPS.Update() UpPS.Update()
@@ -24103,6 +24129,62 @@ Partial Class Ventas
End If End If
ObjContratos.Dispose() ObjContratos.Dispose()
End Sub End Sub
Private Function PlantillaContrato(texto As String) As String
Dim Plantilla As String = texto
If Plantilla.Contains("{DIA}") Then
Plantilla = Plantilla.Replace("{DIA}", DateTime.Now.Day.ToString())
End If
If Plantilla.Contains("{MES}") Then
Dim fecha As DateTime = DateTime.Now
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
Plantilla = Plantilla.ToString().Replace("{MES}", nombreMes)
End If
If Plantilla.Contains("{AÑO}") Then
Plantilla = Plantilla.Replace("{AÑO}", DateTime.Now.Year.ToString())
End If
If Plantilla.Contains("{TC}") Then
Plantilla = Plantilla.Replace("{TC}", GlobalTipoCambio(Now).FormatoNumero)
End If
If Plantilla.Contains("{MESANTERIOR}") Then
Dim fecha As DateTime = DateTime.Now.AddMonths(-1)
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
Plantilla = Plantilla.ToString().Replace("{MESANTERIOR}", nombreMes)
End If
If Plantilla.Contains("{INICIOMESANTERIOR}") Then
Dim fecha As DateTime = DateTime.Now.AddMonths(-1)
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
Dim mesAnterior As String = String.Format("01 {0} {1}", nombreMes, fecha.Year)
Plantilla = Plantilla.ToString().Replace("{INICIOMESANTERIOR}", mesAnterior)
End If
If Plantilla.Contains("{FINMESANTERIOR}") Then
Dim fecha As DateTime = DateTime.Now.AddMonths(-1)
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
Dim LastDayOfMonth = DateTime.DaysInMonth(fecha.Year, fecha.Month)
Dim mesAnterior As String = String.Format("{0} {1} {2}", LastDayOfMonth, nombreMes, fecha.Year)
Plantilla = Plantilla.ToString().Replace("{FINMESANTERIOR}", mesAnterior)
End If
Return Plantilla
End Function
#End Region #End Region
#Region "DESCARGAR E IMPRIMIR LISTADO" #Region "DESCARGAR E IMPRIMIR LISTADO"
@@ -27621,6 +27703,23 @@ Partial Class Ventas
End If End If
End If End If
Dim Monedas As New List(Of Integer)
For Each gvr As GridViewRow In GvCxC.Rows
If gvr.FCCheckBox("ChkCxC").Checked Then
Monedas.Add(gvr.DataKey("CveMoneda").ToString().ToEntero())
End If
Next
Monedas = Monedas.Distinct().ToList()
If Monedas.Count > 0 Then
If Monedas.Count > 1 Then
Alert($"Debe seleccionar facturas de la misma moneda", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
DdlMoneda.SelectedValueExist(Monedas(0).ToString())
End If
RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC") RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC")
CveVentaUsadoDevolucionEfectivo = -1 CveVentaUsadoDevolucionEfectivo = -1