Cambios en facturacion masiva de contratos
This commit is contained in:
@@ -43,6 +43,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
ActualizaPrePoliza(context)
|
||||
Case "getpersonal"
|
||||
getpersonal(context)
|
||||
Case "getcontratos"
|
||||
GetContratos(context)
|
||||
Case "GettingCURP"
|
||||
context.Response.Write(GettingCURP(context.Request("Curp").ToString(), context.Request("year").ToString().ToEntero()))
|
||||
Case "ValidaCURP"
|
||||
@@ -1080,4 +1082,38 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
Return retorno
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "Get Contratos"
|
||||
Private Function GetContratos(ByVal context As HttpContext) As String
|
||||
Dim retorno As String = ""
|
||||
Dim DtRetorno As DataTable = Nothing
|
||||
|
||||
Dim usuario As Usuario = UsuarioActual(context)
|
||||
Dim CveEmpresa As String
|
||||
If IsNothing(usuario) Then
|
||||
context.Response.Write("")
|
||||
Else
|
||||
CveEmpresa = usuario.CveEmpresa
|
||||
Dim Name = IfNull(context.Request("Name"), "-1").ToString
|
||||
|
||||
Dim dt As DataTable = DirectCast(context.Application("GlobalDTContratos"), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa))
|
||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||
DtRetorno = dt.FiltraParametros(String.Format("NumeroContrato like '%{0}%'", Name))
|
||||
End If
|
||||
dt.Dispose()
|
||||
End If
|
||||
|
||||
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
|
||||
DtRetorno.Columns("CveContrato").ColumnName = "id"
|
||||
DtRetorno.Columns("NumeroContrato").ColumnName = "text"
|
||||
retorno = JsonConvert.SerializeObject(DtRetorno).ToString
|
||||
context.Response.Write(retorno)
|
||||
Else
|
||||
context.Response.Write("[]")
|
||||
End If
|
||||
|
||||
DtRetorno.Dispose()
|
||||
Return retorno
|
||||
End Function
|
||||
#End Region
|
||||
End Class
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1199,13 +1199,16 @@ Partial Class Contratos_Default
|
||||
GvFianzas.DataBind()
|
||||
UpGvFianzas.Update()
|
||||
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " GUARDAR "
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
|
||||
Dim ObjContratos As New ClsContratos
|
||||
Dim ObjInventarios As New ClsInventarios(ObjContratos.IniciaTransacSQL)
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
|
||||
|
||||
If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then
|
||||
Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim TieneError = False
|
||||
Dim Modificado = False
|
||||
@@ -1221,21 +1224,30 @@ Partial Class Contratos_Default
|
||||
Maximo = txtMaximo.Text.ToDouble
|
||||
Total = TxtTotal.Text.ToDouble
|
||||
|
||||
If DdlTipoContrato.SelectedValue = "25" AndAlso DdlPeriodo.SelectedValue.ToEntero() <= 0 Then
|
||||
Alert("Debe seleccionar el periodo de facturación.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If DdlMoneda.SelectedIndex > 0 Then
|
||||
If TxtTipoCambio.Text.Trim.Length = 0 Or TxtTipoCambio.Text.Trim.ToDouble = 0.0 Then
|
||||
Alert("Cuando seleccione una moneda diferente a peso debe especificar el tipo de cambio.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'Crear Contrato
|
||||
If Not CveContrato > 0 Then
|
||||
End If
|
||||
|
||||
If CveContrato > 0 Then
|
||||
If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then
|
||||
Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim ObjContratos As New ClsContratos
|
||||
Dim ObjInventarios As New ClsInventarios(ObjContratos.IniciaTransacSQL)
|
||||
|
||||
'Crear Contrato
|
||||
If Not CveContrato > 0 Then
|
||||
|
||||
CveContrato = ObjContratos.AddContratos(TxtNumeroContrato.Text, TxtDescripcionContrato.Text, TxtNumeroLicitacion.Text.Trim, DdlContratista.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, -1, TxtFechaInicial.Text.ToDate, TxtFechaFinal.Text.ToDate,
|
||||
TxtUbicacion.Text, TxtResponsable.Text, DdlSubProyectoContrato.SelectedValue.ToEntero, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble,
|
||||
@@ -1323,18 +1335,9 @@ Partial Class Contratos_Default
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Else
|
||||
Modificado = True
|
||||
If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then
|
||||
Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim ArchivoUpdate As String = "-1"
|
||||
|
||||
If Session("FileExtension").ToString <> "" Then
|
||||
@@ -1433,16 +1436,8 @@ Partial Class Contratos_Default
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
'If Not TieneError Then
|
||||
' TieneError = GuardarAlmacen(ObjInventarios)
|
||||
'End If
|
||||
|
||||
If TieneError Then
|
||||
ObjContratos.RollBack()
|
||||
Else
|
||||
@@ -1461,12 +1456,11 @@ Partial Class Contratos_Default
|
||||
|
||||
End If
|
||||
|
||||
|
||||
UpGral.Update()
|
||||
ObjContratos.Dispose()
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " ELIMINAR "
|
||||
Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click
|
||||
Dim objContratos As New ClsContratos
|
||||
|
||||
@@ -34,14 +34,11 @@
|
||||
<div class="titlefiltros caption ">
|
||||
<ul class="list-inline" style="font-size: 12px;">
|
||||
<li>Cliente:
|
||||
<asp:DropDownList ID="DdlCliente" runat="server" AppendDataBoundItems="true" DataTextField="NombreComercial" DataValueField="CveCliente" CssClass="form-control input-sm select2me" Style="width: 250px !important;">
|
||||
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<ADS:Dropdownlost ID="DdlCliente" runat="server" Width="230px" CssStyle="width: 100%;" UsaWebService="true" AppendDataBoundItems="true" CssClass="select2me" data-metodo="getcliente" DataTextField="NombreComercial" DataValueField="CveCliente"></ADS:Dropdownlost>
|
||||
</li>
|
||||
<li>Contrato:
|
||||
<asp:DropDownList ID="DdlContrato" Width="230px" AppendDataBoundItems="true" runat="server" DataTextField="NumeroContrato" DataValueField="CveContrato" CssClass="form-control input-sm select2me">
|
||||
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<ADS:Dropdownlost ID="DdlContrato" runat="server" Width="230px" CssStyle="width: 100%;" UsaWebService="true" AppendDataBoundItems="true" CssClass="select2me" data-metodo="getcontratos" DataTextField="NumeroContrato" DataValueField="CveContrato">
|
||||
</ADS:Dropdownlost>
|
||||
</li>
|
||||
<li>
|
||||
Sucursal:
|
||||
|
||||
@@ -111,8 +111,9 @@ Partial Class Contratos_FacturacionMasiva
|
||||
If Not IsPostBack Then
|
||||
FolioVigentes = False
|
||||
CargaCombos()
|
||||
txtFechaI.Text = DateTime.Today.ToString("d")
|
||||
txtFechaF.Text = DateTime.Today.ToString("d")
|
||||
Dim FechaRef = DateTime.Now
|
||||
txtFechaI.Text = $"01/{FechaRef.Month}/{FechaRef.Year}"
|
||||
txtFechaF.Text = txtFechaI.Text.ToDate().AddMonths(1).ToString("dd/MM/yyyy")
|
||||
CargaDatos(-1, -1)
|
||||
CreaDTVentas()
|
||||
Mensaje = ""
|
||||
@@ -131,11 +132,44 @@ Partial Class Contratos_FacturacionMasiva
|
||||
ValidaFolio()
|
||||
|
||||
Dim ObjContratos As New ClsContratos
|
||||
If ObjContratos.CicloComercialGet(CveContrato, CveCliente, -1, UsuarioActual.CveEmpresa, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, DdlSucursal.SelectedValue.ToEntero) Then
|
||||
DTCicloComercial = ObjContratos.DtResultados().FiltraParametros($"FueFacturado = 0")
|
||||
GvCiclosComerciales.DataSource = DTCicloComercial
|
||||
End If
|
||||
ObjContratos.Dispose()
|
||||
Try
|
||||
If ObjContratos.CicloComercialGet(CveContrato, CveCliente, -1, UsuarioActual.CveEmpresa, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, DdlSucursal.SelectedValue.ToEntero) Then
|
||||
DTCicloComercial = ObjContratos.DtResultados.Clone
|
||||
|
||||
For Each Row As DataRow In ObjContratos.DtResultados().FiltraParametros($"FueFacturado = 0").Rows
|
||||
|
||||
If Row("Observaciones").ToString().Contains("{DIA}") Then
|
||||
Row("Observaciones") = Row("Observaciones").ToString().Replace("{DIA}", DateTime.Now.Day.ToString())
|
||||
End If
|
||||
|
||||
If Row("Observaciones").ToString().Contains("{MES}") Then
|
||||
Dim fecha As DateTime = DateTime.Now
|
||||
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
|
||||
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
|
||||
|
||||
Row("Observaciones") = Row("Observaciones").ToString().Replace("{MES}", nombreMes)
|
||||
End If
|
||||
|
||||
If Row("Observaciones").ToString().Contains("{AÑO}") Then
|
||||
Row("Observaciones") = Row("Observaciones").ToString().Replace("{AÑO}", DateTime.Now.Year.ToString())
|
||||
End If
|
||||
|
||||
If Row("Observaciones").ToString().Contains("{TC}") Then
|
||||
Row("Observaciones") = Row("Observaciones").ToString().Replace("{TC}", GlobalTipoCambio(Now).FormatoNumero)
|
||||
End If
|
||||
|
||||
DTCicloComercial.Rows.Add(Row.ItemArray)
|
||||
Next
|
||||
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
DTCicloComercial = Nothing
|
||||
OnError("Ocurrió un error al obtener las facturas a realizar", ex)
|
||||
End Try
|
||||
ObjContratos.Dispose()
|
||||
|
||||
GvCiclosComerciales.DataSource = DTCicloComercial
|
||||
GvCiclosComerciales.DataBind()
|
||||
UpGv.Update()
|
||||
End Sub
|
||||
@@ -174,14 +208,9 @@ Partial Class Contratos_FacturacionMasiva
|
||||
Dim sb As New StringBuilder()
|
||||
|
||||
For Each row As GridViewRow In GvCiclosComerciales.Rows
|
||||
If row.FCCheckBox("chkDis").Checked Then
|
||||
Dim fecha As DateTime = DateTime.Now ', row.DataKey("FechaVenc").ToString.ToDateTime()
|
||||
Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
|
||||
Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
|
||||
If row.FCCheckBox("chkDis").Checked Then
|
||||
|
||||
Dim Etiqueta As String = String.Format("{0} - {1}", nombreMes, fecha.Year)
|
||||
|
||||
Dim Resp = EmitirImprimir(row.DataKey("CveCicloComercial").ToString.ToEntero, Etiqueta)
|
||||
Dim Resp = EmitirImprimir(row.DataKey("CveCicloComercial").ToString.ToEntero)
|
||||
|
||||
For Each Msg In Resp.Mensajes
|
||||
sb.AppendFormat("{0}</br></br>", Msg)
|
||||
@@ -212,10 +241,10 @@ Partial Class Contratos_FacturacionMasiva
|
||||
EjecutarFacturacion()
|
||||
End Sub
|
||||
|
||||
Private Function EmitirImprimir(pCveCicloComercial As Integer, Etiqueta As String) As Modelos.Factura.MMensajeFactura
|
||||
Private Function EmitirImprimir(pCveCicloComercial As Integer) As Modelos.Factura.MMensajeFactura
|
||||
Dim Resp As New Modelos.Factura.MMensajeFactura
|
||||
ViewState("CveCicloComercial") = pCveCicloComercial
|
||||
CreaObjetosVenta(Etiqueta)
|
||||
CreaObjetosVenta()
|
||||
If ObjFactura Is Nothing Or ObjFactura.Cliente Is Nothing Then
|
||||
Alert("Ocurrió un error al procesar los datos de la Venta.", TipoMensaje.MsgError)
|
||||
ObjFactura = Nothing
|
||||
@@ -438,7 +467,7 @@ Partial Class Contratos_FacturacionMasiva
|
||||
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
|
||||
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
|
||||
End Sub
|
||||
Private Sub CreaObjetosVenta(Etiqueta As String, Optional VistaPrevia As Boolean = False)
|
||||
Private Sub CreaObjetosVenta(Optional VistaPrevia As Boolean = False)
|
||||
Dim ObjFolios As New ClsGralFolios()
|
||||
Dim Folio As String = ""
|
||||
Dim Serie As String = ""
|
||||
@@ -472,7 +501,7 @@ Partial Class Contratos_FacturacionMasiva
|
||||
ObjFactura.MetodoPago = "Efectivo"
|
||||
ObjFactura.FechaPago = DateTime.Today
|
||||
ObjFactura.MotivoDescuento = ""
|
||||
ObjFactura.Observaciones = Etiqueta + " " + TxtObservaciones.Text + " " + DR("Observaciones").ToString
|
||||
ObjFactura.Observaciones = TxtObservaciones.Text + " " + DR("Observaciones").ToString
|
||||
ObjFactura.FechaEjecucion = DateTime.Today
|
||||
'ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {1}")
|
||||
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
|
||||
@@ -553,9 +582,9 @@ Partial Class Contratos_FacturacionMasiva
|
||||
DtR("CodigoPS") = row("CodigoPS")
|
||||
DtR("SATClaveProdServ") = row("SATClaveProdServ")
|
||||
DtR("NoIdentificacion") = row("NoIdentificacion")
|
||||
DtR("CveTipoPS") = DrPS("CveTipoPS")
|
||||
DtR("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
|
||||
DtR("Obs") = Etiqueta + " " + TxtObservaciones.Text + " " + row("Observacion").ToString
|
||||
DtR("CveTipoPS") = drPS("CveTipoPS")
|
||||
DtR("CveTipoInvPS") = drPS("Inv_CveMetodoInventario")
|
||||
DtR("Obs") = TxtObservaciones.Text + " " + row("Observacion").ToString
|
||||
DtR("PU") = row("PU")
|
||||
DtR("IVA") = row("PorcentajeIVA")
|
||||
DtR("PorcentajeIVA") = row("PorcentajeIVA")
|
||||
|
||||
Reference in New Issue
Block a user