Commit inicial Ventas Productivo
This commit is contained in:
284
GPS/FacturasSims.aspx.vb
Normal file
284
GPS/FacturasSims.aspx.vb
Normal file
@@ -0,0 +1,284 @@
|
||||
Option Strict On
|
||||
Imports System.Data
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Linq
|
||||
Imports System.Web
|
||||
Imports System.Web.UI.WebControls
|
||||
Imports Extensiones
|
||||
Imports GemBox.Spreadsheet
|
||||
|
||||
Partial Class GPS_FacturasSims
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "Propiedades"
|
||||
Private Property RcveGpsFacturaSim() As Int32
|
||||
Get
|
||||
Return If(IsNothing(ViewState("RcveGpsFacturaSim")), 0, CInt(ViewState("RcveGpsFacturaSim")))
|
||||
End Get
|
||||
Set
|
||||
ViewState("RcveGpsFacturaSim") = Value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CcveGpsFacturaSim() As Int32
|
||||
Get
|
||||
Return If(IsNothing(ViewState("CcveGpsFacturaSim")), 0, CInt(ViewState("CcveGpsFacturaSim")))
|
||||
End Get
|
||||
Set
|
||||
ViewState("CcveGpsFacturaSim") = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
|
||||
CargaFacturasSims()
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub CargaFacturasSims()
|
||||
Dim ObjFact As New ClsGPS()
|
||||
Dim periodo As Integer = 0 ' DateTime.Now.ToString("yyyyMM").ToEntero()
|
||||
TxtPeriodo.Text = TxtPeriodo.Text.Replace("_", "0")
|
||||
If TxtPeriodo.Text.Trim().Length > 6 Then
|
||||
periodo = String.Format("{1}{0}", TxtPeriodo.Text.Substring(0, 2), TxtPeriodo.Text.Substring(3, 4)).ToEntero()
|
||||
'Alert(String.Format("{1}{0}", TxtPeriodo.Text.Substring(0, 2), TxtPeriodo.Text.Substring(3, 4)))
|
||||
ElseIf TxtPeriodo.Text.Trim().Length > 5 Then
|
||||
periodo = String.Format("{1}{0}", TxtPeriodo.Text.Substring(0, 2), TxtPeriodo.Text.Substring(2, 4)).ToEntero()
|
||||
ElseIf TxtPeriodo.Text.Trim().Length > 4 Then
|
||||
periodo = String.Format("0{1}0{0}", TxtPeriodo.Text.Substring(0, 1), TxtPeriodo.Text.Substring(1, 4)).ToEntero()
|
||||
'Alert(String.Format("{1}0{0}", TxtPeriodo.Text.Substring(0, 1), TxtPeriodo.Text.Substring(1, 4)))
|
||||
End If
|
||||
ObjFact.GetFacturasSims(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, periodo)
|
||||
GVFacturasSims.DataSource = ObjFact.DtResultados
|
||||
ObjFact.Dispose()
|
||||
GVFacturasSims.DataBind()
|
||||
upDatosFact.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkAgregarFact_Click(sender As Object, e As EventArgs)
|
||||
RegistraScript("$('#DModalFacturasSims').modal()")
|
||||
BtnFactADD.Visible = True
|
||||
UPModalFact.Update()
|
||||
End Sub
|
||||
Protected Sub BtnFactADD_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim nTelefono As String = ""
|
||||
Dim fechaCorte As String = ""
|
||||
Dim cuentaPadre As Integer = 0
|
||||
Dim cuentaHijo As Integer = 0
|
||||
Dim nFactura As String = ""
|
||||
Dim plan As String = ""
|
||||
Dim importePlanySerContr As Decimal = 0
|
||||
Dim importeConsuAdicNaci As Decimal = 0
|
||||
Dim importeConsuAdicInternaci As Decimal = 0
|
||||
Dim importeServCompl As Decimal = 0
|
||||
Dim importeAjustes As Decimal = 0
|
||||
Dim importeDescuentos As Decimal = 0
|
||||
Dim importeServiciosSusc As Decimal = 0
|
||||
Dim importeServiciosSuscTerceros As Decimal = 0
|
||||
Dim importeEquipo As Decimal = 0
|
||||
Dim importeServXCuentaTerc As Decimal = 0
|
||||
Dim importeIVA As Decimal = 0
|
||||
Dim importe As Decimal = 0
|
||||
|
||||
Dim cveGpsFacturaSim As Integer = 0
|
||||
Dim detTipo As Integer = 0
|
||||
Dim detConceptos As String = ""
|
||||
Dim detincluidos As Decimal = 0
|
||||
Dim detconsumidos As Decimal = 0
|
||||
Dim detexcedentes As Decimal = 0
|
||||
Dim dettotal As Decimal = 0
|
||||
|
||||
|
||||
|
||||
Dim excelfile As Archivo = TxtCalibracion.getfiles().Archivos(0)
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet())
|
||||
Dim EF As GemBox.Spreadsheet.ExcelFile = GemBox.Spreadsheet.ExcelFile.Load(excelfile.FileUrl)
|
||||
Dim TempEdcta As New DataTable
|
||||
Dim Tempplanyserv As New DataTable()
|
||||
Dim TempConsumoAdicional As New DataTable
|
||||
Dim TempConsumoAdicionalintmundial As New DataTable
|
||||
If True Then
|
||||
Dim Hoja As ExcelWorksheet = EF.Worksheets(1)
|
||||
Dim Opciones As New CreateDataTableOptions()
|
||||
Opciones.ColumnHeaders = True
|
||||
Opciones.StartRow = 5
|
||||
Opciones.NumberOfColumns = 21
|
||||
Opciones.NumberOfRows = Hoja.Rows.Count
|
||||
Opciones.Resolution = ColumnTypeResolution.AutoPreferStringInvariantCulture
|
||||
TempEdcta = Hoja.CreateDataTable(Opciones)
|
||||
TempEdcta.Columns(4).ColumnName = "AdsTelefono"
|
||||
End If
|
||||
If True Then
|
||||
Dim Hoja As ExcelWorksheet = EF.Worksheets(2)
|
||||
Dim Opciones As New CreateDataTableOptions()
|
||||
Opciones.ColumnHeaders = True
|
||||
Opciones.StartRow = 1
|
||||
Opciones.NumberOfColumns = 11
|
||||
Opciones.NumberOfRows = Hoja.Rows.Count
|
||||
Opciones.Resolution = ColumnTypeResolution.AutoPreferStringInvariantCulture
|
||||
Tempplanyserv = Hoja.CreateDataTable(Opciones)
|
||||
Tempplanyserv.Columns(4).ColumnName = "AdsTelefono"
|
||||
Tempplanyserv.Columns(7).ColumnName = "AdsConceptos"
|
||||
End If
|
||||
If True Then
|
||||
Dim Hoja As ExcelWorksheet = EF.Worksheets(3)
|
||||
Dim Opciones As New CreateDataTableOptions()
|
||||
Opciones.ColumnHeaders = True
|
||||
Opciones.StartRow = 1
|
||||
Opciones.NumberOfColumns = 13
|
||||
Opciones.NumberOfRows = Hoja.Rows.Count
|
||||
Opciones.Resolution = ColumnTypeResolution.AutoPreferStringInvariantCulture
|
||||
TempConsumoAdicional = Hoja.CreateDataTable(Opciones)
|
||||
TempConsumoAdicional.Columns(4).ColumnName = "AdsTelefono"
|
||||
TempConsumoAdicional.Columns(7).ColumnName = "AdsConceptos"
|
||||
End If
|
||||
If True Then
|
||||
Dim Hoja As ExcelWorksheet = EF.Worksheets(4)
|
||||
Dim Opciones As New CreateDataTableOptions()
|
||||
Opciones.ColumnHeaders = True
|
||||
Opciones.StartRow = 1
|
||||
Opciones.NumberOfColumns = 13
|
||||
Opciones.NumberOfRows = Hoja.Rows.Count
|
||||
Opciones.Resolution = ColumnTypeResolution.AutoPreferStringInvariantCulture
|
||||
TempConsumoAdicionalintmundial = Hoja.CreateDataTable(Opciones)
|
||||
TempConsumoAdicionalintmundial.Columns(4).ColumnName = "AdsTelefono"
|
||||
TempConsumoAdicionalintmundial.Columns(7).ColumnName = "AdsConceptos"
|
||||
End If
|
||||
'Dim xs As New StringBuilder()
|
||||
Dim ObjFact As New ClsGPS()
|
||||
ObjFact.IniciaTransacSQL()
|
||||
Dim Continuar As Boolean = True
|
||||
For Each row As DataRow In TempEdcta.Rows
|
||||
|
||||
nTelefono = row(4).ToString()
|
||||
If nTelefono.Length > 5 Then
|
||||
|
||||
fechaCorte = DateTime.ParseExact(row(6).ToString(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy-MM-dd")
|
||||
cuentaPadre = row(2).ToString().ToEntero()
|
||||
cuentaHijo = row(3).ToString().ToEntero()
|
||||
nFactura = row(7).ToString()
|
||||
plan = row(8).ToString()
|
||||
importePlanySerContr = row(9).ToString().ToDecimal()
|
||||
importeConsuAdicNaci = row(10).ToString().ToDecimal()
|
||||
importeConsuAdicInternaci = row(11).ToString().ToDecimal()
|
||||
importeServCompl = row(12).ToString().ToDecimal()
|
||||
importeAjustes = row(13).ToString().ToDecimal()
|
||||
importeDescuentos = row(14).ToString().ToDecimal()
|
||||
importeServiciosSusc = row(15).ToString().ToDecimal()
|
||||
importeServiciosSuscTerceros = row(16).ToString().ToDecimal()
|
||||
importeEquipo = row(17).ToString().ToDecimal()
|
||||
importeServXCuentaTerc = row(18).ToString().ToDecimal()
|
||||
importeIVA = row(19).ToString().ToDecimal()
|
||||
importe = row(20).ToString().ToDecimal()
|
||||
If Continuar Then Continuar = ObjFact.AddFacturasSims(nTelefono, fechaCorte, cuentaPadre, cuentaHijo, nFactura, plan, importePlanySerContr, importeConsuAdicNaci,
|
||||
importeConsuAdicInternaci, importeServCompl, importeAjustes, importeDescuentos, importeServiciosSusc,
|
||||
importeServiciosSuscTerceros, importeEquipo, importeServXCuentaTerc, importeIVA, importe)
|
||||
If Continuar Then
|
||||
cveGpsFacturaSim = ObjFact.DtResultados.Rows(0)("cveGpsFacturaSim").ToString.ToEntero()
|
||||
If Continuar Then
|
||||
For Each rowd As DataRow In Tempplanyserv.FiltraParametros(String.Format("AdsTelefono = '{0}' AND AdsConceptos<> '-'", nTelefono)).Rows
|
||||
|
||||
detTipo = 1
|
||||
detConceptos = rowd(7).ToString()
|
||||
detincluidos = rowd(8).ToString().ToDecimal()
|
||||
detconsumidos = rowd(9).ToString().ToDecimal()
|
||||
detexcedentes = 0
|
||||
dettotal = rowd(10).ToString().ToDecimal()
|
||||
Continuar = ObjFact.AddFacturasSimsDetalle(cveGpsFacturaSim, detTipo, detConceptos, detincluidos, detconsumidos, detexcedentes, dettotal)
|
||||
Next
|
||||
End If
|
||||
If Continuar Then
|
||||
For Each rowd As DataRow In TempConsumoAdicional.FiltraParametros(String.Format("AdsTelefono = '{0}' AND AdsConceptos<> '-'", nTelefono)).Rows
|
||||
detTipo = 2
|
||||
detConceptos = rowd(7).ToString()
|
||||
detincluidos = rowd(9).ToString().ToDecimal()
|
||||
detconsumidos = rowd(10).ToString().ToDecimal()
|
||||
detexcedentes = rowd(11).ToString().ToDecimal()
|
||||
dettotal = rowd(12).ToString().ToDecimal()
|
||||
Continuar = ObjFact.AddFacturasSimsDetalle(cveGpsFacturaSim, detTipo, detConceptos, detincluidos, detconsumidos, detexcedentes, dettotal)
|
||||
|
||||
Next
|
||||
End If
|
||||
If Continuar Then
|
||||
For Each rowd As DataRow In TempConsumoAdicionalintmundial.FiltraParametros(String.Format("AdsTelefono = '{0}' AND AdsConceptos<> '-'", nTelefono)).Rows
|
||||
detTipo = 3
|
||||
detConceptos = rowd(7).ToString()
|
||||
detincluidos = rowd(9).ToString().ToDecimal()
|
||||
detconsumidos = rowd(10).ToString().ToDecimal()
|
||||
detexcedentes = rowd(11).ToString().ToDecimal()
|
||||
dettotal = rowd(12).ToString().ToDecimal()
|
||||
Continuar = ObjFact.AddFacturasSimsDetalle(cveGpsFacturaSim, detTipo, detConceptos, detincluidos, detconsumidos, detexcedentes, dettotal)
|
||||
Next
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
'xs.Append("<br/> Tel. ")
|
||||
'xs.Append(nTelefono)
|
||||
Next
|
||||
If Continuar Then
|
||||
ObjFact.Commit()
|
||||
Else
|
||||
ObjFact.RollBack()
|
||||
End If
|
||||
'Alert(xs.ToString()) '
|
||||
ObjFact.Dispose()
|
||||
If (Continuar) Then
|
||||
RegistraScript("$('#DModalFacturasSims').modal('hide')")
|
||||
CargaFacturasSims()
|
||||
UPModalFact.Update()
|
||||
Alert("La Factura se ha agregado")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkOcultarDesglose_Click(sender As Object, e As EventArgs)
|
||||
GVFacturasSims.CssClass = GVFacturasSims.CssClass.Replace(" mostrardesglose", "")
|
||||
End Sub
|
||||
Protected Sub LnkMostrarDesglose_Click(sender As Object, e As EventArgs)
|
||||
GVFacturasSims.CssClass = String.Format("{0} mostrardesglose", GVFacturasSims.CssClass.Replace(" mostrardesglose", ""))
|
||||
End Sub
|
||||
Protected Sub LnkMostrarDRegistrados_Click(sender As Object, e As EventArgs)
|
||||
GVFacturasSims.CssClass = String.Format("{0} MostrarDRegistrados", GVFacturasSims.CssClass.Replace(" MostrarDRegistrados", ""))
|
||||
End Sub
|
||||
Protected Sub LnkOcultarDRegistrados_Click(sender As Object, e As EventArgs)
|
||||
GVFacturasSims.CssClass = GVFacturasSims.CssClass.Replace(" MostrarDRegistrados", "")
|
||||
End Sub
|
||||
Protected Sub LnkMostrarDTelcel_Click(sender As Object, e As EventArgs)
|
||||
GVFacturasSims.CssClass = String.Format("{0} MostrarDTelcel", GVFacturasSims.CssClass.Replace(" MostrarDTelcel", ""))
|
||||
End Sub
|
||||
Protected Sub LnkOcultarDTelcel_Click(sender As Object, e As EventArgs)
|
||||
GVFacturasSims.CssClass = GVFacturasSims.CssClass.Replace(" MostrarDTelcel", "")
|
||||
End Sub
|
||||
Protected Sub GVFacturasSims_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim PlanImporte As Decimal = e.Row.DBCampo("PlanImporte").ToString().ToDecimal()
|
||||
Dim Importe As Decimal = e.Row.DBCampo("Importe").ToString().ToDecimal()
|
||||
If Importe > PlanImporte Then
|
||||
e.Row.CssClass = "ImporteFail"
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub LnkVerDEtalle_Click(sender As Object, e As EventArgs)
|
||||
Dim gvrow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
LtlNumeroConceptos.Text = gvrow.DataKey("NTelefono")
|
||||
Dim CveGpsFacturaSim As Integer = gvrow.DataKey("CveGpsFacturaSim").ToEntero()
|
||||
Dim objgps As New ClsGPS()
|
||||
objgps.GetFacturasSimsDetalle(CveGpsFacturaSim)
|
||||
GVGetFacturasSimsDetalle.DataSource = objgps.DtResultados
|
||||
objgps.Dispose()
|
||||
GVGetFacturasSimsDetalle.DataBind()
|
||||
RegistraScript("$('#DModalConceptos').modal();")
|
||||
UpConceptos.Update()
|
||||
End Sub
|
||||
Protected Sub GVGetFacturasSimsDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("EsTitulo").ToString() = "1" Then
|
||||
e.Row.CssClass = "Titulo"
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub LnkConsultar_Click(sender As Object, e As EventArgs)
|
||||
CargaFacturasSims()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user