diff --git a/Bancos/RepCortes.aspx.vb b/Bancos/RepCortes.aspx.vb index 7011c1ad2..e47ba73e7 100644 --- a/Bancos/RepCortes.aspx.vb +++ b/Bancos/RepCortes.aspx.vb @@ -63,9 +63,9 @@ Partial Class Bancos_RepCortes Me.Form.DefaultButton = BtnConsultar.UniqueID CargarCentrosDeCosto(Nothing, DdlSubProyectos, Nothing, LblSubProyecto) End If - End Sub - - + End Sub + + #Region " C A R G A - D A T O S " Public Sub CargaDatos() Dim ObjPuntoVenta As New ClsPuntoVenta @@ -87,22 +87,22 @@ Partial Class Bancos_RepCortes e.Row.CssClass = "SubTotales2" End If End If - End Sub + End Sub Protected Sub GvP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvP.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("MetodoPago").ToString = "Total" Then e.Row.CssClass = "SubTotales" End If End If - End Sub - + End Sub + Protected Sub GvD_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvD.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("CveVenta").ToString = "" Then e.Row.CssClass = "Totales" - End If - If e.Row.DBCampo("ImportePagado").ToDecimal() < 0 Then - e.Row.FCLabel("LblTotal").CssClass = "badge badge-danger" + End If + If e.Row.DBCampo("ImportePagado").ToDecimal() < 0 Then + e.Row.FCLabel("LblTotal").CssClass = "badge badge-danger" End If End If End Sub @@ -163,8 +163,8 @@ Partial Class Bancos_RepCortes If DtCortesVentasResumen.Rows.Count > 0 Or DtCortesVentas.Rows.Count > 0 Then HplDownPDF.Visible = True HplDownEXCEL.Visible = True - HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}", CveCorte, "PDF"))) - HplDownEXCEL.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}", CveCorte, "EXCEL"))) + HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}&CVESUBPROYECTO={2}", CveCorte, "PDF", DdlSubProyectos.SelectedValue.ToEntero))) + HplDownEXCEL.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CORT&CVECORTE={0}&FORMATO={1}&CVESUBPROYECTO={2}", CveCorte, "EXCEL", DdlSubProyectos.SelectedValue.ToEntero))) Else HplDownPDF.Visible = False HplDownEXCEL.Visible = False diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 7ab8ce558..70fed873b 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -33,7 +33,7 @@ Partial Class PopUpVerFactura End Property Public Property DtDetalle() As DataTable Get - Return CType(ViewState("DtDetalle"), DataTable) + Return DirectCast(IfNull(ViewState("DtDetalle"), New DataTable, ViewState("DtDetalle")), DataTable) End Get Set(value As DataTable) ViewState("DtDetalle") = value @@ -834,7 +834,11 @@ Partial Class PopUpVerFactura If UrlParametros("OP").ToString = "CORT" Then If UrlParametros("CVECORTE") IsNot Nothing AndAlso UrlParametros("CVECORTE").ToString.ToEntero > 0 Then - ImprimeCorte(UrlParametros("CVECORTE").ToString.ToEntero, UrlParametros("FORMATO").ToString) + Dim CveSubProyecto As Integer = -1 + If UrlParametros("CVESUBPROYECTO") IsNot Nothing Then + CveSubProyecto = UrlParametros("CVESUBPROYECTO").ToString.ToEntero + End If + ImprimeCorte(UrlParametros("CVECORTE").ToString.ToEntero, UrlParametros("FORMATO").ToString, CveSubProyecto) End If End If @@ -980,25 +984,27 @@ Partial Class PopUpVerFactura #Region "OP = CORT - IMPRIMIR CORTE" - Private Sub ImprimeCorte(CveCorte As Integer, Formato As String) + Private Sub ImprimeCorte(CveCorte As Integer, Formato As String, Optional CveSubProyecto As Integer = -1) Dim ObjVenta As New ClsVentas Dim ObjPuntoVenta As New ClsPuntoVenta Dim DtCortesVentasResumen As DataTable = Nothing Dim DtCortesVentas As DataTable = Nothing Dim Fecha = "", Nombre = "" - If ObjVenta.GetCortesDetalleVentasResumen(CveCorte, UsuarioActual.CveEmpresa) Then + If ObjVenta.GetCortesDetalleVentasResumen(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa) Then DtCortesVentasResumen = ObjVenta.DtResultados End If - 'If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, UsuarioActual.CveEmpresa) Then - ' DtCortesVentas = ObjPuntoVenta.DtResultados - ' If DtCortesVentas.Rows.Count > 0 Then - ' Dim RowInfo As DataRow = DtCortesVentas.FiltroPrimero("CveVenta > 0") - ' Fecha = RowInfo("FechaInicial").ToString - ' Nombre = RowInfo("Nombre").ToString - ' End If - 'End If + If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, CveSubProyecto, UsuarioActual.CveEmpresa) Then + DtCortesVentas = ObjPuntoVenta.DtResultados + If DtCortesVentas.Rows.Count > 0 Then + Dim RowInfo As DataRow = DtCortesVentas.FiltroPrimero("CveVenta > 0") + + Fecha = RowInfo("FechaInicial").ToString + Nombre = RowInfo("Nombre").ToString + End If + End If + ObjVenta.Dispose() ObjPuntoVenta.Dispose() Dim FechaCorte As String = $" Fecha fin: {Fecha}" diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index 44944955e..bbb576de3 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -1164,38 +1164,38 @@ Partial Class ContabilidadC_RegPrePolizaS If MsgError = "" Then - 'MENSAJE IE + 'MENSAJE IE - 'If CveIE Then - ' 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 + 'If CveIE Then + ' 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 - Alert(If(MensajeAlert.ToString = "", $"Se registro con exito {If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")}", $"Se registro con exito {If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")}
" & MensajeAlert.ToString), TipoMensaje.MsgInformacion, $"window.location.href=""./RegPrePolizaS.aspx?CvePrePoliza={CvePrePolizaInsertada}""") + Alert(If(MensajeAlert.ToString = "", $"Se registro con exito {If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")}", $"Se registro con exito {If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")}
" & MensajeAlert.ToString), TipoMensaje.MsgInformacion, $"window.location.href=""./RegPrePolizaS.aspx?CvePrePoliza={CvePrePolizaInsertada}""") - ObjIE.Commit() - If Conta IsNot Nothing Then Conta.Commit() + ObjIE.Commit() + If Conta IsNot Nothing Then Conta.Commit() - UPPDocumento.Update() + UPPDocumento.Update() - TxtConcepto.Text = "" - 'GvMov.DataBind() - DdlPlantilla_SelectedIndexChanged(Nothing, Nothing) + TxtConcepto.Text = "" + 'GvMov.DataBind() + DdlPlantilla_SelectedIndexChanged(Nothing, Nothing) - TxtFechaDocumento.Text = "" + TxtFechaDocumento.Text = "" - Else - Alert(MsgError.ToString, ModExtensiones.TipoMensaje.MsgError) - ObjIE.RollBack() - If Conta IsNot Nothing Then Conta.RollBack() - End If - - ObjIE.Dispose() - ObjMov.Dispose() - If Conta IsNot Nothing Then Conta.Dispose() + Else + Alert(MsgError.ToString, ModExtensiones.TipoMensaje.MsgError) + 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() @@ -1297,6 +1297,7 @@ Partial Class ContabilidadC_RegPrePolizaS Dim Cargo As Double = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtCargo").Text.ToDouble Dim Abono As Double = GvPrePoliza.Rows(IndiceGrid).FCLiteral("TxtAbono").Text.ToDouble Dim PorcentajeImpuesto As Double = GvPrePoliza.Rows(IndiceGrid).DataKey("PorcentajeImpuesto").ToEntero + Dim CveClasificacion As Integer = GvPrePoliza.Rows(IndiceGrid).DataKey("CveClasificacion").ToEntero 'CargaConceptosContablesE() 'CargaModalConceptoCuentas() @@ -1338,6 +1339,9 @@ Partial Class ContabilidadC_RegPrePolizaS End If DdlVentasE.SelectedValueExist(CveVenta) + If CveClasificacion > 0 Then + DdlClasificacionesE.SelectedValue = CveClasificacion + End If TxtConceptoE.Text = Concepto TxtReferenciaE.Text = Referencia diff --git a/Ventas/ClientesAbonar.aspx b/Ventas/ClientesAbonar.aspx index 82f7df0c2..f2558f45d 100644 --- a/Ventas/ClientesAbonar.aspx +++ b/Ventas/ClientesAbonar.aspx @@ -176,7 +176,7 @@
- +
@@ -450,9 +450,15 @@ <%--24--%> - + - + + + + <%--24--%> + + + <%--25--%> @@ -948,13 +954,14 @@ }); Total = Total + Anticipos; + $(ClsSelLiqVentaTotal).each(function () { $(this).val(Total); FormatoMoneda2($(this)); }); - - FormatoMoneda(txt); + + //FormatoMoneda(txt); var Suma = SumaValores(pagoMultiple, monedaPago); $get('TxtImporte').value = FormatoNumero(Suma, 2); diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index 6057c02a7..2b6da06bb 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -31,7 +31,7 @@ Partial Class Ventas_ClientesAbonar End Property Private Property CveMonedaFiltro As Integer Get - Return ViewState("CveMonedaFiltro").ToString.ToEntero + Return IfNull(ViewState("CveMonedaFiltro"), "0").ToString.ToEntero End Get Set(value As Integer) ViewState("CveMonedaFiltro") = value @@ -391,7 +391,8 @@ Partial Class Ventas_ClientesAbonar GvCxC.Columns(21).HeaderText = "Aduana
Mex" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol5).FiltroPrimeroValor("Clasificacion").Substring(0, 12) GvCxC.Columns(22).HeaderText = "Diversos" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol6).FiltroPrimeroValor("Clasificacion").Substring(0, 12) GvCxC.Columns(23).HeaderText = "Aduana
USA" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12) - 'GvCxC.Columns(24).HeaderText = "Material
Empaque" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(24).HeaderText = "Material
Empaque" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12) + GvCxC.Columns(25).HeaderText = "Total
Gastos" DvLiquidacion1.Visible = True DvLiquidacion2.Visible = True @@ -549,6 +550,7 @@ Partial Class Ventas_ClientesAbonar e.Row.FCTextBox("TxtLiqCol6").Visible = False e.Row.FCTextBox("TxtLiqCol7").Visible = False e.Row.FCTextBox("TxtLiqCol8").Visible = False + e.Row.FCTextBox("TxtLiqColT").Visible = False e.Row.FCTextBox("TxtAmort").Visible = False e.Row.FCDropDownList("DdlAnti").Visible = False @@ -634,7 +636,8 @@ Partial Class Ventas_ClientesAbonar e.Row.FCTextBox("TxtLiqCol5").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") e.Row.FCTextBox("TxtLiqCol6").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") e.Row.FCTextBox("TxtLiqCol7").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") - e.Row.FCTextBox("TxtLiqCol8").Attributes.Add("class", $"ClsSelLiqVentaTotal{e.Row.DBCampo("CveVenta").ToEntero}") + e.Row.FCTextBox("TxtLiqCol8").Attributes.Add("class", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}") + e.Row.FCTextBox("TxtLiqColT").Attributes.Add("class", $"ClsSelLiqVentaTotal{e.Row.DBCampo("CveVenta")}") e.Row.FCTextBox("TxtAmort").Attributes.Add("class", $"ClsSelLiqAnt") e.Row.FCTextBox("TxtLiqCol1").Attributes.Add("onkeyup", $"SumaLiq (this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") @@ -644,6 +647,7 @@ Partial Class Ventas_ClientesAbonar e.Row.FCTextBox("TxtLiqCol5").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") e.Row.FCTextBox("TxtLiqCol6").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") e.Row.FCTextBox("TxtLiqCol7").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") + e.Row.FCTextBox("TxtLiqCol8").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") e.Row.FCTextBox("TxtAmort").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})") e.Row.FCDropDownList("DdlAnti").DataSource = DtIngresos @@ -930,9 +934,10 @@ Partial Class Ventas_ClientesAbonar Dim EsAnticipoEspecial As Boolean = False If gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119, 158) Then EsAnticipoEspecial = True + Dim FluctuacionAnticipo As Decimal = 0 If dtConceptos IsNot Nothing Then - + FluctuacionAnticipo = 0 ' se limpia la fluctuación por cada factura. For Each Row As DataRow In dtConceptos.Rows Dim ConceptoContable = Row("CveConcepto").ToString.ToEntero @@ -953,7 +958,7 @@ Partial Class Ventas_ClientesAbonar If gvr.DataKey("CveMoneda").ToEntero > 1 Then ConceptoContable = 292 ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal).RoundSQL - ImporteMN = (ImporteMovimiento * tipoCambioVentaValuacion).RoundSQL + ImporteMN = ImporteMovimiento '(ImporteMovimiento * tipoCambioVentaValuacion).RoundSQL TipoCambioGeneral = tipoCambioVentaValuacion CveSubProyectoContabilizar = CveSubProyecto @@ -983,6 +988,94 @@ Partial Class Ventas_ClientesAbonar End If End If + If UsuarioActual.Empresa.Funcionalidad(590) = "1" AndAlso MsgError = "" Then '' si es empresa agrícola + + Dim ImporteLiq1 As Decimal = gvr.FCTextBox("TxtLiqCol1").Text.ToDecimal + Dim ImporteLiq2 As Decimal = gvr.FCTextBox("TxtLiqCol2").Text.ToDecimal + Dim ImporteLiq3 As Decimal = gvr.FCTextBox("TxtLiqCol3").Text.ToDecimal + Dim ImporteLiq4 As Decimal = gvr.FCTextBox("TxtLiqCol4").Text.ToDecimal + Dim ImporteLiq5 As Decimal = gvr.FCTextBox("TxtLiqCol5").Text.ToDecimal + Dim ImporteLiq6 As Decimal = gvr.FCTextBox("TxtLiqCol6").Text.ToDecimal + Dim ImporteLiq7 As Decimal = gvr.FCTextBox("TxtLiqCol7").Text.ToDecimal + Dim ImporteLiq8 As Decimal = gvr.FCTextBox("TxtLiqCol8").Text.ToDecimal + + Dim CveClasificacionCol1 As Integer = 21514 'comisiones sobre venta + Dim CveClasificacionCol2 As Integer = 21916 ' manejo + Dim CveClasificacionCol3 As Integer = 21917 'servicios de inspección + Dim CveClasificacionCol4 As Integer = 21918 ' seguro liquidación + Dim CveClasificacionCol5 As Integer = 21561 ' gastos aduanales mex + Dim CveClasificacionCol6 As Integer = 21920 ' diveros + Dim CveClasificacionCol7 As Integer = 21919 'gastos aduanales usa + Dim CveClasificacionCol8 As Integer = 21211 'material Empaque + + Dim CveSubProyectoLiquidacion As Integer = gvr.DataKey("CveSubProyecto").ToEntero + Dim CveConceptoLiquidacion As Integer = 51 + Dim ConceptoPartida As String = gvr.DataKey("SerieFolio") & " " & gvr.FCDropDownList("DdlTG").SelectedItem.Text + + If ImporteLiq1 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq1, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq1 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol1, ImporteME:=If(CveMoneda > 1, ImporteLiq1, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For + End If + End If + + If ImporteLiq2 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq2, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq2 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol2, ImporteME:=If(CveMoneda > 1, ImporteLiq2, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For + End If + End If + + If ImporteLiq3 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq3, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq3 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol3, ImporteME:=If(CveMoneda > 1, ImporteLiq3, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For + End If + End If + + If ImporteLiq4 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq4, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq4 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol4, ImporteME:=If(CveMoneda > 1, ImporteLiq4, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For + End If + End If + + If ImporteLiq5 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq5, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq5 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol5, ImporteME:=If(CveMoneda > 1, ImporteLiq5, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For + End If + End If + + If ImporteLiq6 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq6, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq6 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol6, ImporteME:=If(CveMoneda > 1, ImporteLiq6, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For + End If + End If + + If ImporteLiq7 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq7, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq7 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol7, ImporteME:=If(CveMoneda > 1, ImporteLiq7, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" : Exit For + End If + End If + + If ImporteLiq8 <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq8, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq8 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol8, ImporteME:=If(CveMoneda > 1, ImporteLiq8, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then + MsgError = "No se pudo insertar la póliza" + Exit For + End If + End If + + If gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero > 0 Then + Dim TCP As Decimal = 0 + If DtIngresos IsNot Nothing Then + TCP = DtIngresos.FiltroPrimeroValor("TipoCambio", String.Format("CveIE={0}", gvr.FCDropDownList("DdlAnti").SelectedValue)) + End If + 'se calcula la fluctuación de la aplicación del anticipo, para sumarla en el concepto de fluctuación más abajo + FluctuacionAnticipo = ((TCP - tipoCambioVenta) * gvr.FCTextBox("TxtAmort").Text.ToDecimal).RoundSQL + MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort").Text.ToDecimal, TCP, tipoCambioVenta) + End If + + + End If + + + Case 8 'Ret IVA x Trasladar If EsAnticipoEspecial Then Exit Select If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then @@ -1193,6 +1286,10 @@ Partial Class Ventas_ClientesAbonar tImportePago = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) * tipoCambioPago).RoundSQL End If + 'If FluctuacionAnticipo <> 0 Then + ' tImportePago += FluctuacionAnticipo + 'End If + If tImporteVenta <> tImportePago Then If tImporteVenta < tImportePago Then ConceptoContable = 64 @@ -1206,6 +1303,7 @@ Partial Class Ventas_ClientesAbonar ' CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria End If Diferencia = tImporteVenta - tImportePago + End If ' si tiene funcionalidad para que tome el TC de pago, que solo afecta a los impuestos @@ -1292,89 +1390,7 @@ Partial Class Ventas_ClientesAbonar Next - If UsuarioActual.Empresa.Funcionalidad(590) = "1" AndAlso MsgError = "" Then '' si es empresa agrícola - Dim ImporteLiq1 As Decimal = gvr.FCTextBox("TxtLiqCol1").Text.ToDecimal - Dim ImporteLiq2 As Decimal = gvr.FCTextBox("TxtLiqCol2").Text.ToDecimal - Dim ImporteLiq3 As Decimal = gvr.FCTextBox("TxtLiqCol3").Text.ToDecimal - Dim ImporteLiq4 As Decimal = gvr.FCTextBox("TxtLiqCol4").Text.ToDecimal - Dim ImporteLiq5 As Decimal = gvr.FCTextBox("TxtLiqCol5").Text.ToDecimal - Dim ImporteLiq6 As Decimal = gvr.FCTextBox("TxtLiqCol6").Text.ToDecimal - Dim ImporteLiq7 As Decimal = gvr.FCTextBox("TxtLiqCol7").Text.ToDecimal - Dim ImporteLiq8 As Decimal = gvr.FCTextBox("TxtLiqCol8").Text.ToDecimal - - Dim CveClasificacionCol1 As Integer = 21514 'comisiones sobre venta - Dim CveClasificacionCol2 As Integer = 21916 ' manejo - Dim CveClasificacionCol3 As Integer = 21917 'servicios de inspección - Dim CveClasificacionCol4 As Integer = 21918 ' seguro liquidación - Dim CveClasificacionCol5 As Integer = 21561 ' gastos aduanales mex - Dim CveClasificacionCol6 As Integer = 21920 ' diveros - Dim CveClasificacionCol7 As Integer = 21919 'gastos aduanales usa - Dim CveClasificacionCol8 As Integer = 21211 'material Empaque - - Dim CveSubProyectoLiquidacion As Integer = gvr.DataKey("CveSubProyecto").ToEntero - Dim CveConceptoLiquidacion As Integer = 51 - Dim ConceptoPartida As String = gvr.DataKey("SerieFolio") & " " & gvr.FCDropDownList("DdlTG").SelectedItem.Text - - If ImporteLiq1 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq1, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq1 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol1, ImporteME:=If(CveMoneda > 1, ImporteLiq1, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" : Exit For - End If - End If - - If ImporteLiq2 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq2, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq2 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol2, ImporteME:=If(CveMoneda > 1, ImporteLiq2, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" : Exit For - End If - End If - - If ImporteLiq3 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq3, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq3 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol3, ImporteME:=If(CveMoneda > 1, ImporteLiq3, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" : Exit For - End If - End If - - If ImporteLiq4 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq4, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq4 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol4, ImporteME:=If(CveMoneda > 1, ImporteLiq4, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" : Exit For - End If - End If - - If ImporteLiq5 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq5, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq5 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol5, ImporteME:=If(CveMoneda > 1, ImporteLiq5, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" : Exit For - End If - End If - - If ImporteLiq6 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq6, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq6 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol6, ImporteME:=If(CveMoneda > 1, ImporteLiq6, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" : Exit For - End If - End If - - If ImporteLiq7 <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq7, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq7 * tipoCambioPago, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol7, ImporteME:=If(CveMoneda > 1, ImporteLiq7, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - MsgError = "No se pudo insertar la póliza" : Exit For - End If - End If - - 'If ImporteLiq8 <> 0 Then - ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq8, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq8 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol8, ImporteME:=If(CveMoneda > 1, ImporteLiq8, 0), CveTipoGasto:=gvr.FCDropDownList("DdlTG").SelectedValue.ToEntero) Then - ' MsgError = "No se pudo insertar la póliza" - ' Exit For - ' End If - 'End If - - If gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero > 0 Then - Dim TCP As Decimal = 0 - If DtIngresos IsNot Nothing Then - TCP = DtIngresos.FiltroPrimeroValor("TipoCambio", String.Format("CveIE={0}", gvr.FCDropDownList("DdlAnti").SelectedValue)) - End If - MsgError = RegistraAmortizacionAnticipo(ObjMov, CvePrePoliza, gvr.FCDropDownList("DdlAnti").SelectedValue.ToEntero, gvr.FCTextBox("TxtAmort").Text.ToDecimal, TCP, tipoCambioVenta) - End If - - - End If If gvr.FCCheckBox("ChkGenerarNC").Checked AndAlso ObjFactura IsNot Nothing Then ObjFactura.DescuentoProntoPago = gvr.DataKey("DescuentoProntoPago").ToDecimal() ListaFacturasGenerarNC.Add(ObjFactura) @@ -1424,7 +1440,7 @@ Partial Class Ventas_ClientesAbonar End If If CveMoneda > 1 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtAnticipo.Text.ToDecimal, TxtFolio.Text, 226, TxtObservaciones.Text, Now, -1, -1, CveIE, -1, -1, CveSubProyecto, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(TxtAnticipo.Text.ToDecimal * tipoCambioPago).RoundSQL, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=0, ImporteME:=If(CveMoneda > 1, TxtAnticipo.Text.ToDecimal, 0)) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtAnticipo.Text.ToDecimal, TxtFolio.Text, 226, TxtObservaciones.Text, Now, -1, -1, CveIE, -1, -1, CveSubProyecto, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=((TxtAnticipo.Text.ToDecimal * tipoCambioPago) - TxtAnticipo.Text.ToDecimal).RoundSQL, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=0, ImporteME:=If(CveMoneda > 1, TxtAnticipo.Text.ToDecimal, 0)) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -1686,17 +1702,7 @@ Partial Class Ventas_ClientesAbonar If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, If(CveMoneda = 1 AndAlso TxtTC.Visible, Importe / TxtTC.Text.ToDecimal, Importe), TxtObservaciones.Text, 227, TxtObservaciones.Text + If(TxtTC.Visible, $" TC:{TxtTC.Text}", If(CveMoneda = 2, $" TC:{tipoCambioVenta}", "")), TxtFechaDocumento.Text, IdCtaContMonedaComplementariaAnticipo, -1, CveIE, -1, -1, -1, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, (Importe * tipoCambioPago) - Importe, Importe), ImporteME:=If(CveMoneda = 2, Importe, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then MsgError = "No se pudo insertar la póliza" End If - 'Else - ' If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES - ' tipoCambioPago = TxtTCDolares.Text.ToDecimal - ' ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then - ' tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal - ' End If - ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe, TxtObservaciones.Text, 92, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCtaContMonedaExtranjeraAnticipo, -1, CveIE, -1, -1, -1, CveCliente, ImporteMX:=If(CveMoneda = 2, Importe * tipoCambioPago, Importe), ImporteME:=If(CveMoneda = 2, Importe, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then - ' MsgError = "No se pudo insertar la póliza" - ' End If - 'End If Else If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES tipoCambioPago = TxtTCDolares.Text.ToDecimal @@ -2885,10 +2891,11 @@ Partial Class Ventas_ClientesAbonar GvCxC.Columns(22).Visible = True GvCxC.Columns(23).Visible = True GvCxC.Columns(24).Visible = True - GvCxC.Columns(25).Visible = True 'anticipos + GvCxC.Columns(25).Visible = True + GvCxC.Columns(26).Visible = True 'anticipos - GvCxC.Columns(26).Visible = False GvCxC.Columns(27).Visible = False + GvCxC.Columns(28).Visible = False Else @@ -2907,9 +2914,10 @@ Partial Class Ventas_ClientesAbonar GvCxC.Columns(23).Visible = False GvCxC.Columns(24).Visible = False GvCxC.Columns(25).Visible = False + GvCxC.Columns(26).Visible = False - GvCxC.Columns(26).Visible = True GvCxC.Columns(27).Visible = True + GvCxC.Columns(28).Visible = True End If