From 2b50e557e1b50911ede69f0c5e01605d976d877f Mon Sep 17 00:00:00 2001 From: rakcsle Date: Wed, 22 Jun 2022 17:09:55 -0700 Subject: [PATCH 01/10] Repcomprasaf, compras ver cultivos en subproyectos --- Agropecuaria/CierreCultivo.aspx | 122 +++++++++++++++++++-------- Agropecuaria/CierreCultivo.aspx.vb | 91 ++++++++++++++++---- App_Code/ClsGenerales.vb | 2 +- Compras/Compras.aspx | 8 +- Compras/Compras.aspx.vb | 42 +++++++-- Compras/RepComprasAF.aspx.vb | 18 ++-- Empresas/13/Formatos/Factura.rdlc | 10 ++- Inventarios/CartaPorteManual.aspx.vb | 6 +- Ventas/ProductosServicios.aspx.vb | 7 +- 9 files changed, 227 insertions(+), 79 deletions(-) diff --git a/Agropecuaria/CierreCultivo.aspx b/Agropecuaria/CierreCultivo.aspx index cfe196643..f51fb3003 100644 --- a/Agropecuaria/CierreCultivo.aspx +++ b/Agropecuaria/CierreCultivo.aspx @@ -1,14 +1,11 @@ -<%@ Page Title="Catálogo de Unidades" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CierreCultivo.aspx.vb" Inherits="Agrupecuaria_CierreCultivo" EnableEventValidation="false" %> +<%@ Page Title="Cierre de Cultivo" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CierreCultivo.aspx.vb" Inherits="Agrupecuaria_CierreCultivo" EnableEventValidation="false" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> - @@ -18,10 +15,10 @@ - +
  • - + Cerrar Cultivo
  • @@ -33,32 +30,32 @@ -
    -
    -
    - - "> - -
    -
    -
    +
    +
    +
    + + + "> + +
    +
    +
    + +
    Temporada:
    +
    + + +
    -
    Temporada:
    -
    - -
    - +
    +
    >
    -
    > 1 - -
    -
    - + @@ -69,15 +66,15 @@
    - - - - + + + + - - + +
    @@ -87,6 +84,61 @@ + + + + + diff --git a/Agropecuaria/CierreCultivo.aspx.vb b/Agropecuaria/CierreCultivo.aspx.vb index 9b6b4f83e..bebc8334b 100644 --- a/Agropecuaria/CierreCultivo.aspx.vb +++ b/Agropecuaria/CierreCultivo.aspx.vb @@ -1,18 +1,20 @@ -Imports Extensiones +Imports System.Data +Imports Extensiones Partial Class Agrupecuaria_CierreCultivo Inherits ClsPaginas - Private Property CveCamion As Integer + Private Property DT_Datos_Cierre As DataTable Get - If ViewState("CveCamion") Is Nothing Then - Return -1 - Else - Return ViewState("CveCamion").ToString().ToEntero() + If ViewState("DT_Datos_Cierre") Is Nothing Then + ViewState("DataTable") = New DataTable End If + + Return DirectCast(ViewState("DT_Datos_Cierre"), DataTable) + End Get - Set(ByVal value As Integer) - ViewState("CveCamion") = value + Set(ByVal value As DataTable) + ViewState("DT_Datos_Cierre") = value End Set End Property @@ -36,6 +38,9 @@ Partial Class Agrupecuaria_CierreCultivo UpFiltros.Update() + + CargarCentrosDeCosto(Nothing, DdlModalSubProyectoCierreCultivo, Nothing, LblMoldalSubProyectoCierreCultivo, "Seleccione Uno") + End Sub @@ -51,10 +56,14 @@ Partial Class Agrupecuaria_CierreCultivo If ObjGral.GetCierreCultivos(DdlTemporada.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then GvDatos.DataSource = ObjGral.DtResultados + DT_Datos_Cierre = ObjGral.DtResultados Else GvDatos.DataSource = Nothing + DT_Datos_Cierre = Nothing End If + OcultarmostrarControles(DT_Datos_Cierre) + ObjGral.Dispose() GvDatos.DataBind() UpDatos.Update() @@ -63,16 +72,64 @@ Partial Class Agrupecuaria_CierreCultivo End Sub - Private Sub CierraCultivo() - - End Sub - - - - - - Protected Sub btConsultar_Click(sender As Object, e As EventArgs) CargaDatos() End Sub + + Protected Sub LnkAccionesCerrarCultivo_Click(sender As Object, e As EventArgs) + + + + RegistraScript("$('#DivModalCerrarCultivo').modal('show');") + UpModalCerrarCultivo.Update() + + + End Sub + + + Public Sub OcultarmostrarControles(ByRef DTCierreCultivos As DataTable) + + If DTCierreCultivos IsNot Nothing AndAlso DTCierreCultivos.Rows.Count > 0 Then + LnkAccionesCerrarCultivo.Visible = True + Else + LnkAccionesCerrarCultivo.Visible = False + End If + + UpAcciones.Update() + + End Sub + + + Private Sub CierraCultivo() + + Dim ObjConta As New ClsContabilidad() + ObjConta.IniciaTransacSQL() + Dim CvePrePoliza As Integer = -1 + Dim ErrorProceso As Boolean = False + + + Dim ImporteCierre As Decimal = DT_Datos_Cierre.SUMD("Importe") + + CvePrePoliza = ObjConta.AddPrePolizas("CierreCultivo/Cerrar", 1, ImporteCierre, ImporteCierre, 1, TxtmodalFechaCierreCultivo.Text.ToDate, $"Cierre Temporada {DdlTemporada.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=FolioFijo, ReglaFolioPoliza:=ObjCompras.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, DdlTipoTransaccionCaja.SelectedValue, UsuarioActual.CveEmpresa), CveTipoPoliza:=ObjConta.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, DdlTipoTransaccionCaja.SelectedValue, UsuarioActual.CveEmpresa)) + + If CvePrePoliza > 0 Then + + Else + ErrorProceso = True + End If + + + If ErrorProceso Then + ObjConta.RollBack() + Else + ObjConta.Commit() + + RegistraScript("$('#DivModalCerrarCultivo').modal('hide');") + End If + + ObjConta.Dispose() + + End Sub + + End Class diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 25e840d47..3550ba3bb 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -4067,7 +4067,7 @@ Public Class ClsGenerales .Add("@Cantidad", SqlDbType.Float).Value = Cantidad .Add("@CveUnidadMedida", SqlDbType.Int).Value = CveUnidadMedida .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@PesoKg", SqlDbType.SmallMoney).Value = CveUsuario + .Add("@PesoKg", SqlDbType.SmallMoney).Value = PesoKg End With diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 6497c6564..198291fb2 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -734,7 +734,7 @@ - + <%-- 0 --%> @@ -773,7 +773,7 @@ - + <%-- 6 --%> @@ -4389,10 +4389,10 @@
    -
    +
    - diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 37e054089..d0e9006b5 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -1324,7 +1324,7 @@ Partial Class Compras_Compras If Request("CveCompra") IsNot Nothing AndAlso IsNumeric(Request("CveCompra")) AndAlso Request("CveCompra").ToEntero > 0 Then extrafiltro = "" End If - DdlCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"{extrafiltro} CveSubProyecto = {DdlSubProyecto.SelectedValue}") + DdlCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"{extrafiltro} CveSubProyecto = {DdlSubProyecto.SelectedValue}", "TemporadaCuadro") DdlCultivosCuadro.DataBind() DdlCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1")) @@ -10927,18 +10927,27 @@ Partial Class Compras_Compras If Version = "3.3" OrElse Version = "4.0" Then For Each traslado As XmlNode In nodeTraslados - If traslado.Attributes("Impuesto").Value = "002" Then TrasladoIVA += traslado.Attributes("Importe").Value.ToDecimal - If traslado.Attributes("Impuesto").Value = "003" Then TrasladoIEPS += traslado.Attributes("Importe").Value.ToDecimal + If traslado.Attributes("Importe") IsNot Nothing Then + If traslado.Attributes("Impuesto").Value = "002" Then TrasladoIVA += traslado.Attributes("Importe").Value.ToDecimal + If traslado.Attributes("Impuesto").Value = "003" Then TrasladoIEPS += traslado.Attributes("Importe").Value.ToDecimal + End If + + Next Else For Each traslado As XmlNode In nodeTraslados - If traslado.Attributes("impuesto").Value = "IVA" Then TrasladoIVA += traslado.Attributes("importe").Value.ToDecimal - If traslado.Attributes("impuesto").Value = "IEPS" Then TrasladoIEPS += traslado.Attributes("importe").Value.ToDecimal + + If traslado.Attributes("Importe") IsNot Nothing Then + If traslado.Attributes("impuesto").Value = "IVA" Then TrasladoIVA += traslado.Attributes("importe").Value.ToDecimal + + If traslado.Attributes("impuesto").Value = "IEPS" Then TrasladoIEPS += traslado.Attributes("importe").Value.ToDecimal + End If + Next End If @@ -11439,6 +11448,7 @@ Partial Class Compras_Compras TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) TmpDT.Columns.Add("CveCultivoCuadroDetalle", GetType(Integer)) + TmpDT.Columns.Add("TemporadaCuadro", GetType(String)) TmpDTOriginal = New DataTable TmpDTOriginal.Columns.Add("Consec", GetType(Integer)) @@ -11548,6 +11558,7 @@ Partial Class Compras_Compras TmpDTOriginal.Columns.Add("Importe", GetType(Double)) TmpDTOriginal.Columns.Add("CveContratoDetalle", GetType(Double)) TmpDTOriginal.Columns.Add("CveCultivoCuadroDetalle", GetType(Double)) + TmpDTOriginal.Columns.Add("TemporadaCuadro", GetType(String)) End Sub @@ -17767,6 +17778,9 @@ Partial Class Compras_Compras 'DdlProyecto.SelectedValueExist(GvRow.DataKey("CveProyecto")) DdlSubProyecto.SelectedValueExist(GvRow.DataKey("CveSubProyecto")) + + DdlSubProyecto_SelectedIndexChanged(Nothing, Nothing) + DdlTipoGasto.SelectedValueExist(GvRow.DataKey("CveTipoGasto")) Dim PS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("") @@ -17817,6 +17831,7 @@ Partial Class Compras_Compras DVModalAddPSChkDesvincularAF.Visible = True End If + DdlCultivosCuadro.SelectedValueExist(GvRow.DataKey("CveCultivoCuadroDetalle")) UpPSS.Update() RegistraScript("$('#divAddProducto').modal('show');") @@ -17903,7 +17918,7 @@ Partial Class Compras_Compras extrafiltro = "" End If DdlCultivosCuadro.Items.Clear() - DdlCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"{extrafiltro} CveSubProyecto = {DdlSubProyecto.SelectedValue}") + DdlCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"{extrafiltro} CveSubProyecto = {DdlSubProyecto.SelectedValue}", "TemporadaCuadro") DdlCultivosCuadro.DataBind() DdlCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1")) @@ -18194,7 +18209,8 @@ Partial Class Compras_Compras AddPS(TxtCantidad.Text.Trim.ToDecimal, ddlUM.SelectedValue.ToEntero, ddlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, HdnTipoPS.Value.ToEntero, DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDecimal, Total, IVA, TxtRetIVAModal.Text.ToDecimal / 100, TxtRetISRModal.Text.ToDecimal / 100, TxtIEPSModal.Text.ToDecimal / 100, 0, TxtDescuentoModal.Text.ToDecimal, OtrosGastos:=TxtOtrosGastos.Text.ToDecimal, CveTipoGasto:=DdlTipoGasto.SelectedValue.ToEntero, TipoGasto:=DdlTipoGasto.SelectedItem.Text, - NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS, CveContratoDetalle:=CveContratoDetalle) + NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS, CveContratoDetalle:=CveContratoDetalle, + CveCultivoCuadroDetalle:=If(DdlCultivosCuadro.SelectedValue.ToEntero > 0, DdlCultivosCuadro.SelectedValue.ToEntero, -1), TemporadaCuadro:=If(DdlCultivosCuadro.SelectedValue.ToEntero > 0, DdlCultivosCuadro.SelectedItem.Text, "")) AddPS2() LimpiaAgregar() @@ -18266,7 +18282,8 @@ Partial Class Compras_Compras Obs As String, PU As Decimal, Total As Decimal, IVA As Decimal, RetIVA As Decimal, RetISR As Decimal, IEPSPS As Decimal, IEPSPSIVA As Decimal, Descuento As Decimal, Optional CveOrdenCompraDetalle As Integer = -1, Optional TCalculaTotales As Boolean = True, Optional PSCodigo As String = "-", Optional PSDescripcion As String = "-", Optional CantidadF As Double = -1, Optional EntregaDirecta As Integer = -1, Optional OtrosGastos As Decimal = 0, Optional CveSATPS As Integer = -1, Optional CargaXml As Boolean = False, Optional CveTipoGasto As Integer = -1, Optional TipoGasto As String = "", Optional PorcentajeIVA As Decimal = 0, - Optional PorcentajeIEPS As Decimal = 0, Optional PorcentajeRetIVA As Decimal = 0, Optional PorcentajeRetISR As Decimal = 0, Optional NoDeducible As Boolean = False, Optional CveContratoDetalle As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1, Optional CveSATPSActualizado As Boolean = False) As Integer + Optional PorcentajeIEPS As Decimal = 0, Optional PorcentajeRetIVA As Decimal = 0, Optional PorcentajeRetISR As Decimal = 0, Optional NoDeducible As Boolean = False, Optional CveContratoDetalle As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1, + Optional CveSATPSActualizado As Boolean = False, Optional TemporadaCuadro As String = "") As Integer Dim Row As DataRow = Nothing @@ -18408,6 +18425,7 @@ Partial Class Compras_Compras Row("CveContratoDetalle") = CveContratoDetalle Row("CveCultivoCuadroDetalle") = CveCultivoCuadroDetalle + Row("TemporadaCuadro") = TemporadaCuadro If UsuarioActual.Empresa.UsaAC Then Row("CveProgramaOperativo") = DdlACGeneral1.SelectedValue.ToEntero @@ -18436,7 +18454,9 @@ Partial Class Compras_Compras Return Retorno End Function Private Sub AddPS2(Optional pCalculaTotales As Boolean = True, Optional EsNoDeducible As Boolean = False) + Dim view As DataView = New DataView(TmpDT) + view.Sort = "Consec" GvPS.DataSource = view 'GvPS.DataSource = TmpDT @@ -18560,6 +18580,12 @@ Partial Class Compras_Compras DrPS("IEPSPSIVA") = (IEPSPSIVA * Total).RoundSQL DrPS("IEPSPSIVAPorcentaje") = IEPSPSIVA + DrPS("CveCultivoCuadroDetalle") = If(DdlCultivosCuadro.SelectedValue.ToEntero > 0, DdlCultivosCuadro.SelectedValue.ToEntero, -1) + DrPS("TemporadaCuadro") = If(DdlCultivosCuadro.SelectedValue.ToEntero > 0, DdlCultivosCuadro.SelectedItem.Text, "") + + + + 'Esta parte es para validar cuando la factura tenga ieps en o se asignara el ieps como una partida ya no se considere If (CveFactura > 0 Or CveCompra > 0) And TxtIEPS.Text.ToDecimal = 0 Then diff --git a/Compras/RepComprasAF.aspx.vb b/Compras/RepComprasAF.aspx.vb index 87a10b5f0..aa9cb1ed9 100644 --- a/Compras/RepComprasAF.aspx.vb +++ b/Compras/RepComprasAF.aspx.vb @@ -138,6 +138,8 @@ Partial Class Compras_RepComprasAF LblSubProyecto.Text = "Sucursal" End If + CargaPS(-1) + End Sub Private Sub DdlTipoActivoFijo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoActivoFijo.SelectedIndexChanged @@ -209,18 +211,15 @@ Partial Class Compras_RepComprasAF FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1") FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") Dim PS As String = DdlPS.txtText.Value - Dim CvePS As String = DdlPS.txtValue.Value - If CvePS = "" Or CvePS = "0" Then - CvePS = "-1" - End If + Dim CvePS As Integer = DdlPS.txtValue.Value.ToEntero If e.Row.DBCampo("Orden") = "1" Then - Dim Liga As String = $"/Compras/RepComprasAFDetalle.aspx?GPO={DdlGrupo.SelectedValue}&Anio={e.Row.DBCampo("Anio")}&Mes={e.Row.DBCampo("Mes")}&AnioMes={ e.Row.DBCampo("AnioMes")}&Fecha={e.Row.DBCampo("Fecha")}&CveProveedor={ e.Row.DBCampo("CveProveedor")}&CveActivoFijo={e.Row.DBCampo("CveActivoFijo")}&CveTipoActivoFijo={e.Row.DBCampo("CveTipoActivoFijo")}&CveSubTipoActivoFijo={e.Row.DBCampo("CveSubTipoActivoFijo")}&CveProyecto={ DdlProyecto.SelectedValue}&CveSubProyecto={DdlSubProyecto.SelectedValue}&CvePS={CvePS}&CveClasificacion={e.Row.DBCampo("CveClasificacion")}&CveMoneda={ e.Row.DBCampo("CveMoneda")}&FechaI={FechaI}&FechaF={FechaF}&PS={PS}&CveClasificacion2={e.Row.DBCampo("CveClasificacion2")}" + Dim Liga As String = $"/Compras/RepComprasAFDetalle.aspx?GPO={DdlGrupo.SelectedValue}&Anio={e.Row.DBCampo("Anio")}&Mes={e.Row.DBCampo("Mes")}&AnioMes={ e.Row.DBCampo("AnioMes")}&Fecha={e.Row.DBCampo("Fecha")}&CveProveedor={ e.Row.DBCampo("CveProveedor")}&CveActivoFijo={e.Row.DBCampo("CveActivoFijo")}&CveTipoActivoFijo={e.Row.DBCampo("CveTipoActivoFijo")}&CveSubTipoActivoFijo={e.Row.DBCampo("CveSubTipoActivoFijo")}&CveProyecto={ DdlProyecto.SelectedValue}&CveSubProyecto={DdlSubProyecto.SelectedValue}&CvePS={ If(CvePS > 0, CvePS.ToString, e.Row.DBCampo("CvePS").ToString) }&CveClasificacion={e.Row.DBCampo("CveClasificacion")}&CveMoneda={ e.Row.DBCampo("CveMoneda")}&FechaI={FechaI}&FechaF={FechaF}&PS={PS}&CveClasificacion2={e.Row.DBCampo("CveClasificacion2")}" e.Row.Cells(0).Text = String.Format("{2}", "Texto", Liga, e.Row.DataKey("GPO").ToString) Else e.Row.BackColor = Drawing.Color.LightGray - Dim Liga As String = $"/Compras/RepComprasAFDetalle.aspx?GPO=-1&Anio={e.Row.DBCampo("Anio")}&Mes={e.Row.DBCampo("Mes")}&AnioMes={ e.Row.DBCampo("AnioMes")}&Fecha={e.Row.DBCampo("Fecha")}&CveProveedor={ e.Row.DBCampo("CveProveedor")}&CveActivoFijo={e.Row.DBCampo("CveActivoFijo")}&CveTipoActivoFijo={e.Row.DBCampo("CveTipoActivoFijo")}&CveSubTipoActivoFijo={e.Row.DBCampo("CveSubTipoActivoFijo")}&CveProyecto={ DdlProyecto.SelectedValue}&CveSubProyecto={DdlSubProyecto.SelectedValue}&CvePS={CvePS}&CveClasificacion={e.Row.DBCampo("CveClasificacion")}&CveMoneda={ e.Row.DBCampo("CveMoneda")}&FechaI={FechaI}&FechaF={FechaF}&PS={PS}&CveClasificacion2={e.Row.DBCampo("CveClasificacion2")}" + Dim Liga As String = $"/Compras/RepComprasAFDetalle.aspx?GPO=-1&Anio={e.Row.DBCampo("Anio")}&Mes={e.Row.DBCampo("Mes")}&AnioMes={ e.Row.DBCampo("AnioMes")}&Fecha={e.Row.DBCampo("Fecha")}&CveProveedor={ e.Row.DBCampo("CveProveedor")}&CveActivoFijo={e.Row.DBCampo("CveActivoFijo")}&CveTipoActivoFijo={e.Row.DBCampo("CveTipoActivoFijo")}&CveSubTipoActivoFijo={e.Row.DBCampo("CveSubTipoActivoFijo")}&CveProyecto={ DdlProyecto.SelectedValue}&CveSubProyecto={DdlSubProyecto.SelectedValue}&CvePS={ If(CvePS > 0, CvePS.ToString, e.Row.DBCampo("CvePS").ToString)}&CveClasificacion={e.Row.DBCampo("CveClasificacion")}&CveMoneda={ e.Row.DBCampo("CveMoneda")}&FechaI={FechaI}&FechaF={FechaF}&PS={PS}&CveClasificacion2={e.Row.DBCampo("CveClasificacion2")}" e.Row.Cells(0).Text = String.Format("{2}", "Texto", Liga, e.Row.DataKey("Moneda").ToString) @@ -476,7 +475,12 @@ Partial Class Compras_RepComprasAF If Not UsuarioActual.Empresa.Funcionalidad(105).ToString = "1" Then DdlPS.ddl.Items.Clear() - DdlPS.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion, Estatus:=1) + + If CveClasificacion > 0 Then + DdlPS.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion, Estatus:=1) + End If + + DdlPS.ddl.DataBind() DdlPS.ddl.Items.Insert(0, New ListItem("*** Actualizar listado de Productos o Servicios ***", "-2")) DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) diff --git a/Empresas/13/Formatos/Factura.rdlc b/Empresas/13/Formatos/Factura.rdlc index c90ed8dfc..5c642c501 100644 --- a/Empresas/13/Formatos/Factura.rdlc +++ b/Empresas/13/Formatos/Factura.rdlc @@ -669,7 +669,13 @@ - =Fields!SATClaveProdServ.Value + =Fields!Codigo.Value + + + + @@ -743,7 +749,7 @@ - =Fields!Codigo.Value + =Fields!SATClaveProdServ.Value diff --git a/Inventarios/CartaPorteManual.aspx.vb b/Inventarios/CartaPorteManual.aspx.vb index 216757f0a..35b0da212 100644 --- a/Inventarios/CartaPorteManual.aspx.vb +++ b/Inventarios/CartaPorteManual.aspx.vb @@ -362,7 +362,7 @@ Partial Class Inventarios_CartaPorteManual DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CveProducto).FiltroPrimero("") ' Estado = -1 - If DrPS IsNot Nothing AndAlso ValidaPSSAT(DrPS) Then + If DrPS IsNot Nothing AndAlso ValidaPSSAT(DrPS, TxtPesoKg.Text.ToDecimal) Then 'codigo temporal Dim tLote As String @@ -1553,11 +1553,11 @@ Partial Class Inventarios_CartaPorteManual - Function ValidaPSSAT(DrPS As DataRow) As Boolean + Function ValidaPSSAT(DrPS As DataRow, PesoKg As Decimal) As Boolean Dim Respuesta As Boolean = False Dim CveSATPS As Integer = DrPS("CveSATPS").ToString.ToEntero - Dim PesoKg As Decimal = DrPS("PesoKg").ToString.ToDecimal + 'Dim PesoKg As Decimal = DrPS("PesoKg").ToString.ToDecimal Dim SATClaveUnidadMedida As String = DrPS("SATClaveUnidadMedida").ToString.Trim If CveSATPS > 0 And PesoKg > 0 And SATClaveUnidadMedida.Length > 0 Then diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index d87db472b..33bdf5a4b 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -1260,8 +1260,9 @@ Partial Class ProductosyServicios If DdlSATPS.txtValue.Value.ToEntero > 0 Then If UsuarioActual.Empresa.Funcionalidad(161) = "1" Then ' si tiene activada la carta porte - ValidaMaterialPeligroso(DdlSATPS.txtValue.Value.ToEntero) + If Not ValidaMaterialPeligrosoMensaje Then + ValidaMaterialPeligroso(DdlSATPS.txtValue.Value.ToEntero) Exit Sub End If End If @@ -3148,7 +3149,9 @@ Partial Class ProductosyServicios ObjGrales.Dispose() - + If ValidaMaterialPeligrosoMensaje Then + BtnGuardar_Click(Nothing, Nothing) + End If 'Return Respuesta From ac1e7fc3f5773df54ba3fea5a2880203443ec208 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 23 Jun 2022 07:22:28 -0700 Subject: [PATCH 02/10] -- PA JAM_POG --- App_Code/ClsInventarios.vb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 318ff16ff..03c1b3216 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -5875,6 +5875,27 @@ Public Class ClsInventarios End Function #End Region +#Region "JAM - POG" + Public Function GetJAM_BASF_POG(Fecha As Date) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_JAM_BASF_POG") + With SqlAdapter.SelectCommand.Parameters + .Add("@Fecha", SqlDbType.Date).Value = Fecha + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las existencias.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function +#End Region + #Region " IDisposable Support " ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) From d7d0ddf42c1e66363a1c1c1953a019433706312e Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 23 Jun 2022 07:22:48 -0700 Subject: [PATCH 03/10] -- descarga masiva --- Ventas/RepVentaDetalle.aspx.vb | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Ventas/RepVentaDetalle.aspx.vb b/Ventas/RepVentaDetalle.aspx.vb index a25b75f11..ba2f54221 100644 --- a/Ventas/RepVentaDetalle.aspx.vb +++ b/Ventas/RepVentaDetalle.aspx.vb @@ -907,7 +907,7 @@ Partial Class RepVentaDetalle TipoDocto = "Dev" End Select - pathPDF = Server.MapPath(String.Format("~/Empresas/{0}/PDF/{1}/{2}.pdf", UsuarioActual.CveEmpresa, TipoDocto, gvr.DataKey("SerieFolio").ToString)) + pathPDF = String.Format("{0}/PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, TipoDocto, gvr.DataKey("SerieFolio").ToString) If IO.File.Exists(pathPDF) Then 'NO AGREGAR ARCHIVOS REPETIDOS @@ -924,27 +924,6 @@ Partial Class RepVentaDetalle Response.ContentType = "application/zip" Response.End() End Sub - Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer) As Byte() - Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "http://localhost:85/", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) - Dim File As Byte() = Nothing - Try - Using httpClient = New HttpClient() - httpClient.Timeout = New TimeSpan(0, 15, 0) - Using request = New HttpRequestMessage(HttpMethod.Get, Url) - request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO={2}", CveEmpresa, DateTime.UtcNow.Ticks, CveUsuarioCreo))) - Dim response = httpClient.SendAsync(request).Result - If response.StatusCode = Net.HttpStatusCode.OK Then - File = response.Content.ReadAsByteArrayAsync().Result - End If - End Using - End Using - Catch ex As Exception - File = Nothing - OnError("Ocurrió un error al descargar la factura", ex) - End Try - - Return File - End Function Private Sub BtnDescargarXML_Click(sender As Object, e As EventArgs) Handles BtnDescargarXML.Click Dim pathXML As String @@ -973,7 +952,7 @@ Partial Class RepVentaDetalle TipoDocto = "Dev" End Select - pathXML = Server.MapPath(String.Format("~/Empresas/{0}/XML/{1}/{2}.xml", UsuarioActual.CveEmpresa, TipoDocto, gvr.DataKey("SerieFolio").ToString)) + pathXML = String.Format("{0}XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, TipoDocto, gvr.DataKey("SerieFolio").ToString) If IO.File.Exists(pathXML) Then 'NO AGREGAR ARCHIVOS REPETIDOS @@ -990,6 +969,27 @@ Partial Class RepVentaDetalle Response.ContentType = "application/zip" Response.End() End Sub + Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer) As Byte() + Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "http://localhost:85/", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) + Dim File As Byte() = Nothing + Try + Using httpClient = New HttpClient() + httpClient.Timeout = New TimeSpan(0, 15, 0) + Using request = New HttpRequestMessage(HttpMethod.Get, Url) + request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO={2}", CveEmpresa, DateTime.UtcNow.Ticks, CveUsuarioCreo))) + Dim response = httpClient.SendAsync(request).Result + If response.StatusCode = Net.HttpStatusCode.OK Then + File = response.Content.ReadAsByteArrayAsync().Result + End If + End Using + End Using + Catch ex As Exception + File = Nothing + OnError("Ocurrió un error al descargar la factura", ex) + End Try + + Return File + End Function Private Sub GenerarPDF(Optional Formato As String = "PDF") If DtVentas IsNot Nothing Then From cafc67ba41610a854643c7380b461cf3dcec3adb Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 23 Jun 2022 07:23:08 -0700 Subject: [PATCH 04/10] -- tipo conta --- Inventarios/EntradasSalidas.aspx.vb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index ebc1f90e2..746e42d4f 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -1266,7 +1266,7 @@ Partial Class Inventarios_EntradasSalidas Dim TieneError = False Dim ObjConta As ClsContPAQi = Nothing - If UsuarioActual.Empresa.UsaContabilidad Or UsuarioActual.Empresa.UsaAC Then + If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso (UsuarioActual.Empresa.UsaContabilidad Or UsuarioActual.Empresa.UsaAC) Then ObjConta = New ClsContPAQi(UsuarioActual.Empresa) ObjConta.IniciaTransacSQL() End If @@ -1803,7 +1803,7 @@ Partial Class Inventarios_EntradasSalidas Case 30 CveConceptoContable = 181 TipoMovtoOtro = False - tCveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero + If DdlSubProyecto.Visible = True AndAlso DdlSubProyecto.SelectedValue.ToEntero > 0 Then tCveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero If UsuarioActual.Empresa.Funcionalidad(342).ToEntero > 0 Then IdCtaContableOtro = UsuarioActual.Empresa.Funcionalidad(342).ToEntero End If @@ -3350,9 +3350,8 @@ Partial Class Inventarios_EntradasSalidas DdlAlmacen.DataBind() Dim dttA As DataTable = Nothing dttA = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 14) - If UsuarioActual.CveEmpresa = 119 Then - dttA.Merge(GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1)) - End If + dttA.Merge(GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1)) + DdlAlmacen.DataSource = dttA 'GlobalDTAlmacen(UsuarioActual.CveEmpresa) DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) ' DdlAlmacen.SelectedValue = "-1" From 83fe34a94ba4383ec4b753766274f2c21f2dd594 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Thu, 23 Jun 2022 11:22:36 -0700 Subject: [PATCH 05/10] Compras no modificar porcentaje de iva si la Factura no tiene Iva --- Agropecuaria/CierreCultivo.aspx | 17 +++++++------- Agropecuaria/CierreCultivo.aspx.vb | 7 +++++- Compras/Compras.aspx.vb | 36 +++++++++++++++++++++++++----- 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/Agropecuaria/CierreCultivo.aspx b/Agropecuaria/CierreCultivo.aspx index f51fb3003..1766b5ce7 100644 --- a/Agropecuaria/CierreCultivo.aspx +++ b/Agropecuaria/CierreCultivo.aspx @@ -47,6 +47,13 @@ DataTextField="Temporada" DataValueField="CveTemporada">
    +
    +
    + +
    + + +
    @@ -95,15 +102,7 @@