diff --git a/App_Code/ClsClasificaciones.vb b/App_Code/ClsClasificaciones.vb index 0970a55d3..72436f388 100644 --- a/App_Code/ClsClasificaciones.vb +++ b/App_Code/ClsClasificaciones.vb @@ -192,7 +192,7 @@ Public Class ClsClasificaciones End Function Public Function AddClasificaciones(Clasificacion As String, Codigo As String, IdCuentaGasto As Integer, CuentaGasto As String, IdCuentaCostos As Integer, CuentaCostos As String, IdCuentaIngreso As Integer, CuentaIngreso As String, CveCategoria As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional RequiereSerieLote As Integer = 0, Optional UsoClasificacion As Integer = -1, Optional CveSATPS As Integer = -1, Optional RequiereAFCompra As Boolean = True, Optional RequiereAFInsumo As Boolean = True, Optional RequierePersonal As Boolean = True, - Optional EsAcumulador As Boolean = False, Optional TopVentas As Boolean = False, Optional TopCompras As Boolean = False) As Boolean + Optional EsAcumulador As Boolean = False, Optional TopVentas As Boolean = False, Optional TopCompras As Boolean = False, Optional PrecioBaseCosto As Decimal = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_ClasificacionesAdd") @@ -227,6 +227,7 @@ Public Class ClsClasificaciones .Add("@EsAcumulador", SqlDbType.Bit).Value = EsAcumulador .Add("@TopCompras", SqlDbType.Bit).Value = TopCompras .Add("@TopVentas", SqlDbType.Bit).Value = TopVentas + .Add("@PrecioBaseCosto", SqlDbType.Money).Value = PrecioBaseCosto End With @@ -300,7 +301,7 @@ Public Class ClsClasificaciones End Function Public Function UpdateClasificacion(Clasificacion As String, Codigo As String, IdCuentaGasto As Integer, CuentaGasto As String, IdCuentaCostos As Integer, CuentaCostos As String, IdCuentaIngresos As Integer, CuentaIngresos As String, Estatus As Boolean, Afectable As Boolean, CveCategoria As Integer, CveUsuario As Integer, CveClasificacion As Integer, Optional RequiereSerieLote As Integer = 0, Optional UsoClasificacion As Integer = -1, Optional CveSATPS As Integer = -1, Optional RequiereAFCompra As Boolean = True, Optional RequiereAFInsumo As Boolean = True, Optional RequierePersonal As Boolean = True, - Optional EsAcumulador As Boolean = False, Optional TopVentas As Boolean = False, Optional TopCompras As Boolean = False) As Boolean + Optional EsAcumulador As Boolean = False, Optional TopVentas As Boolean = False, Optional TopCompras As Boolean = False, Optional PrecioBaseCosto As Decimal = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_ClasificacionesUpdate") @@ -335,6 +336,7 @@ Public Class ClsClasificaciones .Add("@EsAcumulador", SqlDbType.Bit).Value = EsAcumulador .Add("@TopCompras", SqlDbType.Bit).Value = TopCompras .Add("@TopVentas", SqlDbType.Bit).Value = TopVentas + .Add("@PrecioBaseCosto", SqlDbType.Money).Value = PrecioBaseCosto End With diff --git a/App_Code/ClsContPAQi.vb b/App_Code/ClsContPAQi.vb index e5cd3194c..baa716b43 100644 --- a/App_Code/ClsContPAQi.vb +++ b/App_Code/ClsContPAQi.vb @@ -7360,20 +7360,30 @@ Public Class ClsContPAQi StrSQL.Append(" AND (@CveUsuario = -1 OR P.IdUsuario = @CveUsuario) ") StrSQL.Append(" END; ") + StrSQL.Append(" DECLARE @DtProv TABLE (IdPoliza INT INDEX IX1 CLUSTERED) ") + StrSQL.Append(" IF @CveTipoProveedor > 0 ") + StrSQL.Append(" BEGIN ") + StrSQL.Append(" INSERT INTO @DtProv SELECT PP.IdPoliza + FROM SERVIDOR.Ventas.dbo.Conta_PrePolizasDetalle PPD ") + StrSQL.Append(" INNER JOIN SERVIDOR.Ventas.dbo.Conta_PrePolizas PP ON PP.CvePrePoliza = PPD.CvePrePoliza + INNER JOIN SERVIDOR.Ventas.dbo.Comp_Proveedores Prov ON Prov.CveProveedor = PPD.CveProveedor and PP.IdPoliza > 0 + AND Prov.CveTipoProveedor = @CveTipoProveedor AND Prov.CveEmpresa = @CveEmpresa + AND PP.Fecha >= @Inicio AND PP.Fecha <= @Fin") + StrSQL.Append(" END; ") + StrSQL.Append(" SELECT P.Id,P.Fecha,T.Nombre as TipoPoliza, MP.IdPoliza, P.IdUsuario, P.Concepto AS ConceptoPoliza,P.Cargos,P.Abonos,P.Folio ,P.Folio AS Numero , SN.Nombre AS SegNeg, MP.Concepto, ") StrSQL.Append(" CASE WHEN ISNUMERIC(C.CODIGO) = 1 THEN FORMAT(CAST (C.CODIGO AS FLOAT),(SELECT REPLACE(Mascarilla,'X','0') FROM Parametros)) ELSE C.CODIGO END AS CuentaFormato , MP.TipoMovto ") StrSQL.Append(" ,C.Nombre AS Cuenta ,MP.Referencia AS Referencia, CASE WHEN MP.TipoMovto=0 THEN MP.Importe ELSE 0 END AS Cargo ") StrSQL.Append(" , CASE WHEN MP.TipoMovto=1 THEN MP.Importe ELSE 0 END AS Abono,U.Nombre AS UsuarioRegistro ") StrSQL.Append(" FROM Polizas P ") StrSQL.Append(" LEFT JOIN MovimientosPoliza MP ON P.Id= MP.IdPoliza ") - StrSQL.Append(" LEFT JOIN SERVIDOR.Ventas.dbo.Conta_PrePolizasDetalle PPD ON PPD.CvePrePolizaDetalle = MP.CvePrePolizaDetalle ") - StrSQL.Append(" LEFT JOIN SERVIDOR.Ventas.dbo.Conta_PrePolizas PP ON PP.CvePrePoliza = PPD.CvePrePoliza ") + StrSQL.Append(" LEFT JOIN SERVIDOR.Ventas.dbo.Usuarios U ON U.CveUsuario = P.IdUsuario ") StrSQL.Append(" LEFT JOIN Cuentas C ON C.Id = MP.IdCuenta ") StrSQL.Append(" LEFT JOIN TiposPolizas T ON T.Id = P.TipoPol ") StrSQL.Append(" LEFT JOIN SegmentosNegocio SN ON SN.Id = MP.IdSegNeg ") StrSQL.Append(" WHERE P.Fecha >= @Inicio AND P.Fecha <= @Fin ") - StrSQL.Append(" AND (@CveTipoProveedor = -1 OR PPD.CveProveedor in (SELECT CveProveedor FROM SERVIDOR.Ventas.dbo.Comp_Proveedores POV WHERE POV.CveEmpresa = @CveEmpresa AND POV.CveTipoProveedor = @CveTipoProveedor)) ") + StrSQL.Append(" AND (@CveTipoProveedor = -1 OR ( MP.IdPoliza IN (SELECT IdPoliza FROM @DtProv))) ") StrSQL.Append(" AND (@FolioI = -1 OR P.Folio >= @FolioI) ") StrSQL.Append(" AND (@FolioF = -1 OR P.Folio <= @FolioF) ") StrSQL.Append(" AND (@TipoP=-1 OR @TipoP =P.TipoPol) ") diff --git a/App_Code/ClsTSoft.vb b/App_Code/ClsTSoft.vb index dabf2e49f..201d58cd6 100644 --- a/App_Code/ClsTSoft.vb +++ b/App_Code/ClsTSoft.vb @@ -5,6 +5,7 @@ Imports System.Web Imports System.Data Imports System.Text Imports Extensiones +Imports System.Web.Configuration Public Class ClsTSoft Inherits ClsClaseBase @@ -200,4 +201,32 @@ Public Class ClsTSoft Return retorno End Function #End Region + + Protected Overloads Function RunQuery(msgOnError As String) As Boolean + Dim retorno As Boolean = False + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + retorno = False + + setOnError(msgOnError, ex) + End Try + Return retorno + End Function + + Public Overloads Sub setOnError(Mensaje As String, Exeption As Exception) + Dim InfoAdicional As String = "" + If SqlAdapter IsNot Nothing AndAlso SqlAdapter.SelectCommand IsNot Nothing AndAlso SqlAdapter.SelectCommand.Parameters IsNot Nothing Then + InfoAdicional = SqlAdapter.SelectCommand.Parameters.ParametrosInfo() + End If + MyCurrentError = String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional) + OnError(Mensaje, Exeption, InfoAdicional) + End Sub + Public Sub OnError(Obj As Object, Mensaje As String, Exeption As Exception, Optional InfoAdicional As String = "") + GuardaLogAD(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional), "LogClsTsoft") + Alert(Obj, Mensaje, TipoMensaje.MsgError) + 'If WebConfigurationManager.AppSettings("SiteName") IsNot Nothing AndAlso WebConfigurationManager.AppSettings("SiteName").ToString = "1" Then MandaCorreoError(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) + End Sub End Class diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index 9ee86c31d..434b07f56 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -504,8 +504,9 @@ Partial Class Bancos_ProveedoresAbonar End If CargaDatos() '(tCveProveedor, CveMoneda, FechaI, FechaF, CveUsuarioRegistro, CveUsuarioProgramo, Serie) - - 'CUANDO VIENE PROGRAMADO LLENA EL TEXTO OBSERVACIONES + CargaCuentasDepositos() + + 'CUANDO VIENE PROGRAMADO LLENA EL TEXTO OBSERVACIONES If CveUsuarioProgramo <> -1 Then RegistraScript("SumaValores();") Else @@ -2817,12 +2818,13 @@ Partial Class Bancos_ProveedoresAbonar If DtDatos.Rows.Count > 0 Then 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 StrImporte As String = DtDatos.Rows(0)("Saldo").ToString.FormatoNumero Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToString)) params.Add(New ReportParameter("Sucursal", DtDatos.Rows(1)("SubProyecto").ToString)) - params.Add(New ReportParameter("Importe", $"${DtDatos.Rows(0)("Saldo").ToString.FormatoNumero}")) + params.Add(New ReportParameter("Importe", $"${StrImporte}")) params.Add(New ReportParameter("RazonSocial", TxtPagueseA.Text)) params.Add(New ReportParameter("Fecha", TxtFechaDocumento.Text)) Dim Transferencia = "", Banco = "", CLABE = "", Cuenta = "", Correo = "" @@ -2844,13 +2846,14 @@ Partial Class Bancos_ProveedoresAbonar params.Add(New ReportParameter("CLABE", CLABE)) params.Add(New ReportParameter("Cuenta", Cuenta)) params.Add(New ReportParameter("Correo", Correo)) - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - ImprimirPDF("Empresas/Grales/Formatos/Solicitud.rdlc", DtDatos, params, "Solicitud", Opcion) - Else + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + Dim NombreArchivo As String = "SolicitudPago" ''String.Format("SolicitudPago{0}.pdf", TxtPagueseA.Text).Replace(" ", "") + ImprimirPDF("Empresas/Grales/Formatos/Solicitud.rdlc", DtDatos, params, NombreArchivo, Opcion) + Else Alert("No se encontraron datos.", TipoMensaje.MsgAdvertencia) End If End Sub diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index aadfa696e..e5d9d7edc 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -2657,6 +2657,21 @@
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
@@ -5234,18 +5249,29 @@ - function chkAnt(t, txt, importe, TotalSaldo) { + function chkAnt(t, txt, importe, TotalSaldo,CveMonedaAnticipo,TCAnticipo,CveMonedaOriginal) { var Total = ToDouble($get('TxtTotal').value); //TotalSaldo = Total; + var txtvalue = ToDouble(txt.value); + var importevalue = ToDouble(importe); + if (CveMonedaAnticipo = 1 && CveMonedaOriginal == 2) { + txtvalue = ToDouble(txtvalue / TCAnticipo); + importevalue = ToDouble(importevalue / TCAnticipo); + } else if (CveMonedaAnticipo = 2 && CveMonedaOriginal == 1) { + txtvalue = ToDouble(txtvalue * TCAnticipo); + importevalue = ToDouble(importevalue * TCAnticipo); + } //var SaldoCompra = parseFloat(parseFloat($get('HdnCompraSaldo').value).toFixed(2)); - var SaldoCompra = (TotalSaldo - FnSumaValoresAnt() + ToDouble(txt.value)).toFixed(2); // le agrego lo del valor actual para validarlo + var SaldoCompra = (TotalSaldo - FnSumaValoresAnt() + txtvalue).toFixed(2); // le agrego lo del valor actual para validarlo + + if (t.checked) { if (SaldoCompra > 0) { - if (SaldoCompra > importe) { - txt.value = ToDouble(importe).toFixed(2); + if (SaldoCompra > importevalue) { + txt.value = ToDouble(importevalue).toFixed(2); //SaldoCompra = SaldoCompra - importe; //$get('HdnCompraSaldo').value = SaldoCompra; @@ -5273,21 +5299,28 @@ } - function FnCambiaAnt(chk, txt, saldo, TotalSaldo) { + function FnCambiaAnt(chk, txt, saldo, TotalSaldo, CveMonedaAnticipo, TCAnticipo, CveMonedaOriginal) { var Total = ToDouble($get('TxtTotal').value); - var SaldoCompra = (TotalSaldo - FnSumaValoresAnt() + ToDouble(txt.value)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnCompraSaldo').value).toFixed(2)); - if (SaldoCompra < 0) txt.value = SaldoCompra - txt.value; + var txtvalue = ToDouble(txt.value); + if (CveMonedaAnticipo = 1 && CveMonedaOriginal == 2) { + txtvalue = ToDouble(txtvalue / TCAnticipo); + } else if (CveMonedaAnticipo = 2 && CveMonedaOriginal == 1) { + txtvalue = ToDouble(txtvalue * TCAnticipo); + } + + var SaldoCompra = (TotalSaldo - FnSumaValoresAnt() + ToDouble(txtvalue)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnCompraSaldo').value).toFixed(2)); + if (SaldoCompra < 0) txt.value = SaldoCompra - txtvalue; //minimo entre saldocompra y el saldoanticipo if (SaldoCompra < saldo) saldo = SaldoCompra; - if (ToDouble(txt.value) > 0) { + if (ToDouble(txtvalue) > 0) { chk.checked = true; } else { chk.checked = false; } - if (ToDouble(txt.value) > saldo) { + if (ToDouble(txtvalue) > saldo) { txt.value = saldo; alert("El Importe no debe de exceder a el saldo"); } diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 4472026cd..892ab282d 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -3238,8 +3238,10 @@ Partial Class Compras_Compras Private Sub CargaAnticipos(CveProveedor As Integer, Optional FiltroTipo As String = "-1") Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetAnticiposProveedor(CveProveedor, -1, CveMoneda:=DdlMoneda.SelectedValue.ToEntero, SelectTop:=-1, TipoDocto:=FiltroTipo) AndAlso ObjMovtos.DtResultados.Rows.Count > 0 Then - GVAnticipos.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'") + If ObjMovtos.GetAnticiposProveedor(CveProveedor, -1, CveMoneda:=-1, SelectTop:=-1, TipoDocto:=FiltroTipo) AndAlso ObjMovtos.DtResultados.Rows.Count > 0 Then + Dim CveMoneda As Integer = If(ChkPagarConPesos.Checked, 1, If(ChkPagarConDolares.Checked, 2, DdlMoneda.SelectedValue.ToEntero)) + If DdlMoneda.SelectedValue.ToEntero = 1 AndAlso CveCompra > 0 Then DivPagarConDolares.Visible = True Else If CveCompra > 0 Then DivPagarConPesos.Visible = True + GVAnticipos.DataSource = ObjMovtos.DtResultados.FiltraParametros($"Tipo = 'Act' AND CveMoneda = {CveMoneda}") If ObjMovtos.DtResultados.FiltraParametros("Saldo > 0").Rows.Count > 0 Then BtnAceptarAnticipos.Enabled = True If DdlTipoComprobante.SelectedValue = "Fac" Then ImgAnticiposPendientes.Visible = True @@ -8037,7 +8039,7 @@ Partial Class Compras_Compras If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then CveCompraNC = gvr.DataKey("CveCompra").ToEntero - tipoCambioNC = gvr.DataKey("TCCompra").ToDecimal + tipoCambioNC = If(ChkPagarConPesos.Checked, GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal, gvr.DataKey("TCCompra").ToDecimal) sumaAmortizacion = 0 If CvePrePolizaNueva > 0 Then @@ -8064,7 +8066,13 @@ Partial Class Compras_Compras ImporteMovimiento = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal importeMN = ImporteMovimiento * tipoCambioNC sumaAmortizacion += ImporteMovimiento - sumaAmortizacionCompleto += ImporteMovimiento + sumaAmortizacionCompleto += ImporteMovimiento + + If ChkPagarConPesos.Checked Then + ImporteMovimiento = ImporteMovimiento * GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal + ElseIf ChkPagarConDolares.Checked Then + ImporteMovimiento = ImporteMovimiento / gvr.DataKey("TCCompra").ToDecimal + End If If DdlMoneda.SelectedValue.ToEntero <> 1 Then IdCtaContable = CtaProveedorAnticiposExtranjera @@ -8101,7 +8109,13 @@ Partial Class Compras_Compras ImporteMovimiento = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal importeMN = ImporteMovimiento * tipoCambioNC sumaAmortizacion += ImporteMovimiento - sumaAmortizacionCompleto += ImporteMovimiento + sumaAmortizacionCompleto += ImporteMovimiento + + If ChkPagarConPesos.Checked Then + ImporteMovimiento = ImporteMovimiento * GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal + ElseIf ChkPagarConDolares.Checked Then + ImporteMovimiento = ImporteMovimiento / gvr.DataKey("TCCompra").ToDecimal + End If If DdlMoneda.SelectedValue.ToEntero <> 1 And UsuarioActual.CveEmpresa.Contiene(119) Then IdCtaContable = CtaProveedorExtranjera @@ -8138,15 +8152,24 @@ Partial Class Compras_Compras sumaAmortizacion += ImporteMovimiento sumaAmortizacionCompleto += ImporteMovimiento IdCtaContable = CtaProveedorAnticipos - CveCuenta = CveCuentaProveedorAnticipos - If ImporteMovimiento <> 0 Then - PorcentajePago = ImporteMovimiento / TxtTotal.Text.ToDecimal + CveCuenta = CveCuentaProveedorAnticipos + + PorcentajePago = ImporteMovimiento / TxtTotal.Text.ToDecimal + + If ChkPagarConPesos.Checked Then + ImporteMovimiento = ImporteMovimiento * GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal + ElseIf ChkPagarConDolares.Checked Then + ImporteMovimiento = ImporteMovimiento / gvr.DataKey("TCCompra").ToDecimal + End If + + If ImporteMovimiento <> 0 Then + + Dim TipoCambioAnt = gvr.DataKey("TCCompra").ToDecimal - Dim TipoCambioAnt = gvr.DataKey("TCCompra").ToDecimal Dim usacomplementariaAnticipo As Boolean = False - usacomplementariaAnticipo = If(TipoCambioAnt > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119), True, False) - - + usacomplementariaAnticipo = If(TipoCambioAnt > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119), True, False) + + Dim ImporteAnt As Decimal = ImporteMovimiento Dim ImporteAntMN As Decimal = ImporteAnt * TipoCambioAnt If usacomplementariaAnticipo Then @@ -8166,10 +8189,16 @@ Partial Class Compras_Compras If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteAnt, "", ConceptoContable, ConceptoPartida, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteAntMN, CvePrePolizaOriginal:=CvePrePolizaNueva, ImporteME:=If(tipoCambio = 1, 0, ImporteAnt), CveCompraAmortizacion:=CveCompraNC, CveCuenta:=CveCuenta) Then ErrorMovtosCxP = 1 + End If + + If ChkPagarConPesos.Checked Or ChkPagarConDolares.Checked Then + ImporteAnt = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal + TipoCambioAnt = If(ChkPagarConPesos.Checked, GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal, gvr.DataKey("TCCompra").ToDecimal) End If - If tipoCambio <> TipoCambioAnt Then - Dim importeFluctuacion = (ImporteAnt * tipoCambio) - (ImporteAnt * TipoCambioAnt) + Dim TipoCambioDiferencia = If(ChkPagarConDolares.Checked, GlobalTipoCambio(TxtFecha.Text.ToDate), TipoCambioCompra).ToDecimal + If TipoCambioDiferencia <> TipoCambioAnt Then + Dim importeFluctuacion = (ImporteAnt * TipoCambioDiferencia) - (ImporteAnt * TipoCambioAnt) If importeFluctuacion > 0 Then ConceptoContable = 64 @@ -8565,8 +8594,10 @@ Partial Class Compras_Compras If DdlMoneda.SelectedValue.ToEntero <> 1 Or gvr.DataKey("CveMoneda").ToEntero <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria - If TipoCambioCompra > tipoCambioNC Then - ImporteMovimiento = (sumaAmortizacion * TipoCambioCompra) - (sumaAmortizacion * tipoCambioNC) + Dim TipoCambioDiferenciaCambiaria = If(ChkPagarConPesos.Checked, GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal, tipoCambioNC) + Dim TipoCambioDiferenciaCompra = If(ChkPagarConDolares.Checked, GlobalTipoCambio(TxtFecha.Text.ToDate), TipoCambioCompra).ToDecimal + If TipoCambioDiferenciaCompra > TipoCambioDiferenciaCambiaria Then + ImporteMovimiento = (sumaAmortizacion * TipoCambioDiferenciaCompra) - (sumaAmortizacion * TipoCambioDiferenciaCambiaria) ImporteMovimiento = ImporteMovimiento.RoundSQL() importeMN = ImporteMovimiento End If @@ -8586,8 +8617,10 @@ Partial Class Compras_Compras If DdlMoneda.SelectedValue.ToEntero <> 1 Or gvr.DataKey("CveMoneda").ToEntero <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria - If tipoCambioNC > TipoCambioCompra Then - ImporteMovimiento = (sumaAmortizacion * tipoCambioNC) - (sumaAmortizacion * TipoCambioCompra) + Dim TipoCambioDiferenciaCambiaria = If(ChkPagarConPesos.Checked, GlobalTipoCambio(gvr.DataKey("Fecha").ToDate).ToDecimal, tipoCambioNC) + Dim TipoCambioDiferenciaCompra = If(ChkPagarConDolares.Checked, GlobalTipoCambio(TxtFecha.Text.ToDate), TipoCambioCompra).ToDecimal + If TipoCambioDiferenciaCambiaria > TipoCambioDiferenciaCompra Then + ImporteMovimiento = (sumaAmortizacion * TipoCambioDiferenciaCambiaria) - (sumaAmortizacion * TipoCambioDiferenciaCompra) ImporteMovimiento = ImporteMovimiento.RoundSQL() importeMN = ImporteMovimiento End If @@ -10064,8 +10097,8 @@ Partial Class Compras_Compras If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(3).ForeColor = Drawing.Color.Red If e.Row.DBCampo("Saldo").ToDouble = 0 Then e.Row.FCLiteral("LtlAnticipos").Text = "" - e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1},{2});", e.Row.FCTextBox("TxtAnticipo").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, Saldo, If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TmpDT.SUMD("ImporteConImpuestos"), TxtTotal.Text.ToDouble)))) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO - e.Row.FCTextBox("TxtAnticipo").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1},{2});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, Saldo, If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TmpDT.SUMD("ImporteConImpuestos"), TxtTotal.Text.ToDouble)))) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO + e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1},{2});", e.Row.FCTextBox("TxtAnticipo").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, Saldo, If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TmpDT.SUMD("ImporteConImpuestos"), TxtTotal.Text.ToDouble)), e.Row.DBCampo("CveMoneda").ToEntero, If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble), DdlMoneda.SelectedValue.ToEntero)) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO + e.Row.FCTextBox("TxtAnticipo").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1},{2});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, Saldo, If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TmpDT.SUMD("ImporteConImpuestos"), TxtTotal.Text.ToDouble)), e.Row.DBCampo("CveMoneda").ToEntero, If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble), DdlMoneda.SelectedValue.ToEntero)) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO If ChkNCInv.Checked Then e.Row.FCCheckBox("Chk").CssClass = "ChkAntNC" @@ -19017,4 +19050,16 @@ Partial Class Compras_Compras End If End If End Sub + +#Region "PAGAR CON DIFERENTE MONEDA" + Protected Sub ChkPagarConPesos_CheckedChanged(sender As Object, e As EventArgs) + CargaAnticipos(CveProveedor) + UpAnticipos.Update() + End Sub + Protected Sub ChkPagarConDolares_CheckedChanged(sender As Object, e As EventArgs) + CargaAnticipos(CveProveedor) + UpAnticipos.Update() + End Sub +#End Region + End Class \ No newline at end of file diff --git a/Contabilidad/PolizasImpresion.aspx b/Contabilidad/PolizasImpresion.aspx index 3c7ec186b..7eed8c897 100644 --- a/Contabilidad/PolizasImpresion.aspx +++ b/Contabilidad/PolizasImpresion.aspx @@ -109,7 +109,7 @@ - + diff --git a/OS/Asignaciones.aspx.vb b/OS/Asignaciones.aspx.vb index ddec422b5..6b1b23c3a 100644 --- a/OS/Asignaciones.aspx.vb +++ b/OS/Asignaciones.aspx.vb @@ -167,10 +167,13 @@ Partial Class OS_Asignaciones End If For Each SubProyecto As DataRow In DtOSSubProyectos.Rows - Dim EstatusDeTipoProcesoMenor As Integer = TecnicosSubProyectos.FiltraParametros(String.Format("SubProyecto = '{0}'", SubProyecto.Item("SubProyecto"))).Rows(0).Item("CveEstatusOrdenServicio").ToString.ToEntero - Dim dtAuxiliar As New DataTable - dtAuxiliar = TecnicosSubProyectos.FiltraParametros(String.Format("SubProyecto = '{0}' AND CveEstatusOrdenServicio = {1}", SubProyecto.Item("SubProyecto"), EstatusDeTipoProcesoMenor), "", {"CveUsuario", "Nombre"}) - TecnicosResultado.Merge(dtAuxiliar) + Dim TecnicosSubProyectoAux As DataTable = TecnicosSubProyectos.FiltraParametros(String.Format("SubProyecto = '{0}'", SubProyecto.Item("SubProyecto"))) + If TecnicosSubProyectoAux.Rows.Count > 0 Then + Dim EstatusDeTipoProcesoMenor As Integer = TecnicosSubProyectoAux.Rows(0).Item("CveEstatusOrdenServicio").ToString.ToEntero + Dim dtAuxiliar As New DataTable + dtAuxiliar = TecnicosSubProyectos.FiltraParametros(String.Format("SubProyecto = '{0}' AND CveEstatusOrdenServicio = {1}", SubProyecto.Item("SubProyecto"), EstatusDeTipoProcesoMenor), "", {"CveUsuario", "Nombre"}) + TecnicosResultado.Merge(dtAuxiliar) + End If Next DtTecnicosSubProyectos = TecnicosResultado DdlTecnico.DataSource = TecnicosResultado @@ -186,6 +189,7 @@ Partial Class OS_Asignaciones Dim TieneError = False Dim CveEstatusOS = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 2", "CveEstatusOrdenServicio ASC") Dim time As DateTime + Dim contadorOrdenesAsignadas As Integer = 0 For Each row As GridViewRow In GvNA.Rows If row.RowType = DataControlRowType.DataRow Then @@ -194,6 +198,7 @@ Partial Class OS_Asignaciones If row.FCCheckBox("ChbxAsignar").Checked Then time = DateTime.Parse(String.Format("{0} {1}:{2} {3}", row.FCTextBox("FechaOS").Text, picker.Hour, picker.Minute, picker.AmPm)) + contadorOrdenesAsignadas += 1 If ObjOS.GetSubProyectosEstatusInicial(DdlTecnico.SelectedValue.ToEntero, 3, UsuarioActual.CveEmpresa) Then Dim subProyectoDelTecnico As DataTable @@ -217,11 +222,14 @@ Partial Class OS_Asignaciones End If End If Next - - If Not TieneError Then - Alert("Se asignaron las ordenes de servicio correctamente", TipoMensaje.MsgInformacion) - CargaOrdenesServiciosAsignadasXPersona() - CargaOrdenesServiciosNoAsignadas() + If contadorOrdenesAsignadas > 0 Then + If Not TieneError Then + Alert("Se asignaron las ordenes de servicio correctamente", TipoMensaje.MsgInformacion) + CargaOrdenesServiciosAsignadasXPersona() + CargaOrdenesServiciosNoAsignadas() + End If + Else + Alert("No se han seleccionado ordenes de servicio para asignar", TipoMensaje.MsgAdvertencia) End If diff --git a/OS/OrdenesServicios.aspx.vb b/OS/OrdenesServicios.aspx.vb index 115a6f2cf..9737cf675 100644 --- a/OS/OrdenesServicios.aspx.vb +++ b/OS/OrdenesServicios.aspx.vb @@ -1016,13 +1016,13 @@ Partial Class OS_OrdenesServicios MensajeAlert = New StringBuilder Dim Errores As Boolean = False - Dim EstatusOrdenServicio As Integer = DdlEstatusOS.SelectedValue.ToEntero + Dim EstatusOrdenServicio As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 1").ToEntero Dim DirectorioEmpresa = UsuarioActual.Empresa.Ruta If Not CveOS > 0 Then Dim bandera As Integer = DdlEstatusOS.SelectedValue.ToEntero - If Not ObjOrdenServicio.AddOrdenesServicios(CveCliente, DdlSubProyecto.SelectedValue.ToEntero, TxtSolicito.Text, TxtFechaRecibido.Text.ToDateTime, TxtDescripcion.Text, UsuarioActual.CveUsuario, DdlEstatusOS.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCotizacion, -1, -1, DdlTipoOrdenOS.SelectedValue.ToEntero, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then + If Not ObjOrdenServicio.AddOrdenesServicios(CveCliente, DdlSubProyecto.SelectedValue.ToEntero, TxtSolicito.Text, TxtFechaRecibido.Text.ToDateTime, TxtDescripcion.Text, UsuarioActual.CveUsuario, EstatusOrdenServicio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCotizacion, -1, -1, DdlTipoOrdenOS.SelectedValue.ToEntero, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then Errores = True End If CargaCliente(CveCliente) @@ -1303,7 +1303,6 @@ Partial Class OS_OrdenesServicios TmpDT.Rows(Row.RowIndex)("Estatus") = "False" Row.FCLinkButton("imgEstatus").CssClass = "btn btn-circle btn-sm red" End If - UpDetalleOS.Update() End Sub Private Sub BtnAddGvDetalle_Click(sender As Object, e As EventArgs) Handles BtnAddGvDetalle.Click Dim ObjOS As New ClsOS @@ -1547,7 +1546,7 @@ Partial Class OS_OrdenesServicios Dim DetallesPendientes As Integer = TmpDT.COUNT("Estatus", "Estatus = 'False'").ToEntero - Dim TipoEstatusSeleccionado As Integer = EstatusOSDelUsuario.FiltroPrimeroValor("TipoEstatus", String.Format("CveEstatusOrdenServicio = {}", DdlEstatusOS.SelectedValue), "Orden ASC").ToEntero + Dim TipoEstatusSeleccionado As Integer = EstatusOSDelUsuario.FiltroPrimeroValor("TipoEstatus", String.Format("CveEstatusOrdenServicio = {0}", DdlEstatusOS.SelectedValue), "Orden ASC").ToEntero If DetallesPendientes = 0 AndAlso TipoEstatusSeleccionado = 2 Then 'Se estatus de OS a TERMINADO diff --git a/Ventas/CatClasificaciones.aspx b/Ventas/CatClasificaciones.aspx index 9311cc807..d8fbfc59d 100644 --- a/Ventas/CatClasificaciones.aspx +++ b/Ventas/CatClasificaciones.aspx @@ -76,7 +76,7 @@
+ DataKeyNames="CveClasificacion, CveCategoria, Clasificacion, UsoClasificacion, CuentaGasto, CuentaCostos, CuentaIngresos, IdCuentaGasto, IdCuentaCostos, IdCuentaIngresos,RequiereSerieLote,CveSATPS,SATClaveProductoServicio, RequiereAFCompra, RequiereAFInsumo, RequierePersonal, Estatus,EsAcumulador,TopVentas,TopCompras,PrecioBaseCosto" EmptyDataText="No se encontraron Clasificaciones Registradas" ToolTip="Listado de Clasificaciones" CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" GridLines="None"> @@ -210,41 +210,57 @@
-
- - +
+ +
+
+
+ + +
+ +
+ + + + + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+ + +
+
+
+
+ + +
+
+
-
- - - - - - -
+
- -
- - -
- - -
- - -
- - -
- - -
-
- - -
diff --git a/Ventas/CatClasificaciones.aspx.vb b/Ventas/CatClasificaciones.aspx.vb index 518919900..0f1bd5b3e 100644 --- a/Ventas/CatClasificaciones.aspx.vb +++ b/Ventas/CatClasificaciones.aspx.vb @@ -178,11 +178,12 @@ Partial Class CatClasificaciones DdlCuentaCostos.SelectedValue.ToEntero, DdlCuentaCostos.SelectedItem.Text, DdlCuentaIngresos.SelectedValue.ToEntero, DdlCuentaIngresos.SelectedItem.Text, DdlCategoria.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, RequiereSerieLote:=RequireSerieLote, UsoClasificacion:=DdlUsoClasificacion.SelectedValue.ToEntero, CveSATPS:=DdlSATPS.SelectedValue.ToEntero, - RequiereAFCompra:=ChkRequiereAFCompra.Checked, RequiereAFInsumo:=ChkRequiereAFInsumo.Checked, RequierePersonal:=ChkRequierePersonal.Checked, EsAcumulador:=ChkEsAcumulador.Checked, TopVentas:=ChkTopVentas.Checked, TopCompras:=ChkTopCompras.Checked) Then + RequiereAFCompra:=ChkRequiereAFCompra.Checked, RequiereAFInsumo:=ChkRequiereAFInsumo.Checked, RequierePersonal:=ChkRequierePersonal.Checked, EsAcumulador:=ChkEsAcumulador.Checked, TopVentas:=ChkTopVentas.Checked, TopCompras:=ChkTopCompras.Checked, PrecioBaseCosto:=TxtPrecioBaseCosto.Text.ToDecimal) Then ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros($"(Codigo IS NULL OR Codigo = '') AND CveEmpresa = {UsuarioActual.CveEmpresa} AND (CveCategoria = {DdlCategoriaFiltro.SelectedValue.ToEntero} OR {DdlCategoriaFiltro.SelectedValue.ToEntero} = -1) AND (UsoClasificacion = {DdlTipoClasificacion.SelectedValue.ToEntero} OR {DdlTipoClasificacion.SelectedValue.ToEntero} = -1 ) AND (Estado = {DdlEstatus.SelectedValue.ToEntero} OR {DdlEstatus.SelectedValue.ToEntero} = -1)") TxtClasificacion.Text = "" + TxtPrecioBaseCosto.Text = "" DdlCuentaGasto.SelectedValueExist("0") DdlCuentaCostos.SelectedValueExist("0") DdlCuentaIngresos.SelectedValueExist("0") @@ -201,7 +202,7 @@ Partial Class CatClasificaciones If ObjClasificaciones.UpdateClasificacion(Clasificacion, "", DdlGasto.SelectedValue.ToEntero, DdlGasto.SelectedItem.Text, DdlCosto.SelectedValue.ToEntero, DdlCosto.SelectedItem.Text, DdlIngresos.SelectedValue.ToEntero, DdlIngresos.SelectedItem.Text, Estatus, False, DdlCategoria.SelectedValue.ToEntero, UsuarioActual.CveUsuario, CveClasificacion, RequiereSerieLote:=RequireSerieLote, UsoClasificacion:=DdlUsoClasificacion.SelectedValue.ToEntero, CveSATPS:=DdlSATPS.SelectedValue.ToEntero, - RequiereAFCompra:=ChkRequiereAFCompra.Checked, RequiereAFInsumo:=ChkRequiereAFInsumo.Checked, RequierePersonal:=ChkRequierePersonal.Checked, EsAcumulador:=ChkEsAcumulador.Checked, TopVentas:=ChkTopVentas.Checked, TopCompras:=ChkTopCompras.Checked) Then + RequiereAFCompra:=ChkRequiereAFCompra.Checked, RequiereAFInsumo:=ChkRequiereAFInsumo.Checked, RequierePersonal:=ChkRequierePersonal.Checked, EsAcumulador:=ChkEsAcumulador.Checked, TopVentas:=ChkTopVentas.Checked, TopCompras:=ChkTopCompras.Checked, PrecioBaseCosto:=TxtPrecioBaseCosto.Text.ToDecimal) Then RegistraScript(String.Format("$('#{0}').modal('hide');", "ModalClasificaciones")) Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) @@ -346,6 +347,7 @@ Partial Class CatClasificaciones Limpiador() TxtClasificacion.Text = "" + TxtPrecioBaseCosto.Text = "" DdlCategoria.SelectedIndex = 0 DdlSATPS.SelectedValue = "" DdlSATPS.SelectedText = "" @@ -371,6 +373,7 @@ Partial Class CatClasificaciones Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim CveClasificacion As String = GvRow.DataKey("CveClasificacion").ToString Dim Clasificacion As String = GvRow.DataKey("Clasificacion").ToString + Dim PrecioBaseCosto As String = GvRow.DataKey("PrecioBaseCosto").ToString Dim CveCategoria As String = GvRow.DataKey("CveCategoria").ToString Dim CuentaGasto As String = GvRow.DataKey("CuentaGasto").ToString Dim CuentaCostos As String = GvRow.DataKey("CuentaCostos").ToString @@ -421,6 +424,7 @@ Partial Class CatClasificaciones TxtClasificacion.Text = Clasificacion + TxtPrecioBaseCosto.Text = PrecioBaseCosto.FormatoNumero(2) DdlCategoria.SelectedValueExist(CveCategoria) DdlUsoClasificacion.SelectedValue = UsoClasificacion HdnIDClasificacion.Value = CveClasificacion diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx index 9fd8b00cc..72c285eef 100644 --- a/Ventas/PV.aspx +++ b/Ventas/PV.aspx @@ -2738,7 +2738,7 @@
-
+
@@ -2802,22 +2802,22 @@
-
+
- <%--
+
- +
-
--%> +
@@ -2842,7 +2842,7 @@
- + <%----% <%----%> @@ -2863,6 +2863,7 @@
+ <%----%> <%----%> @@ -2886,7 +2887,7 @@
- + <%----%> <%----%> @@ -2940,7 +2941,7 @@
-
+
@@ -2948,17 +2949,8 @@
-
-
-
- - - - - -
-
-
+
+
@@ -3126,7 +3118,7 @@ $get("LblPrecioFinal").innerText = formato_numero(Monto - ((Monto * Descuento) / 100), 2, '.', ','); $get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ','); var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")); - $get("LblDescuento").innerText = formato_numero(Total, 2, '.', ','); + $get("LblDescuento").innerText = formato_numero(Total, 2, '.', ','); $get("TxtDescuento").value = formato_numero(Total, 2, '.', ','); $get("TxtDescP").value = formato_numero(0, 2, '.', ','); $get("HdnDescuento").value = Total; @@ -3166,7 +3158,7 @@ $get("LblPrecioFinal").innerText = formato_numero(Monto - Descuento, 2, '.', ','); $get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ','); var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")); - $get("LblDescuento").innerText = formato_numero(Total, 2, '.', ','); + $get("LblDescuento").innerText = formato_numero(Total, 2, '.', ','); $get("TxtDescuento").value = formato_numero(Total, 2, '.', ','); $get("HdnDescuento").value = Total; if (TipoDescuento == 2) { diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index e9d0fd0f7..a8ceaff5e 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -5160,11 +5160,26 @@ Partial Class PV End If Contador += 1 Next - 'TxtPUFactura.Text = PUFactura.FormatoNumero(2) + TxtPUFactura.Text = PUFactura.FormatoNumero(2) + End If - If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then - 'TxtPUFactura.Text = "" + If DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso Not DdlFacturas.SelectedValue.ToEntero > 0 Then + Dim Index As Integer = DdlPSAjuste.SelectedIndex + Dim CvePSParametro As Integer = DdlPSAjuste.SelectedValue.ToEntero + Dim PrecioSugerido As Decimal = 0 + Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") + + If drPS IsNot Nothing Then + PrecioSugerido = drPS("Precio").ToString.ToDecimal + End If + + TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2) + + End If + + If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then + TxtPUFactura.Text = "" End If CalculaPorcentajeAjuste() @@ -5188,16 +5203,16 @@ Partial Class PV If ObjAcum.GarantiasMesesGet(-1, UsuarioActual.CveEmpresa, CveMarca, DdlTipoUso.SelectedValue.ToEntero, TxtMesesUso.Text.ToEntero) Then If ObjAcum.DtResultados.Rows.Count > 0 Then TxtPorcentajeAjuste.Text = (ObjAcum.DtResultados.Rows(0)("Valor").ToString.ToDouble / 100).ToString - TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDouble * TxtPrecio.Text.ToDouble).FormatoNumero + TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDouble * TxtPUFactura.Text.ToDouble).FormatoNumero - Dim CargoActual As Decimal = 0 - Dim CargoAnterior As Decimal = 0 + Dim CargoVendido As Decimal = 0 + Dim CargoGarantia As Decimal = 0 Dim CveTamaño As Integer = 0 If DdlPSAjuste.SelectedValue.ToEntero > 0 Then Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).Rows(0) If Dr IsNot Nothing Then - CargoAnterior = Dr("Cargo").ToString.ToDecimal + CargoGarantia = Dr("Cargo").ToString.ToDecimal End If End If @@ -5208,24 +5223,22 @@ Partial Class PV End If End If - - If GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveTamaño = {CveTamaño}").Rows(0) IsNot Nothing AndAlso GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveTamaño = {CveTamaño}").Rows.Count > 0 Then Dim DrCargo As DataRow = GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveTamaño = {CveTamaño}").Rows(0) If DrCargo IsNot Nothing Then - CargoActual = DrCargo("Cargo").ToString.ToDecimal + CargoVendido = DrCargo("Cargo").ToString.ToDecimal End If End If 'el ajuste no puede ser mayor al precio de lo vendido de nuevo - If (TxtPrecio.Text.ToDouble - ((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior))) < 0 Then - TxtDescuentoAjuste.Text = TxtPrecio.Text + If (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))) < 0 Then + TxtImporteAjuste.Text = "0.00" - CargoAnterior = CargoActual + CargoGarantia = CargoVendido End If + TxtImporteAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoVendido - CargoGarantia).FormatoNumero}." + TxtImporteAjuste.Text = ((TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero - TxtDescuentoAjuste.Text = ((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior)).FormatoNumero - TxtDescuentoAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoActual - CargoAnterior).FormatoNumero}." End If End If ObjAcum.Dispose() @@ -5233,31 +5246,6 @@ Partial Class PV UpAjuste.Update() End Sub - 'Private Function AsignaPUFijo(CvePS As Integer) As Double - ' Select Case CvePS - ' Case 360449 - ' Return 500 - ' Case 360450 - ' Return 1000 - ' Case 360451 - ' Return 2000 - ' Case 360452 - ' Return 3000 - ' Case 360453 - ' Return 4000 - ' Case 360455 - ' Return 5000 - ' Case 365353 - ' Return 6000 - ' Case 360454 - ' Return 1500 'lth. acumulador - ' Case 370810 - ' Return 2500 'lth. 1872 - ' Case Else - ' Return 5000 - ' End Select - 'End Function - Private Sub GuardaAjuste() TxtPrecio.Text = TxtPrecio.Text UpAjuste.Update() @@ -5340,7 +5328,8 @@ Partial Class PV End If End If - Dr("Descuento") = Math.Round((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior), NumeroDecimales) + Dr("Descuento") = Math.Round(TxtImporteAjuste.Text.ToDouble, NumeroDecimales) + 'Dr("Descuento") = Math.Round((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) + (CargoActual - CargoAnterior), NumeroDecimales) If Dr("Descuento").ToString.ToDouble > TxtPrecio.Text.ToDouble Then Dr("Descuento") = TxtPrecio.Text.ToDouble Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (Dr("PU").ToString.ToDecimal)) - Dr("Descuento").ToString.ToDecimal @@ -5747,7 +5736,7 @@ Partial Class PV params.Add(New ReportParameter("PorcentajeAjuste", TxtPorcentajeAjuste.Text.Trim)) 'Informacion Acumulador - params.Add(New ReportParameter("CodEnsamble", If(TxtCodEnsamble.Text.Length > 7, TxtCodEnsamble.Text.Trim.Substring(0, 7), ""))) + params.Add(New ReportParameter("CodEnsamble", TxtCodEnsamble.Text.Trim)) params.Add(New ReportParameter("CodLinea", TxtCodLinea.Text.Trim)) params.Add(New ReportParameter("CodInspeccion", TxtCodInspeccion.Text.Trim)) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 5d74cb4b2..bb8b675bf 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -4217,6 +4217,11 @@ Partial Class Ventas BtnPermisoEditarCotizacion.Visible = True End If + 'SOLO LA PUEDE EDITAR USUATIOACTUAL-VENDEDOR | NO DEBE ESTAR FACTURADA + If UsuarioActual.TienePermisoProceso(281) And TmpDT.SUM("CantidadFacturadaCot") = 0 Then 'And TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") + BtnPermisoEditarCotizacion.Visible = True + End If + 'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR If TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") Then BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True) @@ -4279,10 +4284,21 @@ Partial Class Ventas 'CargaDetalle If ObjVentas.GetVentaDetalle(CveVenta) Then - TmpDT = ObjVentas.DtResultados - TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) - TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) - 'TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal)) + + + For Each dr As DataRow In ObjVentas.DtResultados.Rows + AgregarProductoServicio(dr("Cantidad").ToString.ToDecimal, dr("CveUM").ToString.ToEntero, dr("UM").ToString, dr("CveClasificacion").ToString.ToEntero, dr("Clasificacion").ToString, + dr("CvePS").ToString.ToEntero, dr("PS").ToString, dr("Obs").ToString, dr("PU").ToString.ToDecimal, dr("Descuento").ToString.ToDecimal, + dr("CveProyecto").ToString.ToEntero, dr("Proyecto").ToString, dr("CveSubProyecto").ToString.ToEntero, dr("SubProyecto").ToString, + CveContratoDetalle:=dr("CveContratoDetalle").ToString.ToEntero, CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString.ToEntero, RegeneraIEPS:=False, SeActualiza:=True) + + + Next + + 'TmpDT = ObjVentas.DtResultados + 'TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) + 'TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) + ''TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal)) GvPS.DataSource = ObjVentas.DtResultados GvPS.DataBind() End If @@ -4409,6 +4425,9 @@ Partial Class Ventas Private Sub CargaFormaPago(CveMetodoPago As Integer) 'FACTURACION 3.3 + 'permiso para desbloquear la relación entre Método de pago y forma de pago + If UsuarioActual.TienePermisoProceso(282) Then CveMetodoPago = -1 + Dim dtt As DataTable = Nothing If CveMetodoPago > 0 Then dtt = GlobalDTVtaFormaPago.FiltraParametros(If(CveMetodoPago = 1, " CveFormaPago <> 20 ", "CveFormaPago = 20")) @@ -12907,6 +12926,16 @@ Partial Class Ventas DdlUnidadMedida.DataBind() DdlUnidadMedida.SelectedValueExist(drPS("CveUnidadMedida").ToString) + If drPS("CveTipoPS").ToString = "1" Then 'Si es servicio + If UsuarioActual.Empresa.Funcionalidad(558).ToString = "1" Then 'Si es Empresa llantera + TxtPrecio.Enabled = True + Else + 'TxtPrecio.Enabled = False + End If + Else + TxtPrecio.Enabled = True + End If + If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 Then DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString) CambiaMoneda() @@ -12963,7 +12992,16 @@ Partial Class Ventas End If + Dim PrecioBaseCosto As Decimal = 0 + Dim ObjClasificaciones As New ClsClasificaciones + If ObjClasificaciones.GetClasificaciones() Then + PrecioBaseCosto = ObjClasificaciones.DtResultados.FiltroPrimeroValor("PrecioBaseCosto", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveClasificacion = {drPS("CveClasificacion")}").ToDecimal + End If + If PrecioSugerido > 0 Then + If PrecioBaseCosto > 0 Then + PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1) + End If TxtPrecio.Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere End If