diff --git a/AC/Reportes/RepEstadoActividades.rdlc b/AC/Reportes/RepEstadoActividades.rdlc index ccef55f1d..931f42736 100644 --- a/AC/Reportes/RepEstadoActividades.rdlc +++ b/AC/Reportes/RepEstadoActividades.rdlc @@ -754,7 +754,7 @@ - Resultados del Ejercicio (Ahorro/Desahorro): + Resultados del ejercicio(Utilidad o pérdida): + + + + + Evaluaciones de Proveedores + + +
  • + PDF +
  • +
  • + Excel +
  • +
    + + + +
    +
    +
    + + "> + +
    +
    +
    + +
    Proveedor
    +
    + +
    + +
    Fecha Inicio
    +
    +
    + + + + +
    + + + +
    + +
    Fecha Fin
    +
    +
    + + + + +
    + + +
    + +
    Evaluado
    +
    + + - + Sin Evaluar + Evaluar + +
    +
    + +
    +
    +
    > +
    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + <%-- --%> + \ No newline at end of file diff --git a/Compras/RepEvaluacionesProveedores.aspx.vb b/Compras/RepEvaluacionesProveedores.aspx.vb new file mode 100644 index 000000000..ff60e4eb8 --- /dev/null +++ b/Compras/RepEvaluacionesProveedores.aspx.vb @@ -0,0 +1,75 @@ +Imports System.Data +Imports Extensiones +Imports Microsoft.Reporting.WebForms + +Partial Class RepEvaluacionesProveedores + Inherits ClsPaginas + + Private Property DtDatos As DataTable + Get + DtDatos = DirectCast(ViewState("DtDatos"), DataTable) + End Get + + Set(ByVal value As DataTable) + ViewState("DtDatos") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CargaParametrosBusqueda() + CargarDatos() + End If + End Sub + + Private Sub CargaParametrosBusqueda() + DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + DdlProveedor.DataBind() + DdlProveedor.Items.Insert(0, New ListItem("Todos", "-1")) + + Dim dNow As Date = Now + TxtFechaF.Text = dNow.ToString("dd/MM/yyyy") + dNow = dNow.AddDays(-30) + TxtFechaI.Text = dNow.ToString("dd/MM/yyyy") + End Sub + + Private Sub CargarDatos() + Dim ObjCompras As New ClsCompras + If ObjCompras.GetRepEvaluacionesProveedores(UsuarioActual.CveEmpresa, DdlProveedor.SelectedValue.ToEntero, TxtFechaI.Text, TxtFechaF.Text, DdlEvaluado.SelectedValue.ToEntero) Then + GV.DataSource = ObjCompras.DtResultados + DtDatos = ObjCompras.DtResultados + End If + ObjCompras.Dispose() + GV.DataBind() + UPDatos.Update() + End Sub + + Public Sub btConsultar_Click(sender As Object, e As EventArgs) Handles btConsultar.Click + CargarDatos() + End Sub + + Private Sub LnkPDF_Click(sender As Object, e As EventArgs) Handles LnkPDF.Click + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) + If Imagen.Exists Then + params.Add(New ReportParameter("pImg", logouri)) + Else + params.Add(New ReportParameter("pImg", "")) + End If + params.Add(New ReportParameter("FechaInicial", TxtFechaI.Text)) + params.Add(New ReportParameter("FechaFinal", TxtFechaF.Text)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Today)) + params.Add(New ReportParameter("Proveedor", DdlProveedor.SelectedItem.ToString)) + + + ImprimirPDF("Empresas/Grales/Formatos/RepEvaluacionesProveedores.rdlc", DtDatos, params, "RepEvaluacionesProveedores", "PDF", RDSName:="DataSet1") + End Sub + + Public Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + GV.ExportToExcel("Evaluaciones de Proveedores" & Now.ToShortDateString & ".xls") + End Sub +End Class \ No newline at end of file diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb index 071e8c784..206ab0252 100644 --- a/Contabilidad/RegPrePoliza.aspx.vb +++ b/Contabilidad/RegPrePoliza.aspx.vb @@ -171,6 +171,10 @@ Partial Class ContabilidadC_RegPrePoliza Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Page.IsPostBack Then + If UsuarioActual.Empresa.TipoContabilizacion = 1 Then + Response.Redirect(Request.Url.PathAndQuery.Replace("RegPrePoliza", "RegPrePolizaS")) + End If + CveMoneda = 1 ViewState("CvePrePoliza") = 0 ViewState("CvePeriodo") = "0" diff --git a/Contabilidad/RegPrePoliza1.aspx.vb b/Contabilidad/RegPrePoliza1.aspx.vb index 36f359c07..396eb55d9 100644 --- a/Contabilidad/RegPrePoliza1.aspx.vb +++ b/Contabilidad/RegPrePoliza1.aspx.vb @@ -175,18 +175,7 @@ Partial Class ContabilidadC_RegPrePoliza Beneficiario = "-1" Actualizar = False - Dim dt As DataTable = Nothing - If UsuarioActual.Empresa.UsaContabilidad Then - Dim Conta As New ClsContPAQi(UsuarioActual.Empresa) - - If Conta.GetCuentas(-1, "-1", 1) Then - dt = Conta.DtResultados - DtCuentasContables = Conta.DtResultados - Session("DtCuentas") = Conta.DtResultados - End If - Conta.Dispose() - - If IfNull(Request("Tipo"), "").ToString = "NOMPROV" Then + If IfNull(Request("Tipo"), "").ToString = "NOMPROV" Then DivTipoGasto.Visible = True ThTipoGasto.Visible = True CargaTiposGasto() @@ -250,14 +239,9 @@ Partial Class ContabilidadC_RegPrePoliza GvMov.Columns(4).Visible = False End If - Else - Alert("Este módulo requiere el uso de Contabilidad.", TipoMensaje.MsgAdvertencia) - BtnIEGuardar.Enabled = False - BtnEliminar.Visible = False - LbAgregar.Enabled = False - End If - End If + + End If End Sub diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx new file mode 100644 index 000000000..42dc3d8b6 --- /dev/null +++ b/Contabilidad/RegPrePolizaS.aspx @@ -0,0 +1,883 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RegPrePolizaS.aspx.vb" Inherits="ContabilidadC_RegPrePolizaS" %> + + + + + + + + + + + + +
  • + Crear Complemento de Pago +
  • + + +
  • + Agregar Concepto +
  • +
    +
    +
    + + + + + + +
    + + + +
    +
    +
    + +
    +
    + + + + +
    + + + + + + + +
    + + + +
    + +
    + + +
    + +
    + +
    + + + + + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    + +
    + +
    + + +
    + + + +
    + +
    +
    + +
    + +
    +
    +
    + +
    + + + + +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    Concepto + Cta. ContableReferenciaDescripciónSubProyectoCargoAbonoComandos
    + +
    + +
    +
    + + +
    +
    +
    + +
    +
    + + + + + +
    +
    + + + + + + +
    +
    +
    +
    +
    +
    +
    + + + +
    + +
    + + + + + +
    + + +
    +
    + + + + +
    + + + + + + + +
    + + +
    + +
    + +
    +
    + +
    + Si +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    CuentaReferenciaDescripciónSubProyecto +
    +
    +
    Tipo GastoRef. BancariaCargoAbono
    + +
    + + + + Cuenta + +
    + +
    + +
    + + Referencia + + + + + + + Concepto + + + + + + + SubProyecto + + + + + + + TipoGasto + + + + + + + Ref. Bancaria + + + + + + + Cargo + + + + + + + Abono + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    +
    +
    +
    + + + +
    + + + + Movimiento + +
    +<%-- + + + + + --%> +
    + +
    + + + Documento + + +
    +
    + +
    + + + Referencia + +
    +
    + +
    + + + Concepto + +
    +
    + +
    + + + SubProyecto + <%-- --%> + + +
    + <%----%> + <%--
    --%> +
    + +
    + + TipoGasto + +
    + <%----%> + <%----%> +
    + +
    + + Cuenta + +
    + <%----%> + <%--
    --%> +
    + +
    + + TC + +
    +
    + +
    + + Cargo + +
    +
    +
    + <%-- + --%> +
    +
    + + Abono + +
    +
    +
    + <%-- + --%> +
    +
    + + + + + + + + +
    + + + +
    +
    +
    +
    + + + + + + + + + + + +
      + +
    + + + + + + + + +
    + + + + + + + + + + +
    + + + diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb new file mode 100644 index 000000000..3ab52f059 --- /dev/null +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -0,0 +1,1702 @@ + + +Imports System.Data +Imports Extensiones +Imports System.Linq +Imports System.Web.Services + +Partial Class ContabilidadC_RegPrePolizaS + Inherits ClsPaginas + + +#Region "Propiedades" + Public Property ArregloMovs As ArrayList + Get + Return CType(ViewState("ArregloMovs"), ArrayList) + End Get + Set(value As ArrayList) + ViewState("ArregloMovs") = value + End Set + End Property + Public Property DtMovimientos As DataTable + Get + Return CType(ViewState("DtMovimientos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtMovimientos") = value + End Set + End Property + Public Property DtCuentasContables As DataTable + Get + Return CType(ViewState("DtCuentasContables"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtCuentasContables") = value + End Set + End Property + Public Property TipoPlantilla As Integer + Get + Return CType(ViewState("TipoPlantilla"), Integer) + End Get + Set(value As Integer) + ViewState("TipoPlantilla") = value + End Set + End Property + Public Property CveMoneda As Integer + Get + Return CType(ViewState("CveMoneda"), Integer) + End Get + Set(value As Integer) + ViewState("CveMoneda") = value + End Set + End Property + Private ReadOnly Property CvePrePoliza As Integer + Get + Return ViewState("CvePrePoliza").ToString.ToEntero + End Get + End Property + + 'PARA CREAR IE + Private Property CveConcepto As Integer + Get + Return ViewState("CveConcepto").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveConcepto") = value + End Set + End Property + Private Property CveTipoTransaccion As Integer + Get + Return ViewState("CveTipoTransaccion").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveTipoTransaccion") = value + End Set + End Property + Private Property CveCuenta As Integer + Get + Return ViewState("CveCuenta").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCuenta") = value + End Set + End Property + Private Property Folio As String + Get + Return ViewState("Folio").ToString + End Get + Set(value As String) + ViewState("Folio") = value + End Set + End Property + Private Property ImporteDocumento As Decimal + Get + Return ViewState("ImporteDocumento").ToString.ToDecimal + End Get + Set(value As Decimal) + ViewState("ImporteDocumento") = value + End Set + End Property + Private Property Observaciones As String + Get + Return ViewState("Observaciones").ToString + End Get + Set(value As String) + ViewState("Observaciones") = value + End Set + End Property + Private Property Beneficiario As String + Get + Return ViewState("Beneficiario").ToString + End Get + Set(value As String) + ViewState("Beneficiario") = value + End Set + End Property + Private Property RowIndex As Integer + Get + Return ViewState("RowIndex").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("RowIndex") = value + End Set + End Property + Private Property Actualizar As Boolean + Get + Return CBool(ViewState("Actualizar").ToString) + End Get + Set(value As Boolean) + ViewState("Actualizar") = value + End Set + End Property + + Private ReadOnly Property CvePeriodo As Integer + Get + Return CType(ViewState("CvePeriodo"), Integer) + End Get + End Property + Private ReadOnly Property CveProyecto As Integer + Get + Return CType(ViewState("CveProyecto"), Integer) + End Get + End Property + Private ReadOnly Property CveSubProyecto As Integer + Get + Return CType(ViewState("CveSubProyecto"), Integer) + End Get + End Property + Private ReadOnly Property CveTurno As Integer + Get + Return CType(ViewState("CveTurno"), Integer) + End Get + End Property + Public Property IndiceGrid As Integer + Get + Return CType(ViewState("IndiceGrid"), Integer) + End Get + Set(value As Integer) + ViewState("IndiceGrid") = value + End Set + End Property +#End Region + + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load + + If Not Page.IsPostBack Then + CveMoneda = 1 + ViewState("CvePrePoliza") = 0 + ViewState("CvePeriodo") = "0" + CveConcepto = -1 + CveTipoTransaccion = -1 + CveCuenta = -1 + Folio = "-1" + ImporteDocumento = -1 + Observaciones = "-1" + Beneficiario = "-1" + Actualizar = False + + If IfNull(Request("Tipo"), "").ToString = "NOMPROV" Then + DivTipoGasto.Visible = True + ThTipoGasto.Visible = True + CargaTiposGasto() + End If + + If Request("CvePrePoliza") IsNot Nothing AndAlso IsNumeric(Request("CvePrePoliza")) AndAlso Request("CvePrePoliza").ToEntero > 0 Then + ViewState("CvePrePoliza") = Request("CvePrePoliza").ToEntero + CreaDT() + CargaPrePoliza() + If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then + GvPrePoliza.Columns(5).Visible = False + DivTG.Visible = False + GvMov.Columns(5).Visible = False + End If + Exit Sub + Else + CreaDT() + BtnEliminar.Visible = False + End If + + + TipoPlantilla = 0 + If IfNull(Request("Tipo"), "").ToString = "Ing" Then + TipoPlantilla = 1 + LblEncabezado.Text = "Otros Ingresos" + End If + + CargaPlantillas(TipoPlantilla) + + If UsuarioActual.CveRol = 1 Then trNotificar.Visible = True + + CargaConceptos() + CargaSubProyectos() + CargaCuentasContables() + + 'crea tabla temporal + ArregloMovs = New ArrayList + + CargaCuentas() + + If Request("CvePeriodo") IsNot Nothing AndAlso IsNumeric(Request("CvePeriodo")) AndAlso Request("CvePeriodo").ToEntero > 0 Then + ViewState("CvePeriodo") = Request("CvePeriodo").ToEntero + ViewState("CveProyecto") = Request("CveProyecto").ToEntero + ViewState("CveSubProyecto") = Request("CveSubProyecto").ToEntero + ViewState("CveTurno") = Request("CveTurno").ToEntero + + DdlPlantilla.Items.Add(New ListItem("Pago Nomina", "61")) + DdlPlantilla.SelectedValue = "61" + DdlPlantilla.Enabled = False + DivAgregarConceptos.Visible = False + + CargaNomina() + + RegistraScript("$(document).ready(function () { calculateCargo(); Sys.Application.add_load(function (s, e) { calculateCargo(); }); } );", 1) + RegistraScript("$(document).ready(function () { calculateAbono(); Sys.Application.add_load(function (s, e) { calculateAbono(); }); } );", 2) + RegistraScript("$(document).ready(function () { comparar(); Sys.Application.add_load(function (s, e) { comparar(); }); } );", 3) + End If + + If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then + GvPrePoliza.Columns(4).Visible = False + GvMov.Columns(4).Visible = False + End If + + + + End If + + End Sub + + Private Sub CreaDT() + DtMovimientos = New DataTable("Movimientos") + Dim IDMov As DataColumn = DtMovimientos.Columns.Add("IdMov", Type.GetType("System.Int32")) : IDMov.AutoIncrement = True + With DtMovimientos.Columns + .Add("IdCuenta", Type.GetType("System.Int32")) + .Add("CodigoCuenta", Type.GetType("System.String")) + .Add("Cuenta", Type.GetType("System.String")) + .Add("Referencia", Type.GetType("System.String")) + .Add("Concepto", Type.GetType("System.String")) + .Add("Cargo", Type.GetType("System.Double")) + .Add("Abono", Type.GetType("System.Double")) + .Add("TipoMovto", Type.GetType("System.Int32")) + .Add("EsComodin", Type.GetType("System.Int32")) + .Add("CveConcepto", Type.GetType("System.Int32")) + .Add("CveSubProyecto", Type.GetType("System.Int32")) + .Add("Descripcion", Type.GetType("System.String")) + .Add("CveProveedor", Type.GetType("System.Int32")) + .Add("CvePersonal", Type.GetType("System.Int32")) + .Add("CveCompra", Type.GetType("System.Int32")) + .Add("CveCliente", Type.GetType("System.Int32")) + .Add("CveVenta", Type.GetType("System.Int32")) + .Add("CveClasificacion", Type.GetType("System.Int32")) + .Add("MultipleSubProyecto", Type.GetType("System.Boolean")) + .Add("CveTipoGasto", Type.GetType("System.Int32")) + .Add("CvePrePolizaDetalle", Type.GetType("System.Int32")) + .Add("CveConceptoContable", Type.GetType("System.Int32")) + .Add("IdCtaContable", Type.GetType("System.Int32")) + .Add("ConceptoContable", Type.GetType("System.String")) + End With + End Sub + + Private Sub CargaNomina() + Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero + Dim ObjNomina As New ClsNominas + Dim ObjConta As New ClsContabilidad + + Dim Dt As DataTable = Nothing + Dim Cuenta As String = "" + Dim Concepto As String = "" + Dim IdCuenta As Integer = 0 + Dim TipoMovto As Integer + Dim CveConcepto As Integer + Dim CodigoCuenta As String = "" + Dim NombreCuenta As String = "" + Dim Referencia As String = "" + Dim EsComodin As Integer = 0 + DtMovimientos.Clear() + + If ObjNomina.GetProvisionNomina(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, UsuarioActual.CveEmpresa) Then + Dt = ObjNomina.DtResultados + + For Each drt As DataRow In Dt.Rows + Dim dr As DataRow = DtMovimientos.NewRow + + If drt("NombreCompleto").ToString = "" AndAlso ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa) Then + CveConcepto = 98 + Cuenta = "Nominas por Pagar" + IdCuenta = ObjConta.DtResultados(0)("IdCtaContable").ToString.ToEntero + Concepto = "Pago Nomina" + Referencia = "Pago Nomina" + Else + Concepto = drt("NombreCompleto") + Referencia = "" + CveConcepto = drt("CveConceptoContable").ToString.ToEntero + Cuenta = drt("ConceptoContable").ToString + IdCuenta = drt("IdCtaContable").ToString.ToEntero + End If + + Dim drr As DataRow = DtCuentasContables.FiltroPrimero($"Id={IdCuenta}") + CodigoCuenta = If(drr IsNot Nothing, drr("CuentaFormato").ToString(), "") + NombreCuenta = If(drr IsNot Nothing, drr("Nombre").ToString(), "") + + TipoMovto = drt("TipoMovto") + + If TipoMovto = 0 Then + dr("Cargo") = Math.Abs(drt("Importe").ToString.ToDecimal) + dr("Abono") = 0 + Else + dr("Cargo") = 0 + dr("Abono") = Math.Abs(drt("Importe").ToString.ToDecimal) + End If + + dr("IdCuenta") = IdCuenta + dr("CodigoCuenta") = CodigoCuenta & "
    " & NombreCuenta + dr("Cuenta") = Cuenta + dr("Concepto") = Concepto + dr("Descripcion") = Concepto + dr("Referencia") = Referencia + dr("TipoMovto") = TipoMovto + dr("EsComodin") = EsComodin + dr("CveConcepto") = CveConcepto + dr("CveProveedor") = "-1" + dr("CveSubProyecto") = drt("CveSubProyecto") + dr("CvePersonal") = drt("CvePersonal") + dr("CveClasificacion") = drt("CveClasificacion") + dr("CveTipoGasto") = drt("CveTipoGasto") + + DtMovimientos.Rows.Add(dr) + Next + + GvMov.DataSource = DtMovimientos + GvMov.DataBind() + UPMovs.Update() + End If + + End Sub + + Private Sub CargaPrePoliza() + BtnEliminar.Visible = True + LblEncabezado.Text = "Edición de Póliza" + + Dim ObjContabilidad As New ClsContabilidad + If ObjContabilidad.GetPrePoliza(CvePrePoliza, UsuarioActual.CveEmpresa) Then + Dim dr As DataRow = ObjContabilidad.DtResultados.FiltroPrimero("") + If dr IsNot Nothing Then + DivAgregarConceptos.Visible = False + DdlTipoPoliza.SelectedValue = dr("CveTipoPoliza") + TxtFechaDocumento.Text = dr("Fecha") + TxtConcepto.Text = dr("Concepto") + DivDatosPoliza.Visible = True + + If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then + 'DivAgregarConceptos.Visible = True + LnkAddConcepto.Visible = True + CargaConceptos() + CargaSubProyectos() + CargaCuentasContables() + End If + + ObjContabilidad.GetContabilizacionDiarioDetalle(CvePrePoliza) + + DtMovimientos = ObjContabilidad.DtResultados.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}") + GvPrePoliza.DataSource = DtMovimientos + GvPrePoliza.DataBind() + + If UsuarioActual.CveRol = 1 AndAlso DtMovimientos.COUNT("TC", "TC > 1") > 0 Then + GvPrePoliza.Columns(7).Visible = True + End If + + If DtMovimientos.FiltraParametros("CveConceptoContable IN (2,17)").Rows.Count > 0 Then + LnkComplementoPago.Visible = True + End If + + If dr("IdPoliza").ToString.ToEntero > 0 Then + HplContabilizada.NavigateUrl = String.Format("RegPoliza.aspx?IdPoliza={0}", dr("IdPoliza")) + divContabilziada.Visible = True + ElseIf TxtTotalCargos.Text.ToDouble = TxtTotalAbonos.Text.ToDouble Then + 'sino está contabilizada, se activa el botón + BtnContabilizar.Visible = True + End If + + divDatosPrincipales.Visible = False + divObservaciones.Visible = False + UPMovs.Visible = False + UPMovs.Update() + UPPDocumento.Update() + UpPrePoliza.Update() + + RegistraScript("comparar();") + + If Request("Tipo") IsNot Nothing AndAlso IsNumeric(Request("Tipo")) AndAlso Request("Tipo").ToEntero = 1 AndAlso UsuarioActual.CveUsuario <> 100 Then + 'For Each row As GridViewRow In GvPrePoliza.Rows + ' row.FCTextBox("TxtCargo").Enabled = False + ' row.FCTextBox("TxtAbono").Enabled = False + 'Next + End If + + Else + Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia) + BtnEliminar.Visible = False + End If + + End If + + ObjContabilidad.Dispose() + UpPoliza.Update() + End Sub + + Private Sub GvPrePoliza_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPrePoliza.RowDataBound + + If e.Row.RowType = DataControlRowType.DataRow Then + + ''Asignamos los Subproyectos + 'e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + 'e.Row.FCDropDownList("DdlSubProyecto").DataBind() + 'e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) + 'e.Row.FCDropDownList("DdlSubProyecto").SelectedValueExist(e.Row.DataKey("CveSubProyecto")) + + 'Asignamos los Tipos de Gasto + 'e.Row.FCDropDownList("DdlTipoGasto").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) + 'e.Row.FCDropDownList("DdlTipoGasto").DataBind() + 'e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1")) + 'e.Row.FCDropDownList("DdlTipoGasto").SelectedValueExist(e.Row.DataKey("CveTipoGasto")) + + 'ASignamos las CuentasContables + 'e.Row.FCDropDownList("DdlCtaContable").DataSource = Session("DtCuentas") + 'e.Row.FCDropDownList("DdlCtaContable").DataBind() + 'e.Row.FCDropDownList("DdlCtaContable").Items.Insert(0, New ListItem("Sin Asignar", "0")) + 'e.Row.FCDropDownList("DdlCtaContable").SelectedValueExist(e.Row.DataKey("IdCtaContable")) + + If e.Row.DataKey("IdCtaContable") > 0 Then + Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", e.Row.DataKey("IdCtaContable"))) + If drr IsNot Nothing Then + e.Row.FCLiteral("DdlCtaContable").Text = drr("CuentaFormato").ToString() + " - " + drr("Nombre").ToString() + End If + End If + + TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCLiteral("TxtCargo").Text.ToDouble).ToString.FormatoNumero + TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + e.Row.FCLiteral("TxtAbono").Text.ToDouble).ToString.FormatoNumero + + Dim CveConceptoContable As Integer = e.Row.DataKey("CveConceptoContable").ToEntero + + If CveConceptoContable.Contiene(1, 2, 13, 38, 207, 203, 39, 61, 62, 63) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DataKey("CveVenta")) + If CveConceptoContable.Contiene(5, 6, 17, 18, 14, 19, 25, 26, 60, 234, 235, 240) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DataKey("CveCompra")) + If CveConceptoContable.Contiene(68) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", e.Row.DBCampo("CveMovimientoAlmacen")) + If CveConceptoContable.Contiene(30, 204) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE")) + + 'e.Row.FCHyperLink("HlReferencia").NavigateUrl = CveConceptoContable + + End If + + If e.Row.RowType = DataControlRowType.Header Then + 'e.Row.FCDropDownList("DdlSubProyectoFiltro").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + 'e.Row.FCDropDownList("DdlSubProyectoFiltro").DataBind() + 'e.Row.FCDropDownList("DdlSubProyectoFiltro").Items.Insert(0, New ListItem("Todos", "-1")) + End If + + End Sub + + Private Sub CargaPlantillas(TipoPlantilla As Integer) + + 'GvPlantillas.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, TipoPlantilla) + 'GvPlantillas.DataBind() + + DdlPlantilla.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, TipoPlantilla) + DdlPlantilla.DataBind() + DdlPlantilla.Items.Insert(0, New ListItem("Plantilla Personalizada", "53")) + End Sub + + Private Sub CargaConceptos() + DdlConceptosContables.DataSource = GlobalDTContaConceptosContables(-1) + DdlConceptosContables.DataBind() + End Sub + + Private Sub DdlConceptosContables_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContables.SelectedIndexChanged + If DdlConceptosContables.SelectedValue.ToEntero.Contiene(5, 17, 201, 206, 14, 15, 16, 19, 25, 26, 21) Then + CargaProveedores() + DdlProveedores.Visible = True + DdlCompras.Visible = True + Else + DdlProveedores.Visible = False + DdlCompras.Visible = False + End If + + If DdlConceptosContables.SelectedValue.ToEntero.Contiene(28, 29) Then + CargaPersonal() + DdlPersonal.Visible = True + Else + DdlPersonal.Visible = False + End If + If DdlConceptosContables.SelectedValue.ToEntero.Contiene(1, 2, 203, 207, 13, 61, 8, 9, 62, 63, 38, 39) Then + CargaClientes() + DdlClientes.Visible = True + DdlVentas.Visible = True + Else + DdlClientes.Visible = False + DdlVentas.Visible = False + End If + End Sub + + Private Sub DdlProveedores_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProveedores.SelectedIndexChanged + CargaCompras(DdlProveedores.SelectedValue.ToEntero) + End Sub + + Private Sub DdlClientes_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientes.selectedindexchange + CargaVentas(DdlClientes.SelectedValue.ToEntero) + End Sub + + Private Sub CargaSubProyectos() + DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + DdlSubProyecto.Items.Insert(0, New ListItem(" - ", "-1")) + DdlSubProyectoFiltroMov.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyectoFiltroMov.DataBind() + DdlSubProyectoFiltroMov.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub + + Private Sub CargaCuentasContables() + DdlCtaContable.DataSource = Session("DtCuentas") + DdlCtaContable.DataBind() + DdlCtaContable.Items.Insert(0, New ListItem("Sin Asignar", "0")) + End Sub + + Private Sub CargaTiposGasto() + DdlTipoGasto.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) + DdlTipoGasto.DataBind() + DdlTipoGasto.Items.Insert(0, New ListItem("Sin Asignar", "0")) + End Sub + + Private Sub CargaProveedores() + DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + DdlProveedores.DataBind() + DdlProveedores.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + + Private Sub CargaCompras(CveProveedor As Integer) + If Not DdlConceptosContables.SelectedValue.ToEntero.Contiene(21) Then + Dim ObjCompras As New ClsCompras + + DdlCompras.ClearSelection() + If ObjCompras.GetCompras(-1, "-1", "-1", CveProveedor, -1, UsuarioActual.CveEmpresa) Then + DdlCompras.DataSource = ObjCompras.DtResultados.FiltraParametros("Saldo > 0") + DdlCompras.DataBind() + DdlCompras.Items.Insert(0, New ListItem(" - ", "-1")) + Else + DdlCompras.DataSource = Nothing + DdlCompras.DataBind() + DdlCompras.Items.Insert(0, New ListItem(" - ", "-1")) + End If + ObjCompras.Dispose() + End If + End Sub + + Private Sub CargaClientes() + DdlClientes.setEsWebService(True) + DdlClientes.Attributes.Add("data-metodo", "getcliente") + DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) + DdlClientes.DataBind() + ' DdlClientes.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + + Private Sub CargaVentas(CveCliente As Integer) + Dim ObjVentas As New ClsVentas + + DdlVentas.ClearSelection() + If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1", CveCliente, -1, -1, -1, "-1", "-1", "-1", CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + DdlVentas.DataSource = ObjVentas.DtResultados '.FiltraParametros("Saldo > 0") + DdlVentas.DataBind() + DdlVentas.Items.Insert(0, New ListItem(" - ", "-1")) + Else + DdlVentas.DataSource = Nothing + DdlVentas.DataBind() + DdlVentas.Items.Insert(0, New ListItem(" - ", "-1")) + End If + ObjVentas.Dispose() + End Sub + + Private Sub CargaPersonal() + DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) + DdlPersonal.DataBind() + DdlPersonal.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + + + Protected Sub DdlPlantilla_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPlantilla.SelectedIndexChanged + + TxtTotalAbonos.Text = "" + TxtTotalCargos.Text = "" + + If DdlPlantilla.SelectedValue.ToEntero <= 0 Then + Alert("Seleccione un Movimiento Válido", TipoMensaje.MsgAdvertencia) + DdlPlantilla.SelectedValue = "-1" + Exit Sub + End If + + If DdlPlantilla.SelectedValue.ToEntero = 53 Then 'Plantilla Personalizada + DivAgregarConceptos.Visible = True + Else + DivAgregarConceptos.Visible = False + End If + + + + Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero + + Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden") + Dim Cuenta As String = "" + Dim IdCuenta As Integer = 0 + Dim CodigoCuenta As String = "" + Dim NombreCuenta As String = "" + Dim EsComodin As Integer = 0 + DtMovimientos.Clear() + + For Each drt As DataRow In Dt.Rows + + Cuenta = drt("ConceptoContable").ToString + IdCuenta = 0 + CodigoCuenta = "" + NombreCuenta = "" + If drt("IdCtaContable").ToString.ToEntero > 0 Then 'DtCuentasContables + Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString)) + If drr IsNot Nothing Then + IdCuenta = drt("IdCtaContable").ToString.ToEntero + CodigoCuenta = drr("CuentaFormato").ToString() + NombreCuenta = drr("Nombre").ToString() + 'Cuenta = drr("Nombre").ToString() + End If + EsComodin = 0 + End If + + Dim dr As DataRow = DtMovimientos.NewRow + dr("IdCuenta") = IdCuenta + dr("CodigoCuenta") = CodigoCuenta & "
    " & NombreCuenta + dr("Cuenta") = Cuenta 'TxtCuentaContable.Text + dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial")) + dr("Concepto") = TxtObservaciones.Text + dr("TipoMovto") = If(drt("TipoMovto").ToString = "False", 0, 1) + dr("EsComodin") = EsComodin + dr("CveConcepto") = drt("CveConcepto") + dr("CveSubProyecto") = drt("CveSubProyectoNegativo") + dr("Cargo") = TxtCargo.Text.ToDouble + dr("Abono") = TxtAbono.Text.ToDouble + dr("CveProveedor") = drt("CveProveedor") + dr("CvePersonal") = drt("CvePersonal") + dr("CveClasificacion") = -1 + dr("MultipleSubProyecto") = drt("MultipleSubProyecto") + DtMovimientos.Rows.Add(dr) + Next + + + GvMov.DataSource = DtMovimientos + GvMov.DataBind() + UPMovs.Update() + + End Sub + + Protected Sub GvMov_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvMov.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left + e.Row.Height = Unit.Pixel(1) + e.Row.Cells(0).ToolTip = e.Row.DBCampo("IdCuenta") + + If e.Row.DBCampo("TipoMovto") = "1" Then + e.Row.FCTextBox("TxtAbono").Visible = True + Else + e.Row.FCTextBox("TxtCargo").Visible = True + End If + + e.Row.FCTextBox("TxtAbono").Text = If(e.Row.DBCampo("Abono") = 0, "", e.Row.DBCampo("Abono")) + e.Row.FCTextBox("TxtCargo").Text = If(e.Row.DBCampo("Cargo") = 0, "", e.Row.DBCampo("Cargo")) + e.Row.FCTextBox("TxtConcepto").Text = e.Row.DBCampo("Descripcion") + + If CvePeriodo > 0 Then + e.Row.FCTextBox("TxtCargo").Enabled = False + e.Row.FCTextBox("TxtAbono").Enabled = False + End If + + e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + e.Row.FCDropDownList("DdlSubProyecto").DataBind() + e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) + e.Row.FCDropDownList("DdlSubProyecto").SelectedValue = e.Row.DBCampo("CveSubProyecto") + + 'Asignamos los Tipos de Gasto + e.Row.FCDropDownList("DdlTipoGasto").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) + e.Row.FCDropDownList("DdlTipoGasto").DataBind() + e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1")) + e.Row.FCDropDownList("DdlTipoGasto").SelectedValue = e.Row.DBCampo("CveTipoGasto") + + If DdlPlantilla.SelectedValue.ToEntero = 53 Then 'Plantilla Personalizada + e.Row.FCDropDownList("DdlSubProyecto").Enabled = True + e.Row.FCImageButton("imgD").Visible = True + Else + e.Row.FCDropDownList("DdlSubProyecto").Enabled = False + End If + + If e.Row.DBCampo("MultipleSubProyecto") = "True" Then + e.Row.FCDropDownList("DdlSubProyecto").Enabled = True + End If + + 'Agregamos la opcion para vincular los movimientos bancarios + If e.Row.DataKey("CveConcepto").ToEntero.Contiene(41) Then + Dim ObjMovimientos As New ClsMovimientos + Dim DdlSaldos As DropDownList = e.Row.FCDropDownList("DdlSaldos") + + Select Case e.Row.DataKey("CveConcepto").ToEntero + + 'Acreedores + Case 41 + If (ObjMovimientos.GetAcreedoresSaldosDetalles(-1, CveMoneda, UsuarioActual.CveEmpresa)) Then + DdlSaldos.Visible = True + DdlSaldos.DataSource = ObjMovimientos.DtResultados.FiltraParametros($"CveIE > 0 AND CveProveedor = {e.Row.DataKey("CveProveedor").ToEntero}") + DdlSaldos.DataBind() + DdlSaldos.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + + End Select + + ObjMovimientos.Dispose() + End If + + If e.Row.DataKey("CveConcepto").ToEntero.Contiene(30) Then + e.Row.FCLinkButton("ImgBancos").Visible = True + + + If CveTipoTransaccion > 0 And CveCuenta > 0 And Folio.Length > 0 And ImporteDocumento > 0 And Beneficiario.Length > 0 Then + e.Row.FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green" + End If + End If + End If + End Sub + + Protected Sub BtnIEGuardar_Click(sender As Object, e As EventArgs) Handles BtnIEGuardar.Click + Dim TotalCargos, TotalAbonos As Decimal + + If CvePrePoliza > 0 Then + TotalCargos = TxtTotalCargos.Text.ToDecimal + TotalAbonos = TxtTotalAbonos.Text.ToDecimal + Else + For Each Gvr As GridViewRow In GvMov.Rows + TotalCargos += Gvr.FCTextBox("TxtCargo").Text.ToDecimal + TotalAbonos += Gvr.FCTextBox("TxtAbono").Text.ToDecimal + Next + End If + + If Not (TotalCargos = TotalAbonos AndAlso (GvPrePoliza.Rows.Count > 0 Or GvMov.Rows.Count > 0)) Then + Alert($"La suma de los movimientos no son iguales ({TotalCargos}-{TotalAbonos})", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If CvePrePoliza > 0 Then + 'Nuevo Modulo Charlie + ActualizarPrePoliza() + Else + Dim MensajeAlert = New StringBuilder + Dim ObjIE As New ClsBancos() + Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) + Dim ObjNom As New ClsNominas(ObjIE.IniciaTransacSQL) + Dim Conta As ClsContPAQi = Nothing + Dim IDPoliza As Integer = 0 + Dim MsgError As String = "" + Dim CveIE As Integer + Dim FolioIE As String = "" + + Try + Dim CvePrePoliza As Integer + Dim ConceptoPoliza As String = TxtObservaciones.Text + CvePrePoliza = ObjMov.AddPrePolizas("Contabilidad/RegPrePoliza", DdlPlantilla.SelectedValue.ToEntero, TotalCargos, TotalAbonos, 1, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPolizaAdd.SelectedValue.ToEntero) + + If CvePrePoliza > 0 Then + Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

    " + Dim idCuentaContabilizacion As Long = 1 + Dim Importe As Double = 0 + Dim TipoMovto As Boolean = False + Dim IdCtaContable As Integer = 0 + + 'Registra movimieno bancario + If CveConcepto = 30 Then + CveIE = ObjIE.AddBancos_IE(CveCuenta, CveTipoTransaccion, TxtFecha.Text, Folio, Beneficiario, ImporteDocumento, CveMoneda, 0, Observaciones, "", False, False, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveIE < 0 Then MsgError = "No se pudo registrar movimiento bancario" + If ObjIE.GetBancosIE(CveIE, -1, -1, "-1", -1, "-1", "-1", -1, -1, -1, -1, -1, MinFecha, MaxFecha, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then + FolioIE = ObjIE.Folio + End If + End If + + + + 'inserto las compras que voy a pagarDdlSaldos + For Each gvr As GridViewRow In GvMov.Rows + If gvr.DataKey("IDCuenta").ToEntero > 0 Then + IdCtaContable = gvr.DataKey("IDCuenta") + End If + + If gvr.DataKey("TipoMovto").ToDouble > 0 Then + Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble + TipoMovto = True + Else + Importe = gvr.FCTextBox("TxtCargo").Text.ToDouble + TipoMovto = False + End If + + If CveConcepto = 41 Then + CveIE = gvr.FCDropDownList("DdlSaldos").SelectedValue.ToEntero + Else + CveIE = -1 + End If + + + If idCuentaContabilizacion = 1 AndAlso (IdCtaContable = 0) Then + idCuentaContabilizacion = 0 + End If + If Importe > 0 Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConcepto").ToEntero, gvr.FCTextBox("TxtConcepto").Text, + TxtFecha.Text.ToDate, IdCtaContable, -1, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CveIE:=CveIE, + CveProveedor:=gvr.DataKey("CveProveedor").ToEntero, CveCompra:=gvr.DataKey("CveCompra").ToEntero, + CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero, + ImporteMX:=Importe, CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, + CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero) Then + Else + MsgError = "No se pudo insertar el detalle de la póliza2" + Exit For + End If + End If + Next + + 'El movimiento 2 es el de Pago + If ChkAutoConta.Checked AndAlso UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then + If idCuentaContabilizacion > 0 Then + If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + + 'MENSAJE PRINCIPAL + MensajeAlert.AppendFormat("

    Folio de Salida: {1}", ObjMov.ContaIdPoliza, ObjMov.ContaFolio) + 'Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion) + Else + Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico") + End If + Else + Alert("No se puede contabilizar la Prepoliza debido a que una o mas cuentas son inválidas") + End If + End If + If CvePeriodo > 0 Then + If Not ObjNom.UpdateProvisionNomina(CvePeriodo, CvePrePoliza, UsuarioActual.CveEmpresa) Then + MsgError = "No se pudo actualizar el periodo de la nómina" + End If + End If + + If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 1) Then + If ObjMov.ValorPolizaDescuadre > 0 Then + GuardaLogAD($"Contabilidad/RegPrePolizas | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + MsgError = ObjMov.MensajePolizaDescuadre + End If + End If + + Else + MsgError = "No se pudo insertar la póliza" + End If + Catch ex As Exception + MsgError = "Error" + End Try + + If MsgError = "" Then + 'MENSAJE IE + If CveIE Then + MensajeAlert.AppendFormat("

    Folio Bancario: {1}", CveIE, FolioIE) + Alert(MensajeAlert.ToString, ModExtensiones.TipoMensaje.MsgInformacion, "window.location.reload()") + Else + Alert(If(MensajeAlert.ToString = "", "Se registro con exito.", MensajeAlert.ToString), TipoMensaje.MsgInformacion, "window.location.reload()") + End If + + ObjIE.Commit() + If Conta IsNot Nothing Then Conta.Commit() + + UPPDocumento.Update() + + TxtObservaciones.Text = "" + GvMov.DataBind() + TxtFecha.Text = "" + TxtObservaciones.Text = "" + Else + ObjIE.RollBack() + If Conta IsNot Nothing Then Conta.RollBack() + End If + + ObjIE.Dispose() + ObjMov.Dispose() + If Conta IsNot Nothing Then Conta.Dispose() + End If + End Sub + + Private Sub ActualizarPrePoliza() + + Dim OcurrioError As Boolean = False + Dim ObjContabilidad As New ClsContabilidad + ObjContabilidad.IniciaTransacSQL() + + ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate) + + For Each row As GridViewRow In GvPrePoliza.Rows + If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then + If Not ObjContabilidad.UpdatePrepolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCLiteral("TxtConcepto").Text, row.DataKey("CveSubProyecto").ToEntero, + row.DataKey("IdCtaContable").ToEntero, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, + row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero), + CveConceptoContable:=row.DataKey("CveConceptoContable").ToEntero, CveProveedor:=row.DataKey("CveProveedor").ToEntero, CveCompra:=row.DataKey("CveCompra").ToEntero, + CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, CvePersonal:=row.DataKey("CvePersonal").ToEntero, Referencia:=row.FCLiteral("TxtRef").Text) Then + OcurrioError = True + Exit For + End If + Else + If Not ObjContabilidad.AddPrePolizasDetalle(CvePrePoliza, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, + row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), row.DataKey("Referencia").ToString, + row.DataKey("CveConceptoContable").ToEntero, row.FCLiteral("TxtConcepto").Text, Now, + row.DataKey("IdCtaContable").ToEntero, 0, CveSubProyecto:=row.DataKey("CveSubProyecto").ToEntero, + CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero), + ImporteMX:=If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, + row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveProveedor:=row.DataKey("CveProveedor").ToEntero, + CveCompra:=row.DataKey("CveCompra").ToEntero, CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, + CvePersonal:=row.DataKey("CvePersonal").ToEntero) Then + OcurrioError = True + Exit For + End If + End If + + Next + + If Not OcurrioError Then + ObjContabilidad.Commit() + Alert("La PrePoliza se actualizó correctamente.", TipoMensaje.MsgInformacion) + Else + ObjContabilidad.RollBack() + Alert("Ocurrio un error al actualizar la PrePoliza.", TipoMensaje.MsgError) + End If + + ObjContabilidad.Dispose() + CargaPrePoliza() + End Sub + Protected Sub LnkAddConcepto_Click(sender As Object, e As EventArgs) + RegistraScript(String.Format("$('#{0}').modal();", "DivEditConcepto")) + LtlTitulo.Text = "Agregar Concepto" + BtnAceptar.Text = "Agregar" + LimpiaCampos() + + CargaConceptosContablesE() + CargaSubProyectoE() + CargaTipoGastoE() + CargaCtaContableE() + + + UpdatePanel1.Update() + End Sub + Protected Sub GvPrePoliza_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvPrePoliza.RowUpdating + RegistraScript(String.Format("$('#{0}').modal();", "DivEditConcepto")) + LtlTitulo.Text = "Editar Concepto" + BtnAceptar.Text = "Aceptar" + LimpiaCampos() + IndiceGrid = e.RowIndex + + Dim CveConceptoContable As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveConceptoContable").ToEntero + Dim CveProveedor As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveProveedor").ToEntero + Dim CveCompra As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveCompra").ToEntero + Dim CvePersonal As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CvePersonal").ToEntero + Dim CveCliente As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveCliente").ToEntero + Dim CveVenta As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveVenta").ToEntero + 'Dim FolioFactura As String = GvPrePoliza.Rows(IndiceGrid).FCHyperLink("HlReferencia").Text + Dim Concepto As String = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtConcepto").Text + Dim Referencia As String = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtRef").Text + Dim CveSubProyecto As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveSubProyecto").ToString.ToEntero + Dim CveTipoGasto As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveTipoGasto").ToString.ToEntero + Dim IdCtaContable As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("IdCtaContable").ToString.ToEntero + Dim Cargo As Double = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtCargo").Text.ToDouble + Dim Abono As Double = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtAbono").Text.ToDouble + + CargaConceptosContablesE() + DdlConceptosContablesE.SelectedValueExist(CveConceptoContable) + DdlConceptosContablesE_SelectedIndexChanged(DdlConceptosContablesE, e) + + DdlProveedoresE.SelectedValueExist(CveProveedor) + DdlProveedoresE_SelectedIndexChanged(DdlProveedoresE, e) + DdlComprasE.SelectedValueExist(CveCompra) + + DdlPersonalE.SelectedValueExist(CvePersonal) + + DdlClientesE.SelectedValue = CveCliente + DdlClientesE.SelectedText = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("NombreComercial", $"CveCliente={CveCliente}") + DdlClientesE_SelectedIndexChanged(DdlClientesE, e) + DdlVentasE.SelectedValueExist(CveVenta) + + TxtConceptoE.Text = Concepto + TxtReferenciaE.Text = Referencia + + CargaSubProyectoE() + DdlSubProyectoE.SelectedValueExist(CveSubProyecto) + CargaTipoGastoE() + DdlTipoGastoE.SelectedValueExist(CveTipoGasto) + CargaCtaContableE() + DdlCtaContableE.SelectedValueExist(IdCtaContable) + + If Cargo <> 0 Then + TxtCargoE.Text = Cargo + End If + + If Abono <> 0 Then + TxtAbonoE.Text = Abono + End If + + UpdatePanel1.Update() + + End Sub + Private Sub LimpiaCampos() + IndiceGrid = -1 + TxtConceptoE.Text = "" + TxtCargoE.Text = "" + TxtAbonoE.Text = "" + TxtReferenciaE.Text = "" + End Sub + Private Sub CargaConceptosContablesE() + DdlConceptosContablesE.DataSource = GlobalDTContaConceptosContables(-1) + DdlConceptosContablesE.DataBind() + End Sub + Private Sub CargaSubProyectoE() + DdlSubProyectoE.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyectoE.DataBind() + DdlSubProyectoE.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + Private Sub CargaTipoGastoE() + DdlTipoGastoE.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) + DdlTipoGastoE.DataBind() + DdlTipoGastoE.Items.Insert(0, New ListItem("Sin Asignar", "0")) + End Sub + Private Sub CargaCtaContableE() + DdlCtaContableE.DataSource = Session("DtCuentas") + DdlCtaContableE.DataBind() + DdlCtaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0")) + End Sub + Private Sub DdlConceptosContablesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContablesE.SelectedIndexChanged + If DdlConceptosContablesE.SelectedValue.ToEntero.Contiene(5, 17, 201, 206, 14, 15, 16, 19, 25, 26, 21) Then + CargaProveedoresE() + DdlProveedoresE.Visible = True + DdlComprasE.Visible = True + Else + DdlProveedoresE.Visible = False + DdlComprasE.Visible = False + End If + + If DdlConceptosContablesE.SelectedValue.ToEntero.Contiene(28, 29) Then + CargaPersonalE() + DdlPersonalE.Visible = True + Else + DdlPersonalE.Visible = False + End If + If DdlConceptosContablesE.SelectedValue.ToEntero.Contiene(1, 2, 203, 207, 13, 61, 8, 9, 62, 63, 38, 39) Then + CargaClientesE() + DdlClientesE.Visible = True + DdlVentasE.Visible = True + Else + DdlClientesE.Visible = False + DdlVentasE.Visible = False + End If + End Sub + Private Sub CargaProveedoresE() + DdlProveedoresE.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) + DdlProveedoresE.DataBind() + DdlProveedoresE.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + Private Sub CargaComprasE(CveProveedor As Integer) + If Not DdlConceptosContablesE.SelectedValue.ToEntero.Contiene(21) Then + Dim ObjCompras As New ClsCompras + + DdlComprasE.ClearSelection() + If ObjCompras.GetCompras(-1, "-1", "-1", CveProveedor, -1, UsuarioActual.CveEmpresa) Then + DdlComprasE.DataSource = ObjCompras.DtResultados.FiltraParametros("Saldo > 0") + DdlComprasE.DataBind() + DdlComprasE.Items.Insert(0, New ListItem(" - ", "-1")) + Else + DdlComprasE.DataSource = Nothing + DdlComprasE.DataBind() + DdlComprasE.Items.Insert(0, New ListItem(" - ", "-1")) + End If + ObjCompras.Dispose() + End If + End Sub + Private Sub CargaClientesE() + DdlClientesE.setEsWebService(True) + DdlClientesE.Attributes.Add("data-metodo", "getcliente") + DdlClientesE.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) + DdlClientesE.DataBind() + ' DdlClientes.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + Private Sub CargaVentasE(CveCliente As Integer) + Dim ObjVentas As New ClsVentas + + DdlVentasE.ClearSelection() + If ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1", CveCliente, -1, -1, -1, "-1", "-1", "-1", CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + DdlVentasE.DataSource = ObjVentas.DtResultados '.FiltraParametros("Saldo > 0") + DdlVentasE.DataBind() + DdlVentasE.Items.Insert(0, New ListItem(" - ", "-1")) + Else + DdlVentasE.DataSource = Nothing + DdlVentasE.DataBind() + DdlVentasE.Items.Insert(0, New ListItem(" - ", "-1")) + End If + ObjVentas.Dispose() + End Sub + Private Sub CargaPersonalE() + DdlPersonalE.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) + DdlPersonalE.DataBind() + DdlPersonalE.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + Private Sub DdlProveedoresE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProveedoresE.SelectedIndexChanged + CargaComprasE(DdlProveedoresE.SelectedValue.ToEntero) + End Sub + Private Sub DdlClientesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClientesE.selectedindexchange + CargaVentasE(DdlClientesE.SelectedValue.ToEntero) + End Sub + Protected Sub BtnAceptar_Click(sender As Object, e As EventArgs) Handles BtnAceptar.Click + + If IndiceGrid = -1 Then + If DtMovimientos Is Nothing Then CreaDT() + If CvePrePoliza > 0 Then + Dim dr As DataRow = DtMovimientos.NewRow + dr("IdCtaContable") = DdlCtaContableE.SelectedValue + dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text + dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue + dr("Concepto") = TxtConceptoE.Text + dr("Referencia") = TxtReferenciaE.Text + dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, 0, 1) + dr("Cargo") = TxtCargoE.Text.ToDouble + dr("Abono") = TxtAbonoE.Text.ToDouble + dr("ImporteMN") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, TxtCargoE.Text.ToDouble, TxtAbonoE.Text.ToDouble) + dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue + dr("SubProyecto") = DdlSubProyectoE.SelectedItem.Text + dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero + dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero + dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero + dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero + dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero + dr("FolioFactura") = If(DdlComprasE.Visible = True, DdlComprasE.SelectedItem.ToString, If(DdlVentasE.Visible = True, DdlVentasE.SelectedItem.ToString, "")) + + + TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbonoE.Text.ToDouble).ToString.FormatoNumero + TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargoE.Text.ToDouble).ToString.FormatoNumero + DtMovimientos.Rows.Add(dr) + DtMovimientos.AcceptChanges() + + If CvePrePoliza > 0 Then + GvPrePoliza.DataSource = DtMovimientos + GvPrePoliza.DataBind() + UpPrePoliza.Update() + End If + Else + 'Dim dr As DataRow = DtMovimientos.NewRow + 'Dim CodigoCuenta As String = "" + 'Dim NombreCuenta As String = "" + + 'dr("IdCuenta") = DdlCtaContableE.SelectedValue + + 'If DdlCtaContableE.SelectedValue.ToEntero > 0 Then + ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContableE.SelectedValue)) + ' If drr IsNot Nothing Then + ' CodigoCuenta = drr("CuentaFormato").ToString() + ' NombreCuenta = drr("Nombre").ToString() + ' End If + 'End If + + 'dr("CodigoCuenta") = CodigoCuenta & "
    " & NombreCuenta + 'dr("Cuenta") = DdlConceptosContablesE.SelectedItem.Text + 'dr("Referencia") = TxtReferenciaE.Text + 'dr("Concepto") = TxtConceptoE.Text + 'dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, 0, 1) + 'dr("EsComodin") = 0 + 'dr("CveConcepto") = DdlConceptosContablesE.SelectedValue + 'dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue + 'dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text + 'dr("Cargo") = TxtCargoE.Text.ToDouble + 'dr("Abono") = TxtAbonoE.Text.ToDouble + ''dr("Descripcion") = TxtDescripcionE.Text + 'dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue + 'dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero + 'dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero + 'dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero + 'dr("CveClasificacion") = -1 + 'dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero + 'dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero + + 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbonoE.Text.ToDouble).ToString.FormatoNumero + 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargoE.Text.ToDouble).ToString.FormatoNumero + 'DtMovimientos.Rows.Add(dr) + 'DtMovimientos.AcceptChanges() + + 'GvMov.DataSource = DtMovimientos + 'GvMov.DataBind() + 'UPMovs.Update() + 'Actualizar = False + + End If + Else + Dim CvePrePolizaDetalle As Integer = GvPrePoliza.DataKeys(IndiceGrid).Value.ToString.ToEntero + Dim Rows As DataRow() = DtMovimientos.Select("CvePrePolizaDetalle = " & CvePrePolizaDetalle) + + If Rows.Count > 0 Then + Dim dr As DataRow = Rows(0) + dr("IdCtaContable") = DdlCtaContableE.SelectedValue + dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text + dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue + dr("Concepto") = TxtConceptoE.Text + dr("Referencia") = TxtReferenciaE.Text + dr("TipoMovto") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, 0, 1) + dr("ImporteMN") = If(Math.Abs(TxtCargoE.Text.ToDouble) > 0, TxtCargoE.Text.ToDouble, TxtAbonoE.Text.ToDouble) + dr("CveSubProyecto") = DdlSubProyectoE.SelectedValue + dr("SubProyecto") = DdlSubProyectoE.SelectedItem.Text + dr("CveProveedor") = DdlProveedoresE.SelectedValue.ToEntero + dr("CveCompra") = DdlComprasE.SelectedValue.ToEntero + dr("CvePersonal") = DdlPersonalE.SelectedValue.ToEntero + dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero + dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero + dr("FolioFactura") = If(DdlComprasE.Visible = True, DdlComprasE.SelectedItem.ToString, If(DdlVentasE.Visible = True, DdlVentasE.SelectedItem.ToString, "")) + + 'GvPrePoliza.Rows(IndiceGrid).FCHiddenField("HdnConceptoContable").Value = DdlConceptosContablesE.SelectedValue.ToEntero + 'GvPrePoliza.Rows(IndiceGrid).FCHiddenField("HdnProveedor").Value = DdlProveedoresE.SelectedValue.ToEntero + 'GvPrePoliza.Rows(IndiceGrid).FCHiddenField("HdnCompra").Value = DdlComprasE.SelectedValue.ToEntero + 'GvPrePoliza.Rows(IndiceGrid).FCHiddenField("HdnPersonal").Value = DdlPersonalE.SelectedValue.ToEntero + 'GvPrePoliza.Rows(IndiceGrid).FCHiddenField("HdnCliente").Value = DdlClientesE.SelectedValue.ToEntero + 'GvPrePoliza.Rows(IndiceGrid).FCHiddenField("HdnVenta").Value = DdlVentasE.SelectedValue.ToEntero + + 'GvPrePoliza.Rows(IndiceGrid).FCHiddenField("HdnSubProyecto").Value = DdlSubProyectoE.SelectedValue.ToEntero + 'GvPrePoliza.Rows(IndiceGrid).FCHiddenField("HdnTipoGasto").Value = DdlTipoGastoE.SelectedValue.ToEntero + 'GvPrePoliza.Rows(IndiceGrid).FCHiddenField("HdnCtaContable").Value = DdlCtaContableE.SelectedValue.ToEntero + + If TxtCargoE.Text <> "" Then + dr("Cargo") = TxtCargoE.Text.ToDouble + dr("Abono") = "".ToDouble + Else + dr("Abono") = TxtAbonoE.Text.ToDouble + dr("Cargo") = "".ToDouble + End If + + TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbonoE.Text.ToDouble).ToString.FormatoNumero + TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargoE.Text.ToDouble).ToString.FormatoNumero + DtMovimientos.AcceptChanges() + GvPrePoliza.EditIndex = -1 + + If CvePrePoliza > 0 Then + GvPrePoliza.DataSource = DtMovimientos + GvPrePoliza.DataBind() + UpPrePoliza.Update() + End If + + End If + End If + + UpPrePoliza.Update() + RegistraScript("$('#DivEditConcepto').modal('hide')", "hidemodal") + End Sub + Protected Sub GvMov_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvMov.RowDeleting + + Dim idMov As Integer = GvMov.DataKeys(e.RowIndex).Value.ToString.ToEntero + + Dim Rows As DataRow() = DtMovimientos.Select("IDMov = " & idMov) + If Rows.Count > 0 Then + DtMovimientos.Rows.Remove(Rows(0)) + DtMovimientos.AcceptChanges() + End If + GvMov.DataSource = DtMovimientos + GvMov.DataBind() + + TxtTotalAbonos.Text = DtMovimientos.SUM("Abono").FormatoNumero + TxtTotalCargos.Text = DtMovimientos.SUM("Cargo").FormatoNumero + + 'saco de la póliza el importe del cheque, que coincida la cuenta contable con la bancaria + + End Sub + + Private Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click + + If DtMovimientos Is Nothing Then CreaDT() + + If Actualizar Then + + Dim Rows As DataRow() = DtMovimientos.Select("IDMov = " & HdnCve.Value) + + If Rows.Count > 0 Then + Dim dr As DataRow = Rows(0) + Dim CodigoCuenta As String = "" + Dim NombreCuenta As String = "" + dr("IdCuenta") = DdlCtaContable.SelectedValue + + If DdlCtaContable.SelectedValue.ToEntero > 0 Then + Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue)) + If drr IsNot Nothing Then + CodigoCuenta = drr("CuentaFormato").ToString() + NombreCuenta = drr("Nombre").ToString() + End If + End If + + dr("CodigoCuenta") = CodigoCuenta & "
    " & NombreCuenta + dr("Cuenta") = DdlConceptosContables.SelectedItem + dr("Referencia") = TxtReferencia.Text + dr("Concepto") = TxtObservaciones.Text + dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) + dr("EsComodin") = 0 + dr("CveConcepto") = DdlConceptosContables.SelectedValue + dr("Cargo") = TxtCargo.Text.ToDouble + dr("Abono") = TxtAbono.Text.ToDouble + dr("Descripcion") = TxtDescripcion.Text + dr("CveSubProyecto") = DdlSubProyecto.SelectedValue + dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero + dr("CveCompra") = DdlCompras.SelectedValue.ToEntero + dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero + dr("CveClasificacion") = -1 + dr("CveCliente") = DdlClientes.SelectedValue.ToEntero + dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + End If + LbCancelarEdicion.Visible = False + LbAgregar.Text = "Agregar" + + Else + + If CvePrePoliza > 0 Then + Dim dr As DataRow = DtMovimientos.NewRow + dr("IdCtaContable") = DdlCtaContable.SelectedValue + dr("ConceptoContable") = DdlConceptosContables.SelectedItem.Text + dr("CveConceptoContable") = DdlConceptosContables.SelectedValue + dr("Concepto") = TxtDescripcion.Text + dr("Referencia") = TxtReferencia.Text + dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) + dr("Cargo") = TxtCargo.Text.ToDouble + dr("Abono") = TxtAbono.Text.ToDouble + dr("ImporteMN") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, TxtCargo.Text.ToDouble, TxtAbono.Text.ToDouble) + dr("CveSubProyecto") = DdlSubProyecto.SelectedValue + dr("SubProyecto") = DdlSubProyecto.SelectedItem.Text + dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero + dr("CveCompra") = DdlCompras.SelectedValue.ToEntero + dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero + dr("CveCliente") = DdlClientes.SelectedValue.ToEntero + dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + + + TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero + TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero + DtMovimientos.Rows.Add(dr) + DtMovimientos.AcceptChanges() + + If CvePrePoliza > 0 Then + GvPrePoliza.DataSource = DtMovimientos + GvPrePoliza.DataBind() + UpPrePoliza.Update() + End If + Else + Dim dr As DataRow = DtMovimientos.NewRow + Dim CodigoCuenta As String = "" + Dim NombreCuenta As String = "" + + dr("IdCuenta") = DdlCtaContable.SelectedValue + + If DdlCtaContable.SelectedValue.ToEntero > 0 Then + Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue)) + If drr IsNot Nothing Then + CodigoCuenta = drr("CuentaFormato").ToString() + NombreCuenta = drr("Nombre").ToString() + End If + End If + + dr("CodigoCuenta") = CodigoCuenta & "
    " & NombreCuenta + dr("Cuenta") = DdlConceptosContables.SelectedItem.Text + dr("Referencia") = TxtReferencia.Text + dr("Concepto") = TxtObservaciones.Text + dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) + dr("EsComodin") = 0 + dr("CveConcepto") = DdlConceptosContables.SelectedValue + dr("CveConceptoContable") = DdlConceptosContables.SelectedValue + dr("ConceptoContable") = DdlConceptosContables.SelectedItem.Text + dr("Cargo") = TxtCargo.Text.ToDouble + dr("Abono") = TxtAbono.Text.ToDouble + dr("Descripcion") = TxtDescripcion.Text + dr("CveSubProyecto") = DdlSubProyecto.SelectedValue + dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero + dr("CveCompra") = DdlCompras.SelectedValue.ToEntero + dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero + dr("CveClasificacion") = -1 + dr("CveCliente") = DdlClientes.SelectedValue.ToEntero + dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + + TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero + TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero + DtMovimientos.Rows.Add(dr) + DtMovimientos.AcceptChanges() + + 'If CvePrePoliza > 0 Then + ' GvPrePoliza.DataSource = DtMovimientos + ' GvPrePoliza.DataBind() + ' UpPrePoliza.Update() + 'End If + + GvMov.DataSource = DtMovimientos + GvMov.DataBind() + UPMovs.Update() + Actualizar = False + + End If + + End If + + TxtCargo.Text = "" + TxtAbono.Text = "" + TxtReferencia.Text = "" + TxtDescripcion.Text = "" + End Sub + +#Region "PESTAÑA INFORMACION GENERAL DE BANCO IE" + Public Sub Bancos_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + RowIndex = GvRow.RowIndex + + If GvRow.FCTextBox("TxtAbono").Text = "" Then + CargaTipoTransaccion("Ing") + Else + CargaTipoTransaccion("Egs") + End If + + + TxtDocumentoImporte.Text = If(GvRow.FCTextBox("TxtAbono").Text = "", GvRow.FCTextBox("TxtCargo").Text.FormatoNumero, GvRow.FCTextBox("TxtAbono").Text.FormatoNumero) + UpBancos.Update() + RegistraScript(String.Format("$('#{0}').modal();", "DivContadoModal")) + End Sub + Private Sub CargaTipoTransaccion(Tipo As String) + DdlTipoTransaccion.Items.Clear() + DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros($"Tipo = '{Tipo}'") + DdlTipoTransaccion.DataBind() + DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) + End Sub + Private Sub CargaCuentas() + DdlCuenta.Items.Clear() + DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario) '.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", DdlMoneda.SelectedValue)) + DdlCuenta.DataBind() + DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1")) + End Sub + Private Sub BtnContado_Click(sender As Object, e As EventArgs) Handles BtnContado.Click + CveConcepto = 30 + CveTipoTransaccion = DdlTipoTransaccion.SelectedValue.ToEntero + CveCuenta = DdlCuenta.SelectedValue.ToEntero + Folio = TxtDocumentoFolio.Text + ImporteDocumento = TxtDocumentoImporte.Text.ToDecimal + Observaciones = TxtDocumentoObservaciones.Text + Beneficiario = TxtDocumentoBeneficiario.Text + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivContadoModal")) + GvMov.Rows(RowIndex).FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green" + UPMovs.Update() + End Sub + + Private Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click + Dim ObjContabilidad As New ClsContabilidad + + If ObjContabilidad.RemovePrePolizas(CvePrePoliza, UsuarioActual.CveEmpresa) Then + Alert("La Prepóliza ha sido eliminada", TipoMensaje.MsgInformacion) + Else + Alert("La Prepóliza ha podido ser eliminada", TipoMensaje.MsgError) + End If + + ObjContabilidad.Dispose() + End Sub +#End Region + + Protected Sub DdlTipoGasto_SelectedIndexChanged(sender As Object, e As EventArgs) + If UpPrePoliza.Visible Then + For Each Gvr As GridViewRow In GvPrePoliza.Rows + Gvr.FCDropDownList("DdlTipoGasto").SelectedValueExist(DdlTipoGasto.SelectedValue) + Next + UpPrePoliza.Update() + End If + If UPMovs.Visible Then + For Each Gvr As GridViewRow In GvMov.Rows + Gvr.FCDropDownList("DdlTipoGasto").SelectedValueExist(DdlTipoGasto.SelectedValue) + Next + UPMovs.Update() + End If + End Sub + Protected Sub DdlSubProyectoFiltro_SelectedIndexChanged(sender As Object, e As EventArgs) + Dim Ddl As DropDownList = CType(sender, DropDownList) + For Each Gvr As GridViewRow In GvPrePoliza.Rows + If Ddl.SelectedValue.ToEntero > 0 Then + If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero = Ddl.SelectedValue.ToEntero Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero > 0 Then + Gvr.Visible = True + Else + Gvr.Visible = False + End If + Else + Gvr.Visible = True + End If + Next + UpPrePoliza.Update() + RegistraScript("calculateAbono()", "cargo") + RegistraScript("calculateCargo()", "abono") + RegistraScript("comparar()", "compara") + End Sub + Protected Sub DdlSubProyectoFiltroMov_SelectedIndexChanged(sender As Object, e As EventArgs) + For Each Gvr As GridViewRow In GvMov.Rows + If DdlSubProyectoFiltroMov.SelectedValue.ToEntero > 0 Then + If Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero = DdlSubProyectoFiltroMov.SelectedValue.ToEntero Or Not Gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero > 0 Then + Gvr.Visible = True + Else + Gvr.Visible = False + End If + Else + Gvr.Visible = True + End If + Next + UpPrePoliza.Update() + RegistraScript("calculateAbono()", "cargo") + RegistraScript("calculateCargo()", "abono") + RegistraScript("comparar()", "compara") + End Sub + + Private Sub GvMov_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvMov.RowEditing + Actualizar = True + GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero + Dim idMov As Integer = GvMov.DataKeys(e.NewEditIndex).Value.ToString.ToEntero + + Dim DrM As DataRow = DtMovimientos.Rows(e.NewEditIndex) + + If DrM IsNot Nothing Then + HdnCve.Value = idMov.ToString + + DdlCtaContable.SelectedValue = DrM("IdCuenta") + TxtReferencia.Text = DrM("Referencia") + TxtObservaciones.Text = DrM("Concepto") + ' (Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) = dr("TipoMovto") + DrM("EsComodin") = 0 + DdlConceptosContables.SelectedValue = DrM("CveConcepto").ToString + TxtCargo.Text = DrM("Cargo").ToString + TxtAbono.Text = DrM("Abono").ToString + TxtDescripcion.Text = DrM("Descripcion") + DdlSubProyecto.SelectedValue = DrM("CveSubProyecto") + DdlProveedores.SelectedValue = DrM("CveProveedor") + DdlCompras.SelectedValue = DrM("CveCompra") + DdlPersonal.SelectedValue = DrM("CvePersonal") + ' DrM("CveClasificacion") = -1 + DdlClientes.SelectedValue = DrM("CveCliente") + DdlVentas.SelectedValue = DrM("CveVenta") + LbCancelarEdicion.Visible = True + LbAgregar.Text = "Actualizar" + + End If + + UPPDocumento.Update() + DivAgregarConceptos.Visible = True + + 'If DtMovimientos Is Nothing Then CreaDT() + + 'Dim dr As DataRow = DtMovimientos.NewRow + 'Dim CodigoCuenta As String = "" + 'Dim NombreCuenta As String = "" + + 'dr("IdCuenta") = DdlCtaContable.SelectedValue + + 'If DdlCtaContable.SelectedValue.ToEntero > 0 Then + ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue)) + ' If drr IsNot Nothing Then + ' CodigoCuenta = drr("CuentaFormato").ToString() + ' NombreCuenta = drr("Nombre").ToString() + ' End If + 'End If + + 'dr("CodigoCuenta") = CodigoCuenta & "
    " & NombreCuenta + 'dr("Cuenta") = DdlConceptosContables.SelectedItem + 'dr("Referencia") = TxtReferencia.Text + 'dr("Concepto") = TxtObservaciones.Text + 'dr("TipoMovto") = If(Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) + 'dr("EsComodin") = 0 + 'dr("CveConcepto") = DdlConceptosContables.SelectedValue + 'dr("Cargo") = TxtCargo.Text.ToDouble + 'dr("Abono") = TxtAbono.Text.ToDouble + 'dr("Descripcion") = TxtDescripcion.Text + 'dr("CveSubProyecto") = DdlSubProyecto.SelectedValue + 'dr("CveProveedor") = DdlProveedores.SelectedValue.ToEntero + 'dr("CveCompra") = DdlCompras.SelectedValue.ToEntero + 'dr("CvePersonal") = DdlPersonal.SelectedValue.ToEntero + 'dr("CveClasificacion") = -1 + 'dr("CveCliente") = DdlClientes.SelectedValue.ToEntero + 'dr("CveVenta") = DdlVentas.SelectedValue.ToEntero + + 'TxtTotalAbonos.Text = (TxtTotalAbonos.Text.ToDouble + TxtAbono.Text.ToDouble).ToString.FormatoNumero + 'TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + TxtCargo.Text.ToDouble).ToString.FormatoNumero + 'DtMovimientos.Rows.Add(dr) + + 'If CvePrePoliza > 0 Then + ' GvPrePoliza.DataSource = DtMovimientos + ' GvPrePoliza.DataBind() + 'End If + + + 'GvMov.DataSource = DtMovimientos + 'GvMov.DataBind() + 'UPMovs.Update() + + + End Sub + + Private Sub LbCancelarEdicion_Click(sender As Object, e As EventArgs) Handles LbCancelarEdicion.Click + LbCancelarEdicion.Visible = False + TxtObservaciones.Text = "" + Actualizar = False + LbAgregar.Text = "Agregar" + End Sub + + Private Sub BtnContabilizar_Click(sender As Object, e As EventArgs) Handles BtnContabilizar.Click + + Dim ObjConta As New ClsContabilidad + + If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then + Alert(String.Format("Prepóliza contabilizada.

    Folio:Ver Póliza", ObjConta.ContaIdPoliza), ModExtensiones.TipoMensaje.MsgInformacion) + Else + + Alert($"Ocurrio un error al contabilizar {ObjConta.AlertaMensaje}", TipoMensaje.MsgAdvertencia) + End If + + ObjConta.Dispose() + + + End Sub + + +#Region "COMPLEMENTO DE PAGO" + + Private Sub GeneraTimbre(CvePrePoliza As Integer) + Dim Str As New StringBuilder + Dim Banco As New ClsBancos + Banco.IniciaTransacSQL() + If Banco.GeneraTimbrePago(-1, -1, UsuarioActual, CvePrePoliza:=CvePrePoliza) Then + If Banco.Mensaje = "" Then + Banco.Commit() + PDFReciboDePagos(-1, -1, Banco.CveComplementoPago, False) + Str.AppendFormat("Folio: {0}  ", Banco.ComplementoSerieFolio) + Str.AppendFormat("XML    ", Encripta(String.Format("OP=CompP&EXT=xml&SerieFolio={0}&CveComplementoPago={1}", Banco.ComplementoSerieFolio, Banco.CveComplementoPago))) + Str.AppendFormat("PDF   ", Encripta(String.Format("OP=CompP&EXT=pdf&SerieFolio={0}&CveComplementoPago={1}", Banco.ComplementoSerieFolio, Banco.CveComplementoPago))) + MandaCorreo(Banco.ComplementoSerieFolio, Banco.CobranzaCorreo) + End If + Else + Banco.RollBack() + Str.AppendFormat("No se genero complemento por el siguiente motivo: {0}", Banco.Mensaje) + End If + Banco.Dispose() + Alert(Str.ToString, TipoMensaje.MsgInformacion, "self.parent.tb_remove();self.parent.location.reload();") + End Sub + + Private Sub MandaCorreo(NombreArchivo As String, Correo As String, Optional ConAlerta As Boolean = True) + Try + Dim Msg As String = "" + If NombreArchivo <> "-1" Then ' + Dim ObjMail As New ClsSisMail() + Dim RutaXML As String = String.Format("{0}\XML\Pag\{1}.xml", UsuarioActual.Empresa.Ruta, NombreArchivo) + Dim RutaPDF As String = String.Format("{0}\PDF\Pag\{1}.pdf", UsuarioActual.Empresa.Ruta, NombreArchivo) + Dim Cuerpo As String = "Se hace entrega del comprobante de pago" + Dim Asunto As String = "Entrega de comprobante de pago" + If IO.File.Exists(RutaPDF) AndAlso IO.File.Exists(RutaXML) Then + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaPDF}) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaXML}) + If ObjMail.SendMail(UsuarioActual.Empresa, Correo, Asunto, Cuerpo, "", LSRutasMail) Then + If ConAlerta Then + 'RegistraScript("$('#ModalDivMail').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + End If + Else + Msg = "No se pudo enviar el correo electrónico." + End If + Else + Msg = "No se pudo adjuntar el correo electrónico." + End If + End If + If ConAlerta AndAlso Msg <> "" Then + Alert(Msg, TipoMensaje.MsgError) + End If + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + End Try + End Sub + + Protected Sub LnkComplementoPago_Click(sender As Object, e As EventArgs) + GeneraTimbre(CvePrePoliza) + End Sub +#End Region + + + +End Class + diff --git a/Empresas/13/Formatos/Plantillas/CartaProveedor.docx b/Empresas/13/Formatos/Plantillas/CartaProveedor.docx index 5d17cc4e6..5ae05f364 100644 Binary files a/Empresas/13/Formatos/Plantillas/CartaProveedor.docx and b/Empresas/13/Formatos/Plantillas/CartaProveedor.docx differ diff --git a/Empresas/141/Formatos/Factura.rdlc b/Empresas/141/Formatos/Factura.rdlc index 98de34936..fe9d24568 100644 --- a/Empresas/141/Formatos/Factura.rdlc +++ b/Empresas/141/Formatos/Factura.rdlc @@ -1477,7 +1477,15 @@ - Expedido en Sucursal: 2 + Expedido en Sucursal: + + + + =Parameters!Sucursal.Value - - - -
    -
    - - - - - - - - - - @@ -1571,7 +1514,7 @@ @@ -1867,7 +1810,23 @@ - Lugar, fecha y hora de emisión: + Lugar, fecha y hora de emisión: + + + + =Parameters!CiudadSucursal.Value + + + + + + + + + + + =Parameters!ClienteTelefono.Value + + + + + + + + =iif(Parameters!ClienteContactoMail.Value = "","","Correo: ") + + + + =Parameters!ClienteContactoMail.Value + @@ -2187,6 +2180,9 @@ 1.05328cm 17.71415cm 15 + + =IIF((Sum(IIF(Fields!CveClasificacion.Value = 20345,1,0), "DsOC") > 0),false,true) + @@ -2841,7 +2837,7 @@ - IVA (16%): + IVA: @@ -373,7 +373,7 @@ = IIF( IsNothing(Fields!CveVenta.Value), Fields!FechaDocumento.Value,Fields!FechaVencimiento.Value) @@ -498,7 +498,6 @@ 2pt - true diff --git a/General/CatDocumentacionTipo.aspx b/General/CatDocumentacionTipo.aspx index dba6be481..e2bcf3270 100644 --- a/General/CatDocumentacionTipo.aspx +++ b/General/CatDocumentacionTipo.aspx @@ -101,7 +101,7 @@ Catalogo Documentacion Tipo Seleccione uno Recursos Humanos Clientes - Proveedor + Proveedor <%-- Nota: EL tipo Tres es tipo Auditoria de documentos de proveedor usadon el portal prveedor y --%> diff --git a/Inventarios/PopUpExistenciasAlmacen.aspx b/Inventarios/PopUpExistenciasAlmacen.aspx index 4d0b6cd19..6b9f912bd 100644 --- a/Inventarios/PopUpExistenciasAlmacen.aspx +++ b/Inventarios/PopUpExistenciasAlmacen.aspx @@ -36,6 +36,18 @@ + + Medida: + + + + + + Rin: + + + + C. Barras: @@ -89,7 +101,7 @@
    -
    +
    @@ -101,6 +113,18 @@
    +
    + + + + + + + + + + +
    diff --git a/Inventarios/PopUpExistenciasAlmacen.aspx.vb b/Inventarios/PopUpExistenciasAlmacen.aspx.vb index a3b1a02d3..4f988dc7f 100644 --- a/Inventarios/PopUpExistenciasAlmacen.aspx.vb +++ b/Inventarios/PopUpExistenciasAlmacen.aspx.vb @@ -65,6 +65,13 @@ Partial Class Inventarios_Default DDlPS.DataBind() End If + If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then + DivMed.Visible = True + DivRin.Visible = True + CargarMedRin() + DivMedRin.Visible = True + DivPS.Visible = False + End If Dim Txt As String = IfNull(Request("Txt"), "").ToString If Txt <> "" Then LblTitulo.Text = String.Format("Búsqueda de {0}", Txt) @@ -80,7 +87,11 @@ Partial Class Inventarios_Default End Sub Protected Sub BtnBuscar_Click(sender As Object, e As System.EventArgs) Handles BtnBuscar.Click - CargaDatos(DDlPS.SelectedValue.ToEntero, 1) + If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then + CargarDatosMedRin() + Else + CargaDatos(DDlPS.SelectedValue.ToEntero, 1) + End If End Sub Private Sub CargaDatos(CvePS As Integer, Tipo As Integer) Dim ObjInventarios As New ClsInventarios() @@ -162,6 +173,19 @@ Partial Class Inventarios_Default End If End Sub + Private Sub GvMedRin_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvMedRin.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveAlmacen") = "" Then + e.Row.CssClass = "Totales" + End If + + If UsuarioActual.CveEmpresa = 119 Then + GV.Columns(5).Visible = True + End If + End If + End Sub + + #Region " BUSCA | CODIGO - SERIE " Protected Sub BtnCodigoPS_Click(sender As Object, e As EventArgs) @@ -178,11 +202,38 @@ Partial Class Inventarios_Default Exit Sub End If + CargaDatos(DrPS("CvePS").ToString.ToEntero, 2) + TxtCodigoPS.Text = "" TxtCodigoPS.Focus() End Sub #End Region + Private Sub CargarMedRin() + Dim ObjGral As New ClsGenerales + If ObjGral.GetMedidas(UsuarioActual.CveEmpresa) Then + DdlMedidas.DataSource = ObjGral.DtResultados + If ObjGral.GetRimTamanios(UsuarioActual.CveEmpresa) Then + DdlRin.DataSource = ObjGral.DtResultados + End If + End If + ObjGral.Dispose() + DdlMedidas.DataBind() + DdlRin.DataBind() + DdlMedidas.Items.Insert(0, New ListItem("-", "-1")) + DdlRin.Items.Insert(0, New ListItem("-", "-1")) + End Sub + + Private Sub CargarDatosMedRin() + Dim ObjInventarios As New ClsInventarios + If ObjInventarios.GetExistenciasMedRin(DDlPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlRin.SelectedValue.ToEntero, DdlMedidas.SelectedValue.ToEntero) Then + GvMedRin.DataSource = ObjInventarios.DtResultados + End If + ObjInventarios.Dispose() + GvMedRin.DataBind() + UPDatos.Update() + End Sub + End Class diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 12c73fb0e..e5801a2a1 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -2999,7 +2999,7 @@ Partial Class Inventarios_RecepcionAlmacen End If End If - If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then + If Not ErrorMovInv AndAlso UsuarioActual.Empresa.Funcionalidad(200) = "1" Then ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) ObjContaAC.IniciaTransacSQL() If ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContaAC) Then @@ -3029,6 +3029,7 @@ Partial Class Inventarios_RecepcionAlmacen ObjInventario.RollBack() If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") + GuardaLog(MensajeError) Alert("Error al guardar el movimiento de almacen. Por favor vuelva a intentar.", TipoMensaje.MsgError) End If diff --git a/OC/OC.aspx b/OC/OC.aspx index 695e0f215..50959795d 100644 --- a/OC/OC.aspx +++ b/OC/OC.aspx @@ -587,11 +587,10 @@
    - Cliente: - + Cliente:
    - + <%-- --%>
    diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 4e74dad9d..0c66a6a86 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -529,11 +529,35 @@ Partial Class OC If DrCot IsNot Nothing Then HLCotizacion.Text = String.Format("{0}-{1}", DrCot("Serie"), DrCot("Folio")) 'CveVendedor DdlVendedor.SelectedValueExist(DrCot("CveVendedor").ToString()) - Ddlcliente.SelectedValueExist(DrCot("CveCliente").ToString()) + + + Try + Ddlcliente.txtText.Value = DrCot("ClienteNombre").ToString() + Ddlcliente.txtValue.Value = DrCot("CveCliente").ToString() + Catch ex As Exception + + End Try + + + + + End If End If End If + Dim DtOCGeneradas As DataTable = Nothing + If ObjVentas.GetVentasCotizacionesOC(Me.CveVenta, -1, UsuarioActual.CveEmpresa) Then + DtOCGeneradas = ObjVentas.DtResultados.Copy() + End If + + If DtOCGeneradas IsNot Nothing AndAlso DtOCGeneradas.Rows.Count > 0 Then + ObjVentas.Dispose() + BtnGuardar.Enabled = False + Alert("Ya existe una OC con esta cotización", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + CargaClasificacionesPopUp(CveCotizacion) ObjVentas.Dispose() End If @@ -720,6 +744,8 @@ Partial Class OC BtnSolicitudAnticipo.Visible = False End If + Ddlcliente.ddlWS.Attributes.Add("data-coltexto", "N") + 'Nuevo Proceso que permite modificar detalles If Not UsuarioActual.TienePermisoProceso(131) Then If GlobalDTOCEstatus(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveEstatus = {0}", CveEstatus)).Rows.Count > 0 Then @@ -971,6 +997,8 @@ Partial Class OC DtDetalle.Columns.Add("CveContratoDetalle", GetType(Integer)) DtDetalle.Columns.Add("CantidadNoEditable", GetType(Double)) + DtDetalle.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer)) + 'DtDetalle.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) ' DtDetalle.Columns.Add("ClasificacionOG", GetType(String)) @@ -1040,6 +1068,10 @@ Partial Class OC dr("CveTipoGasto") = -1 dr("CveClasificacionOG") = -1 + If UsuarioActual.Empresa.Funcionalidad(583) = "1" Then + dr("CveVentaDetalleCotizacion") = RowV("CveVentaDetalle") + End If + DtDetalle.Rows.Add(dr) Next @@ -1189,10 +1221,15 @@ Partial Class OC ''DATOS DE VENTA If UsuarioActual.Empresa.Funcionalidad(108) = "1" Then - Ddlcliente.SelectedValueExist(objOC.CveCliente.ToString) - If Ddlcliente.SelectedValue <> objOC.CveCliente.ToString Then - Ddlcliente.Items.Insert(1, New ListItem(GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Nombre", $"CveCliente = {objOC.CveCliente}"), objOC.CveCliente.ToString)) - End If + + Ddlcliente.txtValue.Value = objOC.CveCliente.ToString + Ddlcliente.txtText.Value = objOC.NombreCliente + + 'If Ddlcliente.SelectedValue <> objOC.CveCliente.ToString Then + + ' Ddlcliente.Items.Insert(1, New ListItem(GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Nombre", $"CveCliente = {objOC.CveCliente}"), objOC.CveCliente.ToString)) + + 'End If DdlVendedor.SelectedValueExist(objOC.CveVendedor.ToString) If DdlVendedor.SelectedValue <> objOC.CveVendedor.ToString Then @@ -2103,7 +2140,7 @@ Partial Class OC Dim TieneError = False 'Entrega Directa requiere Cliente y Vendedor - If ChkEntregaDirecta.Checked And Ddlcliente.SelectedValue.ToEntero <= 0 Then + If ChkEntregaDirecta.Checked And Ddlcliente.txtValue.Value.ToEntero <= 0 Then Alert("Al ser una Entrega Directa es necesario seleccionar un cliente, por favor seleccione uno.") Return True End If @@ -2120,6 +2157,11 @@ Partial Class OC Return True End If + If Ddlcliente.txtValue.Value.ToEntero > 0 And DdlVendedor.SelectedValue.ToEntero <= 0 Then + Alert("Debe de seleccionar Un vendedor ", TipoMensaje.MsgAdvertencia) + TieneError = True + End If + 'SI ES REQUISICION, NO REQUIERE COTIZACION Y ES ESTATUSFINALOK... ENTONCES DEBE DE TENER UN PROVEEDOR SELECCIONADO Y LOS PRECIOS CAPTURADOS @@ -2318,7 +2360,7 @@ Partial Class OC Dim OCBitacora As New ClsOIEventos(OC.IniciaTransacSQL()) Dim ObjInventarios As New ClsInventarios(OC.IniciaTransacSQL()) Dim ObjConta As New ClsContabilidad(OC.IniciaTransacSQL()) - + Dim ObjVentas As New ClsVentas(OC.IniciaTransacSQL()) Dim Conta As ClsContPAQi = Nothing If (UsuarioActual.Empresa.UsaAC AndAlso VerificaPresupuesto) Or UsuarioActual.Empresa.Funcionalidad(200) = "1" Then Conta = New ClsContPAQi(UsuarioActual.Empresa) @@ -2354,14 +2396,19 @@ Partial Class OC If Not TieneError Then ' AGREGAR REQUISICION If OC.AddOrdenCompra("REQ", -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CboE.SelectedValue.ToEntero, If(TxtFechaEstimadaEntrega.Text.Trim = "", "-1", TxtFechaEstimadaEntrega.Text.Trim), LugarEntrega, UsuarioActual.CveUsuario, CveEmpresaActual, GvD.Rows(0).FCHiddenField("HdnCvePresupuestoEgreso").Value.ToString.ToEntero, pCveProveedor:=CveProveedor, pCveProveedorSucursal:=CveProveedorSucursal, - RequiereCotizacion:=ChkCotizacion.Checked, CveCliente:=Ddlcliente.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, + RequiereCotizacion:=ChkCotizacion.Checked, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto) Then CveOrdenCompraPadre = OC.CveOrdenCompra If CveOrdenCompraPadre > 0 Then For Each dr As DataRow In DtDetalle.Rows - If Not OC.AddOrdenCompraDetalle(CveOrdenCompraPadre, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) Then + If Not OC.AddOrdenCompraDetalle(CveOrdenCompraPadre, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, + dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, Descuento:=dr("Descuento").ToString.ToDouble, + IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, + RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, + RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, + IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) Then TieneError = True Exit For End If @@ -2383,7 +2430,7 @@ Partial Class OC If OC.AddOrdenCompra(If(TipoOS, "OS", TipoOC), -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusNuevo, If(TxtFechaEstimadaEntrega.Text.Trim = "", "-1", TxtFechaEstimadaEntrega.Text.Trim), LugarEntrega, UsuarioActual.CveUsuario, CveEmpresaActual, GvD.Rows(0).FCHiddenField("HdnCvePresupuestoEgreso").Value.ToString.ToEntero, pCveProveedor:=CveProveedor, pCveProveedorSucursal:=CveProveedorSucursal, - RequiereCotizacion:=ChkCotizacion.Checked, CveUsuarioAsignado:=DdlUsuariosAsignado.SelectedValue.ToEntero, CveCliente:=Ddlcliente.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, + RequiereCotizacion:=ChkCotizacion.Checked, CveUsuarioAsignado:=DdlUsuariosAsignado.SelectedValue.ToEntero, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=LtImporteIEAnticipo.Text.ToDouble, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto) Then @@ -2435,11 +2482,20 @@ Partial Class OC For Each dr As DataRow In DtDetalle.Rows - If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, pCveOrdenCompraPadre:=CveOrdenCompraPadre, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble) Then + If Not OC.AddOrdenCompraDetalle(CveOrdenCompra, dr("Cantidad").ToString.ToDouble(), dr("CveUnidadMedida").ToString.ToEntero, dr("CvePS").ToString.ToEntero, dr("Importe").ToString.ToDouble, dr("CveSubProyecto").ToString.ToEntero(), dr("CveActivoFijo").ToString.ToEntero, + dr("Observacion").ToString, UsuarioActual.CveUsuario, CvePresupuestoEgreso:=dr("CvePresupuestoEgreso").ToString.ToEntero, pCveOrdenCompraPadre:=CveOrdenCompraPadre, Descuento:=dr("Descuento").ToString.ToDouble, IEPSPS:=dr("IEPSPS").ToString.ToDouble, + IEPSPSIVA:=dr("IEPSPSIVA").ToString.ToDouble, IVA:=dr("IVA").ToString.ToDouble, RetIVA:=dr("RetIVA").ToString.ToDouble, RetISR:=dr("RetISR").ToString.ToDouble, Total:=dr("Total").ToString.ToDouble, CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, + IVAPorcentaje:=dr("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=dr("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=dr("RetISRPorcentaje").ToString.ToDouble, IEPSPSPorcentaje:=dr("IEPSPSPorcentaje").ToString.ToDouble, + IEPSPSIVAPorcentaje:=dr("IEPSPSIVAPorcentaje").ToString.ToDouble, CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero()) Then TieneError = True Exit For End If Next + + If Not TieneError AndAlso UsuarioActual.Empresa.Funcionalidad(583) = "1" Then + TieneError = Not ActualizarCotizacion(ObjVentas) + End If + Else TieneError = True End If @@ -2507,7 +2563,7 @@ Partial Class OC End If If Not OC.UpdateOrdenCompra(-1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, ChkCotizacion.Checked, If(TxtFechaEstimadaEntrega.Text.Trim = "", "-1", TxtFechaEstimadaEntrega.Text.Trim), - LugarEntrega, DdlMoneda.SelectedValue.ToEntero, CveProveedor, CveOrdenCompra, UsuarioActual.CveUsuario, Ddlcliente.SelectedValue.ToEntero, + LugarEntrega, DdlMoneda.SelectedValue.ToEntero, CveProveedor, CveOrdenCompra, UsuarioActual.CveUsuario, Ddlcliente.txtValue.Value.ToEntero, DdlVendedor.SelectedValue.ToEntero, txtobsprioridad.Text, IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveProveedorContacto:=CveProveedorContacto, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)) Then @@ -2887,6 +2943,7 @@ Partial Class OC Else 'TERMINA TODO POR SI OCURRIÓ ALGO RARO If OC IsNot Nothing Then OC.Dispose() + If ObjVentas IsNot Nothing Then ObjVentas.Dispose() If Conta IsNot Nothing Then Conta.Dispose() 'MANDA CORREOS SI EL ESTATUS ES MAYOR A 0 @@ -2906,6 +2963,13 @@ Partial Class OC End Sub Protected Function GeneraOrdenes(ByRef objOrdenCompra As ClsOC, Conta As ClsContPAQi, ByRef ObjInventarios As ClsInventarios) As Boolean + + + 'If Ddlcliente.txtValue.Value.ToEntero > 0 And DdlVendedor.SelectedValue.ToEntero <= 0 Then + ' Alert("Debe de seleccionar Un vendedor ", TipoMensaje.MsgAdvertencia) + ' Exit Function + 'End If + If TipoOS Then Return False Dim CveCotizacion As Integer = 0 @@ -2945,7 +3009,7 @@ Partial Class OC RetISR = TxtRetISR.Text.ToDecimal If objOrdenCompra.AddOrdenCompra("OC", -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusInicialOC, TxtFechaEstimadaEntrega.Text, LugarEntrega, - CveUsuario, CveEmpresaActual, 0, pCveProveedor:=CveProveedor, CveCliente:=Ddlcliente.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, + CveUsuario, CveEmpresaActual, 0, pCveProveedor:=CveProveedor, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, PorcentajeIVA:=PorIVA, IVA:=IVACot, RetIVA:=RetIVA.ToString.ToDecimal, RetISR:=RetISR.ToString.ToDecimal, IDPoliza:=IdPoliza, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=LtImporteIEAnticipo.Text.ToDouble, Promocion:=Promocion, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero) Then @@ -3012,7 +3076,7 @@ Partial Class OC Else If objOrdenCompra.AddOrdenCompra("OC", -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusInicialOC, TxtFechaEstimadaEntrega.Text, LugarEntrega, - CveUsuario, CveEmpresaActual, 0, pCveProveedor:=DdlProveedores.SelectedValue.ToEntero, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveCliente:=Ddlcliente.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, + CveUsuario, CveEmpresaActual, 0, pCveProveedor:=DdlProveedores.SelectedValue.ToEntero, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, IDPoliza:=IDPolizaPresupuestal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=LtImporteIEAnticipo.Text.ToDouble, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion) Then @@ -3620,7 +3684,9 @@ Partial Class OC Alert("Ocurrió un error al cargar la información del producto para actualizar. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia) Exit Sub End If - Dim IvaPS = DrPS("IVA").ToString.ToDouble + Dim IvaPS = DrPS("IVA").ToString.ToDecimal + IEPSPS = DrPS("IEPSPorcentaje").ToString.ToDouble + IEPSPSIVA = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDecimal, 0) If CvePS <> CvePSAnterior Or Not CveOrdenCompra > 0 Then RetISR = DrPS("RetISR").ToString.ToDouble @@ -3628,8 +3694,8 @@ Partial Class OC 'If IvaPS = -1 Then 'IVA DE LA SUCURSAL ' IvaPS = GlobalDTSubProyectos(-1, gvr.FCDropDownList("DdlSubProyectoEdit").SelectedValue.ToEntero).FiltroPrimeroValor("IVA").ToDouble 'End If - IEPSPS = DrPS("IEPSPorcentaje").ToString.ToDouble - IEPSPSIVA = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0) + + ' IEPSPSIVA = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDouble, 0) End If @@ -4822,7 +4888,9 @@ Partial Class OC generarAnticipo.Visible = True Ddlcliente.DataSource = GlobalDTCliente(CveEmpresaActual) Ddlcliente.DataBind() - Ddlcliente.Items.Insert(0, New ListItem(" - ", "-1")) + + 'Ddlcliente.Items.Insert(0, New ListItem(" - ", "-1")) + DdlVendedor.DataSource = GlobalDTVendedores(CveEmpresaActual) DdlVendedor.DataBind() DdlVendedor.Items.Insert(0, New ListItem(" - ", "-1")) @@ -5043,7 +5111,7 @@ Partial Class OC End Function #End Region -#Region " COTIZACIONES " +#Region "C O T I Z A C I O N E S" Protected Sub VerificaSiRequiereCotizacion() If TipoOC = "REQ" Then If ChkCotizacion.Checked Then @@ -5083,6 +5151,32 @@ Partial Class OC VerificaCotizacionesGanadoras() End If End Sub + + Protected Function ActualizarCotizacion(ByRef ObjVentas As ClsVentas) As Boolean + Dim OcurrioError As Boolean = False + Try + Dim PorcentajeGanancia As Decimal = 0.1D + For Each Row As DataRow In DtDetalle.Rows + Dim CvePS As Integer = Row("CvePS").ToString.ToEntero + Dim DrPS = GlobalDTPS(CveEmpresaActual, CvePS:=CvePS).FiltroPrimero("") + + Dim Cantidad As Decimal = Row("Cantidad").ToString.ToDecimal + Dim PU As Decimal = Row("Importe").ToString.ToDecimal() + (Row("Importe").ToString.ToDecimal() * PorcentajeGanancia) + Dim IEPSPS As Decimal = DrPS("IEPSPorcentaje").ToString.ToDecimal + Dim ImporteIEPS As Decimal = ((Cantidad * PU) * IEPSPS).RoundSQL(2) + + If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalleCotizacion").ToString.ToEntero, CvePS, Cantidad, PU, ImporteIEPS, "", UsuarioActual.CveUsuario) Then + OcurrioError = True + Exit For + End If + Next + Catch ex As Exception + OcurrioError = True + OnError("Ocurrió un error al guardar la cotización", ex) + End Try + + Return Not OcurrioError + End Function #End Region Private Function notienepresupuesto() As Boolean @@ -5288,7 +5382,7 @@ Partial Class OC End If End Sub - Protected Sub Ddlcliente_SelectedIndexChanged(sender As Object, e As EventArgs) + Protected Sub Ddlcliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Ddlcliente.selectedindexchange DdlVendedor.SelectedValueExist(GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveVendedor", $"CveCliente = {Ddlcliente.SelectedValue}")) @@ -5304,7 +5398,7 @@ Partial Class OC End Sub Private Sub CargaDireccionesEnvioCliente() Dim ObjClientes As New ClsClientes - If ObjClientes.DireccionEnvioGet(-1, Ddlcliente.SelectedValue.ToEntero, -1) Then + If ObjClientes.DireccionEnvioGet(-1, Ddlcliente.txtValue.Value.ToEntero, -1) Then DdlDireccionEnvio.DataSource = ObjClientes.DtResultados If ObjClientes.DtResultados.Rows.Count > 0 Then DdlDireccionEnvio.Visible = True @@ -6504,7 +6598,7 @@ Partial Class OC End Sub Protected Sub ImgCambiaClienteVendedor_Click(sender As Object, e As ImageClickEventArgs) Handles ImgCambiaClienteVendedor.Click Dim OC As New ClsOC - If OC.UpdateClienteVendedorOrdenCompra(Ddlcliente.SelectedValue.ToEntero, DdlVendedor.SelectedValue.ToEntero, CveOrdenCompra, UsuarioActual.CveUsuario, CveEmpresaActual) Then + If OC.UpdateClienteVendedorOrdenCompra(Ddlcliente.txtValue.Value.ToEntero, DdlVendedor.SelectedValue.ToEntero, CveOrdenCompra, UsuarioActual.CveUsuario, CveEmpresaActual) Then CargaHistorial() Alert("El cambio de cliente/vendedor se hizo correctamente", TipoMensaje.MsgInformacion) End If @@ -7179,7 +7273,7 @@ Partial Class OC End If Next TxtGrid.Text = If(DtDetalle.Rows.Count = 0, "", DtDetalle.Rows.Count.ToString) - Ddlcliente.SelectedValue = DdlClientes.SelectedValue + Ddlcliente.txtValue.Value = DdlClientes.SelectedValue CargaSuperior() CargaDatosDetalles() @@ -7223,7 +7317,7 @@ Partial Class OC DdlClienteSucursalEnvio.Items.Clear() - If ObjCliente.GetSucursales(Ddlcliente.SelectedValue.ToEntero) Then + If ObjCliente.GetSucursales(Ddlcliente.txtValue.Value.ToEntero) Then If ObjCliente.DtResultados.Rows.Count > 0 Then DdlClienteSucursalEnvio.DataSource = ObjCliente.DtResultados End If @@ -7253,7 +7347,7 @@ Partial Class OC Private Sub BtnAgregarDireccion_Click(sender As Object, e As EventArgs) Handles BtnAgregarDireccion.Click - If Not Ddlcliente.SelectedValue.ToEntero > 0 Then + If Not Ddlcliente.txtValue.Value.ToEntero > 0 Then Alert("Tiene que tener un cliente seleccionado", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -7262,7 +7356,7 @@ Partial Class OC Dim TieneError = False Dim Estatus = If(ChkEstatus.Checked, 1, 0) - CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(Ddlcliente.SelectedValue.ToEntero, TxtEnvioDireccion.Text.Trim, TxtEnvioNoExt.Text.Trim, TxtEnvioNoInt.Text.Trim, TxtEnvioColonia.Text.Trim, TxtEnvioCiudad.Text.Trim, TxtEnvioEstado.Text.Trim, TxtEnvioCP.Text.ToEntero, TxtEnvioContacto.Text.Trim, UsuarioActual.CveUsuario, Estatus, CveClienteSucursal:=DdlClienteSucursalEnvio.SelectedValue.ToEntero, EnvioTel:=TxtEnvioTel.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", "")) + CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(Ddlcliente.txtValue.Value.ToEntero, TxtEnvioDireccion.Text.Trim, TxtEnvioNoExt.Text.Trim, TxtEnvioNoInt.Text.Trim, TxtEnvioColonia.Text.Trim, TxtEnvioCiudad.Text.Trim, TxtEnvioEstado.Text.Trim, TxtEnvioCP.Text.ToEntero, TxtEnvioContacto.Text.Trim, UsuarioActual.CveUsuario, Estatus, CveClienteSucursal:=DdlClienteSucursalEnvio.SelectedValue.ToEntero, EnvioTel:=TxtEnvioTel.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", "")) If CveDireccionEnvio < 0 Then TieneError = True @@ -7544,4 +7638,5 @@ Partial Class OC End Sub #End Region + End Class diff --git a/PortalProveedor/PortalProveedor.aspx b/PortalProveedor/PortalProveedor.aspx index 912ae99df..9f78f83f6 100644 --- a/PortalProveedor/PortalProveedor.aspx +++ b/PortalProveedor/PortalProveedor.aspx @@ -801,6 +801,7 @@ <%---2020/02/06 - Auditoria--%> + @@ -931,6 +932,7 @@ + diff --git a/RH/Reclutamiento.aspx b/RH/Reclutamiento.aspx index 5108a7c66..14a22baa5 100644 --- a/RH/Reclutamiento.aspx +++ b/RH/Reclutamiento.aspx @@ -552,8 +552,7 @@
    - +
    diff --git a/Scripts/custom.js b/Scripts/custom.js index 39e2ae95b..42864abad 100644 --- a/Scripts/custom.js +++ b/Scripts/custom.js @@ -1084,6 +1084,7 @@ function setwebservice(idDdlWS, idhdValue, idhdText, btn) { CveSubProyecto: (!(DdlWS.data('cvesubproyecto')) || DdlWS.data('cvesubproyecto') == '') ? ((!(DdlWS.parent().data('cvesubproyecto')) || DdlWS.parent().data('cvesubproyecto') == '') ? -1 : DdlWS.parent().data('cvesubproyecto')) : DdlWS.data('cvesubproyecto'), metodo: (!(DdlWS.data('metodo')) || DdlWS.data('metodo') == 'getps') ? ((!(DdlWS.parent().data('metodo')) || DdlWS.parent().data('metodo') == 'getps') ? 'getps' : DdlWS.parent().data('metodo')) : DdlWS.data('metodo'), Pagina: (!(DdlWS.data('pagina')) || DdlWS.data('pagina') == '') ? '-2' : DdlWS.data('pagina'), + ColTexto: (!(DdlWS.data('coltexto')) || DdlWS.data('coltexto') == '') ? 'NC' : DdlWS.data('coltexto') //Metodo: metodo }; }, diff --git a/SiteGPS.master b/SiteGPS.master index f1aa06e3e..657d03977 100644 --- a/SiteGPS.master +++ b/SiteGPS.master @@ -847,22 +847,23 @@ CveBitacora: -1 } } - var json = JSON.stringify(request); - $.ajax({ - data: json, - url: '/Ashx/SIGGPS.ashx', - type: 'post', - beforeSend: function () { - console.log("procesando....."); - }, - success: function (response) { - console.log("notificacion actualizada...."); - var datos = JSON.parse(response); - UpdateNotificacionesCampana(datos); - } - }); - setTimeout(startTimer, 60000); // callback + //var json = JSON.stringify(request); + //$.ajax({ + // data: json, + // url: '/Ashx/SIGGPS.ashx', + // type: 'post', + // beforeSend: function () { + // console.log("procesando....."); + // }, + // success: function (response) { + // console.log("notificacion actualizada...."); + // var datos = JSON.parse(response); + // UpdateNotificacionesCampana(datos); + // } + //}); + + //setTimeout(startTimer, 60000); // callback } // diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index fa1d019a5..a9c503494 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -1385,7 +1385,7 @@ Partial Class Ventas_ClientesAbonar ImporteMovimiento = 0 End Select - If ImporteMovimiento <> 0 Then + If ImporteMovimiento <> 0 AndAlso MsgError = "" Then 'Conta ContPAQ If (IdCtaContable < 1 Or IdCuentaBancaria < 1) Then CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) diff --git a/Ventas/MetasVendedores.aspx b/Ventas/MetasVendedores.aspx new file mode 100644 index 000000000..6fe34dd38 --- /dev/null +++ b/Ventas/MetasVendedores.aspx @@ -0,0 +1,115 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="MetasVendedores.aspx.vb" Inherits="MetasVendedores" %> + + + + + + + + + + Metas de Vendedores + + +
  • + Agregar Meta +
  • +
  • + PDF +
  • +
  • + Excel +
  • +
    + + + + + + + diff --git a/Ventas/MetasVendedores.aspx.vb b/Ventas/MetasVendedores.aspx.vb new file mode 100644 index 000000000..9a5ca2ede --- /dev/null +++ b/Ventas/MetasVendedores.aspx.vb @@ -0,0 +1,56 @@ +Imports System.Data +Imports Extensiones +Imports Microsoft.Reporting.WebForms + +Partial Class MetasVendedores + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CargaDatosModal() + End If + End Sub + + Private Sub CargaDatosModal() + DdlVendedores.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedores.DataBind() + DdlVendedores.Items.Insert(0, New ListItem("Seleccionar", "-1")) + + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetMarcas(UsuarioActual.CveEmpresa) Then + DdlMarcas.DataSource = ObjPS.DtResultados + End If + ObjPS.Dispose() + DdlMarcas.DataBind() + DdlMarcas.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub + + Private Sub ResetDatosSeleccionadosModal() + DdlVendedores.SelectedValue = "-1" + TxtFechaI.Text = "" + DdlMarcas.SelectedValue = "-1" + TxtMetaCantidad.Text = "" + TxtMetaImporte.Text = "" + UpModalTiposD.Update() + End Sub + + Protected Sub LnkAgregar_Click() Handles LnkAgregar.Click + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD")) + End Sub + + Protected Sub BtnAgregarMetaVendedor_Click(sender As Object, e As EventArgs) Handles BtnAgregarMetaVendedor.Click + + If DdlVendedores.SelectedValue.ToEntero > 0 AndAlso TxtFechaI.Text <> "" AndAlso DdlMarcas.SelectedValue.ToEntero > 0 Then + Dim ObjVentas As New ClsVentas + If ObjVentas.AddMetasVendedores(DdlVendedores.SelectedValue.ToEntero, TxtFechaI.Text, DdlMarcas.SelectedValue.ToEntero, TxtMetaCantidad.Text.ToEntero, TxtMetaImporte.Text.ToDecimal) Then + Alert("Se agregó la meta al vendedor") + Else + Alert("No se pudo agregar la meta al vendedor", TipoMensaje.MsgError) + End If + Else + Alert(String.Format("Falta Seleccionar {0}{1}{2}", If(DdlVendedores.SelectedValue.ToEntero > 0, "", "Vendedor, "), If(DdlMarcas.SelectedValue.ToEntero > 0, "", "Marca, "), If(TxtFechaI.Text <> "", "", "Fecha, "))) + End If + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD")) + ResetDatosSeleccionadosModal() + End Sub +End Class diff --git a/Ventas/RepIngresos.aspx b/Ventas/RepIngresos.aspx index 6647ee016..3a763c711 100644 --- a/Ventas/RepIngresos.aspx +++ b/Ventas/RepIngresos.aspx @@ -166,32 +166,32 @@ - + - + - + - + - + - + diff --git a/Ventas/RepIngresos.aspx.vb b/Ventas/RepIngresos.aspx.vb index 56a2fed0a..021cd086b 100644 --- a/Ventas/RepIngresos.aspx.vb +++ b/Ventas/RepIngresos.aspx.vb @@ -60,7 +60,7 @@ Partial Class Ventas_RepIngresos Set ViewState("CveSubProyecto") = Value End Set - End Property + End Property Private Property DtDatos As DataTable Get DtDatos = DirectCast(ViewState("DtDatos"), DataTable) @@ -69,9 +69,9 @@ Partial Class Ventas_RepIngresos Set(ByVal value As DataTable) ViewState("DtDatos") = value End Set - End Property + End Property #End Region - + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then CveSubProyecto = -1 diff --git a/Ventas/RepIngresosDetalle.aspx b/Ventas/RepIngresosDetalle.aspx index a6de016f0..acc505d4d 100644 --- a/Ventas/RepIngresosDetalle.aspx +++ b/Ventas/RepIngresosDetalle.aspx @@ -144,6 +144,11 @@ + + + + + @@ -183,6 +188,16 @@ + + + + + + + + + + diff --git a/Ventas/RepIngresosDetalle.aspx.vb b/Ventas/RepIngresosDetalle.aspx.vb index ab6cd3e4f..c34689dc5 100644 --- a/Ventas/RepIngresosDetalle.aspx.vb +++ b/Ventas/RepIngresosDetalle.aspx.vb @@ -54,9 +54,20 @@ Partial Class Ventas_RepIngresosDetalle Set ViewState("CveCuenta") = Value End Set - End Property + End Property + + Private Property TipoAmortizacion() As Integer + Get + Return If(IsNothing(ViewState("TipoAmortizacion")), -1, ViewState("TipoAmortizacion").ToString().ToEntero()) + End Get + Set + ViewState("TipoAmortizacion") = Value + End Set + End Property + + #End Region - + Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) @@ -67,18 +78,20 @@ Partial Class Ventas_RepIngresosDetalle CveCuenta = If(IsNothing(Request("CveCuenta")), "", Request("CveCuenta").ToString()) CveSubProyecto = If(IsNothing(Request("CveSubProyecto")), 0, Request("CveSubProyecto").ToString().ToEntero()) CveConceptoContable = If(IsNothing(Request("CveConceptoContable")), -1, Request("CveConceptoContable").ToString().ToEntero()) + TipoAmortizacion = If(IsNothing(Request("TipoAmortizacion")), -1, Request("TipoAmortizacion").ToString().ToEntero()) TxtFechaInicio.Text = If(RsFechaI.Length > 6, DateTime.ParseExact(RsFechaI, "yyyy/MM/dd", Nothing).ToString("dd/MM/yyyy"), "") TxtFechaFin.Text = If(RsFechaF.Length > 6, DateTime.ParseExact(RsFechaF, "yyyy/MM/dd", Nothing).ToString("dd/MM/yyyy"), "") DdlTipoDocto.SelectedValueExist(TipoDoc) DdlSubProyecto.SelectedValueExist(CveSubProyecto.ToString()) ' - CargaRepIngresosDetalle() + LnkFiltrar_Click(LnkFiltrar, EventArgs.Empty) End If End Sub Protected Sub CargaRepIngresosDetalle() Dim ObjRepI As New ClsVentas() - ObjRepI.RepIngresosDetalle(UsuarioActual.CveEmpresa, If(RsFechaI = "", MinFecha, RsFechaI.ToDate), If(RsFechaF = "", MaxFecha, RsFechaF.ToDate), TipoDoc, CveSubProyecto, CveConceptoContable, CveCuenta) - GVRepIngresos.DataSource = ObjRepI.DtResultados + If ObjRepI.RepIngresosDetalle(UsuarioActual.CveEmpresa, If(RsFechaI = "", MinFecha, RsFechaI.ToDate), If(RsFechaF = "", MaxFecha, RsFechaF.ToDate), TipoDoc, CveSubProyecto, CveConceptoContable, CveCuenta, TipoAmortizacion) Then + GVRepIngresos.DataSource = ObjRepI.DtResultados + End If ObjRepI.Dispose() GVRepIngresos.DataBind() upDatosRepI.Update() @@ -94,7 +107,7 @@ Partial Class Ventas_RepIngresosDetalle End Sub Protected Sub GVRepIngresos_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("GTipoDocto").ToString().ToEntero() = -1 Then + If e.Row.DBCampo("GTipoDocto").ToString().ToEntero() = -1 OrElse e.Row.DBCampo("SerieFolio").ToString() = "TOTAL" Then e.Row.CssClass = "Totales" End If End If diff --git a/Ventas/RepPS.aspx b/Ventas/RepPS.aspx new file mode 100644 index 000000000..85d50862d --- /dev/null +++ b/Ventas/RepPS.aspx @@ -0,0 +1,164 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepPS.aspx.vb" Inherits="Ventas_RepPS" %> + + + + + + + + Reporte de Ventas por Producto + + + + + + + + + + +
    +
    +
    + + +
    +
    +
    + +
    + + + +
    +
    + Fecha Inicio: + +
    +
    +
    + + + + +
    + + + + + + +
    +
    + Fecha Fin: + +
    +
    +
    + + + + +
    + + + + + + +
    + +
    + + + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + diff --git a/Ventas/RepPS.aspx.vb b/Ventas/RepPS.aspx.vb new file mode 100644 index 000000000..e62b9120d --- /dev/null +++ b/Ventas/RepPS.aspx.vb @@ -0,0 +1,102 @@ +Option Explicit On +Option Strict On + +Imports Extensiones +Imports System.Data +Partial Class Ventas_RepPS + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CargaDatosIniciales() + CargaCombos() + CargaDatos() + End If + End Sub + Private Sub CargaDatosIniciales() + txtFechaI.Text = $"01/{Now.Month}/{Now.Year}" + txtFechaF.Text = Now.ToString("dd/MM/yyyy") + End Sub + Private Sub CargaCombos() + CargaTipoCentroCosto() + End Sub + + Private Sub CargaTipoCentroCosto() + + If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then + DdlSubProyecto.Items.Clear() + LblSubProyecto.InnerText = "Sucursal:" + DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1")) + DdlSubProyecto.DataBind() + + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then + DdlSubProyecto.Items.Clear() + + LblSubProyecto.InnerText = "Proyecto:" + DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1")) + DdlSubProyecto.DataBind() + + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 3 Then + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) + DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) + DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) + DdlGrupo.DataBind() + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 4 Then + LblSubProyecto.InnerText = "Proyecto:" + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) + DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) + DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) + DdlGrupo.DataBind() + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then + LblSubProyecto.InnerText = "Sucursal:" + End If + End Sub + + Private Sub CargaDatos() + + Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero() + Dim Grupo As Integer = DdlGrupo.SelectedValue.ToEntero() + Dim CvePS As Integer = -1 + Dim CveMoneda As Integer = -1 + Dim TC As Integer = 1 + Dim TCEspecifico As Decimal = -1 + Dim FechaI, FechaF As DateTime + FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.ToDate, MinFecha) + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.ToDate, MaxFecha) + + Dim ObjVentas As New ClsVentas() + If ObjVentas.GetRepPSEcono(CveSubProyecto, CvePS, FechaI, FechaF, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, GPO:=Grupo, CveMoneda:=CveMoneda, TipoCambio:=TC, TCEspecifico:=TCEspecifico) Then + GvDatos.DataSource = ObjVentas.DtResultados + Else + GvDatos.DataSource = Nothing + End If + + ObjVentas.Dispose() + GvDatos.DataBind() + + UPDatos.Update() + End Sub + + + Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Select Case e.Row.DBCampo("Orden").ToString.ToEntero() + Case 4 + e.Row.CssClass = "Totales" + Case 3 + e.Row.CssClass = "SubTotales2" + Case 2 + e.Row.CssClass = "SubTotales" + Case 1 + e.Row.CssClass = "SubTotalesB" + Case 0 + e.Row.CssClass = "Texto" + End Select + End If + End Sub + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + CargaDatos() + End Sub +End Class diff --git a/Ventas/RepVentasMensuales.aspx b/Ventas/RepVentasMensuales.aspx new file mode 100644 index 000000000..248ffec8c --- /dev/null +++ b/Ventas/RepVentasMensuales.aspx @@ -0,0 +1,230 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepVentasMensuales.aspx.vb" Inherits="RepVentasMensuales" %> + + + + + + + + + + Ventas Mensuales + + +
  • + PDF +
  • +
  • + Excel +
  • +
    + + + +
    +
    +
    + + "> + +
    +
    +
    + + <%--
    Proveedor
    +
    + +
    --%> + +
    Fecha Inicio:
    +
    +
    + + + + +
    + + + +
    + +
    Fecha Fin:
    +
    +
    + + + + +
    + + +
    + +
    Sucursal:
    +
    + +
    +
    +
    +
    Clasificación de Productos:
    +
    + +
    + +
    Vendedor:
    +
    + +
    + +
    Marca:
    +
    + +
    + +
    +
    +
    Grupo:
    +
    + + Clientes + Sucursales + Productos Servicios + +
    +
    + +
    +
    +
    > +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + diff --git a/Ventas/RepVentasMensuales.aspx.vb b/Ventas/RepVentasMensuales.aspx.vb new file mode 100644 index 000000000..70ad49927 --- /dev/null +++ b/Ventas/RepVentasMensuales.aspx.vb @@ -0,0 +1,120 @@ +Imports System.Data +Imports Extensiones +Imports Microsoft.Reporting.WebForms + +Partial Class RepVentasMensuales + Inherits ClsPaginas + + Private Property DtDatos As DataTable + Get + DtDatos = DirectCast(ViewState("DtDatos"), DataTable) + End Get + + Set(ByVal value As DataTable) + ViewState("DtDatos") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + InicializarFiltros() + CargaDatos() + End If + End Sub + Private Sub InicializarFiltros() + Dim dNow As Date = Now + TxtFechaF.Text = dNow.ToString("dd/MM/yyyy") + dNow = dNow.AddDays(-30) + TxtFechaI.Text = dNow.ToString("dd/MM/yyyy") + + DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlClasificacionesPS.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificacionesPS.DataBind() + DdlClasificacionesPS.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedor.DataBind() + DdlVendedor.Items.Insert(0, New ListItem("Todos", "-1")) + + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetMarcas(UsuarioActual.CveEmpresa) Then + DdlMarca.DataSource = ObjPS.DtResultados + End If + ObjPS.Dispose() + DdlMarca.DataBind() + DdlMarca.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub + + Private Sub CargaDatos() + Dim ObjVentas As New ClsVentas + If ObjVentas.GetRepVentasMensuales(UsuarioActual.CveEmpresa, TxtFechaI.Text, TxtFechaF.Text, DdlSubProyecto.SelectedValue.ToEntero, DdlClasificacionesPS.SelectedValue.ToEntero, + DdlVendedor.SelectedValue.ToEntero, DdlMarca.SelectedValue.ToEntero, DdlModalidad.SelectedValue.ToEntero) Then + GV.DataSource = ObjVentas.DtResultados + DtDatos = ObjVentas.DtResultados + End If + ObjVentas.Dispose() + GV.DataBind() + End Sub + + Protected Sub btConsultar_Click(sender As Object, e As EventArgs) Handles btConsultar.Click + CargaDatos() + UPDatos.Update() + End Sub + + Public Sub LnkPDF_Click() Handles LnkPDF.Click + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) + If Imagen.Exists Then + params.Add(New ReportParameter("pImg", logouri)) + Else + params.Add(New ReportParameter("pImg", "")) + End If + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) + params.Add(New ReportParameter("FechaImpresion", Today)) + params.Add(New ReportParameter("Modalidad", DdlModalidad.SelectedValue)) + + ImprimirPDF("Empresas/Grales/Formatos/RepVentasMensuales.rdlc", DtDatos, params, "Rep. Ventas Mensuales", "PDF", RDSName:="DataSet1") + End Sub + + Public Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + GV.ExportToExcel("Evaluaciones de Proveedores" & Now.ToShortDateString & ".xls") + End Sub + + Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Dim CveCliente As Integer = -1 + Dim CveSubProyecto As Integer = -1 + If DdlModalidad.SelectedValue = "0" Then + CveCliente = e.Row.DataKey("Clave").ToEntero + CveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero + Else + CveSubProyecto = e.Row.DataKey("Clave") + End If + Dim FechaInicio As Date = TxtFechaI.Text + Dim FechaFin As Date = TxtFechaF.Text + Dim CveMarca As Integer = DdlMarca.SelectedValue.ToEntero + Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero + Dim URL As String = String.Format("/Ventas/RepVentasMensualesDetalle.aspx?CveCliente={0}&CveSubProyecto={1}&FechaInicio={2}&FechaFin={3}&CveMarca={4}&CveVendedor={5}", + CveCliente, CveSubProyecto, FechaInicio, FechaFin, CveMarca, CveVendedor) + e.Row.FCHyperLink("HlkNombre").NavigateUrl = URL + e.Row.FCHyperLink("LblEne").NavigateUrl = URL + e.Row.FCHyperLink("LblFeb").NavigateUrl = URL + e.Row.FCHyperLink("LblMzo").NavigateUrl = URL + e.Row.FCHyperLink("LblAbr").NavigateUrl = URL + e.Row.FCHyperLink("LblMay").NavigateUrl = URL + e.Row.FCHyperLink("LblJun").NavigateUrl = URL + e.Row.FCHyperLink("LblJul").NavigateUrl = URL + e.Row.FCHyperLink("LblAgo").NavigateUrl = URL + e.Row.FCHyperLink("LblSep").NavigateUrl = URL + e.Row.FCHyperLink("LblOct").NavigateUrl = URL + e.Row.FCHyperLink("LblNov").NavigateUrl = URL + e.Row.FCHyperLink("LblDic").NavigateUrl = URL + End If + End Sub +End Class diff --git a/Ventas/RepVentasMensualesDetalle.aspx b/Ventas/RepVentasMensualesDetalle.aspx new file mode 100644 index 000000000..2aaaad5be --- /dev/null +++ b/Ventas/RepVentasMensualesDetalle.aspx @@ -0,0 +1,142 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepVentasMensualesDetalle.aspx.vb" Inherits="RepVentasMensualesDetalle" %> + + + + + + + + + + Rep. Detalle de la Venta Mensual + + +
  • + PDF +
  • +
  • + Excel +
  • +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + diff --git a/Ventas/RepVentasMensualesDetalle.aspx.vb b/Ventas/RepVentasMensualesDetalle.aspx.vb new file mode 100644 index 000000000..e707f66b6 --- /dev/null +++ b/Ventas/RepVentasMensualesDetalle.aspx.vb @@ -0,0 +1,74 @@ +Imports System.Data +Imports Extensiones +Imports Microsoft.Reporting.WebForms + +Partial Class RepVentasMensualesDetalle + Inherits ClsPaginas + + Private Property DtDatos As DataTable + Get + DtDatos = DirectCast(ViewState("DtDatos"), DataTable) + End Get + + Set(ByVal value As DataTable) + ViewState("DtDatos") = value + End Set + End Property + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CargaDatos() + End If + End Sub + + Private Sub CargaDatos() + 'URL DE PRUEBA + '/Ventas/RepVentasMensualesDetalle.aspx?CveCliente=270821&CveSubProyecto=-1&FechaInicio=2020-02-15&FechaFin=2020-02-20&CveMarca=-1&CveVendedor=-1 + Dim FechaInicio As Date = Request.QueryString("FechaInicio") + Dim FechaFin As Date = Request.QueryString("FechaFin") + Dim CveCliente As Integer = Request.QueryString("CveCliente") + Dim CveSubProyecto As Integer = Request.QueryString("CveSubProyecto") + Dim CveMarca As Integer = Request.QueryString("CveMarca") + Dim CveVendedor As Integer = Request.QueryString("CveVendedor") + + Dim ObjVentas As New ClsVentas + If ObjVentas.GetRepVentasMensualesDetalle(UsuarioActual.CveEmpresa, CveCliente, FechaInicio, FechaFin, CveSubProyecto, CveVendedor, CveMarca) Then + GV.DataSource = ObjVentas.DtResultados + DtDatos = ObjVentas.DtResultados + End If + ObjVentas.Dispose() + GV.DataBind() + End Sub + + Public Sub LnkPDF_Click() Handles LnkPDF.Click + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) + If Imagen.Exists Then + params.Add(New ReportParameter("pImg", logouri)) + Else + params.Add(New ReportParameter("pImg", "")) + End If + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) + params.Add(New ReportParameter("FechaImpresion", Today)) + params.Add(New ReportParameter("Modalidad", 2)) + + ImprimirPDF("Empresas/Grales/Formatos/RepVentasMensualesDetalle.rdlc", DtDatos, params, "Rep. Ventas Mensuales", "PDF", RDSName:="DataSet1") + End Sub + + Public Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + GV.ExportToExcel("Evaluaciones de Proveedores" & Now.ToShortDateString & ".xls") + End Sub + + Public Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DataKey("Etiqueta") = "Padre" Then + e.Row.CssClass = "Totales" + ElseIf e.Row.DataKey("Etiqueta") = "SubPadre" Then + e.Row.CssClass = "SubTotales" + End If + End If + End Sub +End Class diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 40b64fa71..840c535f4 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -308,6 +308,9 @@ <%----%> Saldar +
  • + Generar Orden de Compra +
  • @@ -3541,7 +3544,7 @@
    + DataKeyNames="ISTotal,Saldo,CveIE,Folio,Tipo,CveVenta,CveConceptoContable,CveConceptoContableAmor, TotalAnticipo, SubTotalAnticipo, IVAAnticipo, ImpuestosLocalesAnticipo, SubTotalAmortizacion, SubTotal, Original, IVA, RetIVA, RetISR, IdCtaContableNC,FolioFiscal, CveClasificacionNC, IdCtaContableNCSIG, TipoCambio,TipoCambioPago,TipoCambioHoy, CveMoneda,Fecha,SaldoSubTotal"> diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index d5fb792ac..e9235b586 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3543,6 +3543,7 @@ Partial Class Ventas ' LbCancelarDocumentoManual.Visible = True 'End If + If Not CveEstatus.Contiene(4, 5, 12, 13, 20) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs", "Ant") AndAlso UsuarioActual.TienePermisoProceso(159) Then Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto"))) If TienePermiso <> "" Then @@ -4362,6 +4363,19 @@ Partial Class Ventas CargaCodigoUnico() + 'SI ES COTIZACION PUEDE GENERAR UNA OC PARA MODIFICAR LOS IMPORTES + If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(583) = "1" Then + Dim DtOCGeneradas As DataTable = Nothing + If ObjVentas.GetVentasCotizacionesOC(Me.CveVenta, -1, UsuarioActual.CveEmpresa) Then + DtOCGeneradas = ObjVentas.DtResultados.Copy() + End If + If DtOCGeneradas IsNot Nothing AndAlso DtOCGeneradas.Rows.Count > 0 Then + LtGenerarOC.Visible = False + Else + LtGenerarOC.Visible = True + End If + End If + UpPS.Update() UpContado.Update() UpEstatus.Update() @@ -5821,6 +5835,11 @@ Partial Class Ventas Descuento = (GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal).RoundSQL(NumeroDecimales) CuentaPredial = GvPS.Rows(e.RowIndex).FCTextBox("TxtPredial").Text.Trim + If PU <= 0 AndAlso UsuarioActual.CveEmpresa = 141 Then + Alert("El precio debe ser mayor a 0", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + If UsuarioActual.CveEmpresa = 140 Then Descuento = CalcularDescuentos(TmpDT.Rows(e.RowIndex)("CvePS").ToString.ToEntero, Cantidad, PU) End If @@ -6669,7 +6688,7 @@ Partial Class Ventas 'If (UsuarioActual.CveEmpresa.Contiene(1, 4, 5, 7, 11, 12, 72, 80, 81, 83) And UsuarioActual.CveUsuario = 100) Or UsuarioActual.CveEmpresa.Contiene(80, 83) Or UsuarioActual.CveUsuario = 100 Then If (Archivo.Exists Or Archivo2.Exists) And IfNull(CveVenta, 0).ToString.ToEntero > 0 Then HplDownPDF.Visible = True - HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta))) + HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))) End If UpnTools.Update() @@ -8789,8 +8808,8 @@ Partial Class Ventas 'siempre estaremos agregando el iva, auqnue sea en importe cero o tasa cero, para que se emita la factura ' If drr("ImporteIVA").ToString.ToDouble > 0 Then - 'si es ingreso amortizado por la totalidad, y arroja el valor total de cero, no debe de impuestos - If Timbre.Comprobante.Total > 0 Then + 'si es ingreso amortizado por la totalidad, y arroja el valor total de cero, no debe de impuestos, y si la BASE de calculo es mayor a cero + If Timbre.Comprobante.Total > 0 AndAlso concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional > 0 Then concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal}) End If @@ -9301,7 +9320,7 @@ Partial Class Ventas Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion) Then ErrorList.Add("Ocurrió un error al Generar la Venta.
    Revise su factura y cualquier detalle comuníquese a Soporte Técnico") Else - If factura.TipoDocto.Contiene("Dev") Or DtVentasNC IsNot Nothing Then + If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Then If DtVentasNC IsNot Nothing Then For Each row As DataRow In DtVentasNC.Rows If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, row("CveVenta").ToString.ToEntero) Then @@ -9749,7 +9768,7 @@ Partial Class Ventas Case 3 'Cliente If ObjFactura.TipoDocto = "Ant" Then - ConceptoContable = If(UsuarioActual.CveEmpresa.Contiene(1, 119), 95, ConceptoContable) + ConceptoContable = If(UsuarioActual.CveEmpresa.Contiene(119), 95, ConceptoContable) importeMovimiento = ObjFactura.SubTotal * ValorMultiplicador importeMX = importeMovimiento * tipoCambio * Multiplicador FechaMovimiento = ObjFactura.FechaPago @@ -11670,7 +11689,7 @@ Partial Class Ventas If e.Row.DBCampo("Tipo").ToString = "NC" And e.Row.DataKey("CveVenta").ToString.ToEntero > 0 Then If e.Row.DBCampo("CveMoneda").ToString.ToEntero = 2 Then - tipoCambio = e.Row.DataKey("TipoCambio").ToString.ToDecimal + tipoCambio = e.Row.DBCampo("TipoCambioHoy").ToString.ToDecimal Else tipoCambio = GlobalTipoCambio(e.Row.DataKey("Fecha").ToString.ToDate).ToDecimal End If @@ -11695,6 +11714,7 @@ Partial Class Ventas End If End If + saldo = saldo.RoundSQL() Dim maxsaldo As Decimal If total > saldo Then @@ -11703,7 +11723,7 @@ Partial Class Ventas maxsaldo = total End If - e.Row.FCLiteral("MonedaVenta").Text = saldo.FormatoNumero(4) + e.Row.FCLiteral("MonedaVenta").Text = saldo.FormatoNumero(2) e.Row.FCCheckBox("Chk" & e.Row.RowIndex).Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1});", e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).ClientID, saldo)) e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1});", e.Row.FCCheckBox("Chk" & e.Row.RowIndex).ClientID, saldo)) e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).Attributes.Add("onKeyUp", String.Format("CambioTipoMoneda({0},{1},{2},{3},{4});", e.Row.FCCheckBox("Chk" & e.Row.RowIndex).ClientID, e.Row.DataKey("Saldo"), e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).ClientID, e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).ClientID, e.Row.DataKey("CveMoneda"))) @@ -11874,7 +11894,7 @@ Partial Class Ventas tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal) PorcentajePago = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN DOLARES - tipoCambioPago = gvr.DataKey("TipoCambio").ToDecimal() ' gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal + tipoCambioPago = gvr.DataKey("TipoCambioHoy").ToDecimal() ' gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal tipoCambioVenta = 1 tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal) PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal @@ -13905,6 +13925,11 @@ Partial Class Ventas Return False End If + If PU <= 0 AndAlso UsuarioActual.CveEmpresa = 141 Then + Alert("El precio debe ser mayor a 0", TipoMensaje.MsgAdvertencia) + Return False + End If + 'VALIDA PROMOCIONES Dim ObjVentas As New ClsVentas If ObjVentas.GetPromocionesPS(-1, TxtFecha.Text.ToDateTime, DdlSubProyectoDatos.SelectedValue.ToEntero, CveCliente, DdlVendedor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then @@ -14687,6 +14712,8 @@ Partial Class Ventas TmpDT.Columns.Add("EsOutSourcing", GetType(Boolean)) TmpDT.Columns.Add("EsCargo", GetType(Boolean)) + TmpDT.Columns("EsOutSourcing").DefaultValue = False + End Sub Private Sub CreaDTmpC() DTmpC = New DataTable @@ -23878,6 +23905,20 @@ Partial Class Ventas #End Region #Region " EMITIR DOCUMENTO NUEVO " + + Private Function ValidaFacturarCotizacion() As Boolean + Dim Retorno As Boolean = True + + If UsuarioActual.CveEmpresa = 141 Then + If Not PermiteCredito AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) Then + Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia) + Retorno = False + Return Retorno + End If + End If + + Return Retorno + End Function Private Sub EmitirDocumentoNuevo(TipoDoctoNuevo As String) If GvPagos.Rows.Count = 0 And UsuarioActual.Empresa.Funcionalidad(558).ToEntero = 1 And RBLPago.SelectedValue.ToEntero = 2 Then Alert("No se puede facturar hasta que se haya especificado detalladamente la forma de pago", TipoMensaje.MsgAdvertencia) @@ -23886,11 +23927,17 @@ Partial Class Ventas 'CARGA LO PENDIENTE POR FACTURAR DE COTIZACION If EraCotizacion = 1 Then + + If Not ValidaFacturarCotizacion() Then + Exit Sub + End If + If Not PreparaFacturarCotizacion() Then EraCotizacion = 0 DdlTipoComprobante.SelectedValue = "Cot" Exit Sub End If + End If 'CARGA LO PENDIENTE POR FACTURAR DE REMISION @@ -24658,4 +24705,7 @@ Partial Class Ventas ' Return File 'End Function + Protected Sub LnkGenerarOC_Click(sender As Object, e As EventArgs) + Response.Redirect($"~/OC/OC.aspx?CveCotizacion={Me.CveVenta}&Tipo=OC") + End Sub End Class \ No newline at end of file diff --git a/asmx/WsTSoft.asmx b/asmx/WsTSoft.asmx index 7d9e99ee5..626fdbb83 100644 --- a/asmx/WsTSoft.asmx +++ b/asmx/WsTSoft.asmx @@ -65,13 +65,20 @@ Public Class WsTSoft If Continuar Then 'CONSULTA DIRECCIONES Dim Direcciones As JArray = ConsultarDirecciones(ObjGPS.DtResultados, "Lat", "Lng") - For Each Dir As JObject In Direcciones - ObjGPS.DtResultados.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString() - Next - - ObjPos.Lat = ObjGPS.DtResultados.Rows("0")("Lat").ToString - ObjPos.Lng = ObjGPS.DtResultados.Rows("0")("Lng").ToString - ObjPos.Direccion = ObjGPS.DtResultados.Rows("0")("Direccion").ToString + Try + If Direcciones IsNot Nothing Then + For Each Dir As JObject In Direcciones + ObjGPS.DtResultados.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString() + Next + End If + + ObjPos.Lat = ObjGPS.DtResultados.Rows("0")("Lat").ToString + ObjPos.Lng = ObjGPS.DtResultados.Rows("0")("Lng").ToString + ObjPos.Direccion = ObjGPS.DtResultados.Rows("0")("Direccion").ToString + Catch ex As Exception + ObjPos.CurrentError = "No se pudo obtener la posición." + OnError("Ocurrió un error al asignar las direcciones", ex) + End Try Else ObjPos.CurrentError = "No se pudo obtener la posición." End If @@ -103,17 +110,25 @@ Public Class WsTSoft Dim Continuar As Boolean = objTsoft.GETRemisionesHistorial(FolioRemision, NoEconomico) Dim objRem As New GetRemisionHistorialesObj If Continuar Then - Dim Dt = objTsoft.DtResultados.Copy() - Dt.Columns.Add("Direccion", GetType(String)) + Try + Dim Dt = objTsoft.DtResultados.Copy() + Dt.Columns.Add("Direccion", GetType(String)) - 'CONSULTA DIRECCIONES - Dim Direcciones As JArray = ConsultarDirecciones(Dt, "Lat", "Lon") - For Each Dir As JObject In Direcciones - Dt.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString() - Next + 'CONSULTA DIRECCIONES + Dim Direcciones As JArray = ConsultarDirecciones(Dt, "Lat", "Lon") + If Direcciones IsNot Nothing Then + For Each Dir As JObject In Direcciones + Dt.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString() + Next + End If - objRem.Historial = Dt.DataTableToObject(Of GetRemisionHistorialsObj) - objRem.CurrentError = "" + objRem.Historial = Dt.DataTableToObject(Of GetRemisionHistorialsObj) + objRem.CurrentError = "" + Catch ex As Exception + objRem.CurrentError = "Ocurrió un error al asignar las direcciones" + OnError("Ocurrió un error al asignar las direcciones", ex) + End Try + Else objRem.Historial = New List(Of GetRemisionHistorialsObj) objRem.CurrentError = objTsoft.MyCurrentError @@ -129,11 +144,17 @@ Public Class WsTSoft Dim objTsoft As New ClsTSoft If objTsoft.GetInfoEventosPenske(FechaInicio.ToDateTime(), FechaFin.ToDateTime()) Then If objTsoft.DtResultados.Rows.Count > 0 Then - 'CONSULTA DIRECCIONES - Dim Direcciones As JArray = ConsultarDirecciones(objTsoft.DtResultados) - For Each Dir As JObject In Direcciones - objTsoft.DtResultados.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString() - Next + Try + 'CONSULTA DIRECCIONES + Dim Direcciones As JArray = ConsultarDirecciones(objTsoft.DtResultados) + If Direcciones IsNot Nothing Then + For Each Dir As JObject In Direcciones + objTsoft.DtResultados.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString() + Next + End If + Catch ex As Exception + OnError("Ocurrió un error al asignar las direcciones", ex) + End Try retorno = objTsoft.DtResultados.DataTableToJSONIPP() Else