Merge branch 'master' of http://jperez@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -462,19 +462,25 @@
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--25--%>
|
||||
<asp:TemplateField Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtLiqCol9" Width="55px" runat="server" Style="text-align: right;"></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--26--%>
|
||||
<asp:TemplateField Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtLiqColT" Width="55px" runat="server" Font-Bold="true" Style="text-align: right;" onkeypress="return disablekeys();"></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--26--%>
|
||||
<%--27--%>
|
||||
<asp:TemplateField Visible="false" HeaderText="Anticipo" ItemStyle-Width="120px">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtAmort" Width="50px" runat="server" Style="text-align: right;" ></asp:TextBox>
|
||||
<asp:DropDownList ID="DdlAnti" runat="server" Width="40px" DataTextField="RazonSocial" DataValueField="CveIE"></asp:DropDownList>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--27--%>
|
||||
<%--28--%>
|
||||
<asp:TemplateField Visible="false" HeaderText="Anticipo2" ItemStyle-Width="120px">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtAmort2" Width="50px" runat="server" Style="text-align: right;" ></asp:TextBox>
|
||||
@@ -482,7 +488,7 @@
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<%--28--%>
|
||||
<%--29--%>
|
||||
<asp:TemplateField >
|
||||
<HeaderTemplate>Auxiliar</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
@@ -490,7 +496,7 @@
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<%--29--%>
|
||||
<%--30--%>
|
||||
<asp:TemplateField >
|
||||
<HeaderTemplate>Comp<br> Pago</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
|
||||
@@ -391,7 +391,8 @@ Partial Class Ventas_ClientesAbonar
|
||||
GvCxC.Columns(22).HeaderText = "Diversos" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol6).FiltroPrimeroValor("Clasificacion").Substring(0, 12)
|
||||
GvCxC.Columns(23).HeaderText = "Aduana<br/>USA" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12)
|
||||
GvCxC.Columns(24).HeaderText = "Material<br/>Empaque" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12)
|
||||
GvCxC.Columns(25).HeaderText = "Total<br/>Gastos"
|
||||
GvCxC.Columns(25).HeaderText = "Semilla" 'GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionCol7).FiltroPrimeroValor("Clasificacion").Substring(0, 12)
|
||||
GvCxC.Columns(26).HeaderText = "Total<br/>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("TxtLiqCol9").Visible = False
|
||||
e.Row.FCTextBox("TxtLiqColT").Visible = False
|
||||
e.Row.FCTextBox("TxtAmort").Visible = False
|
||||
e.Row.FCTextBox("TxtAmort2").Visible = False
|
||||
@@ -638,6 +640,8 @@ Partial Class Ventas_ClientesAbonar
|
||||
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", $"ClsSelLiq ClsSelLiqVenta{e.Row.DBCampo("CveVenta")}")
|
||||
e.Row.FCTextBox("TxtLiqCol9").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("TxtAmort2").Attributes.Add("class", $"ClsSelLiqAnt")
|
||||
@@ -650,6 +654,7 @@ Partial Class Ventas_ClientesAbonar
|
||||
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("TxtLiqCol9").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.FCTextBox("TxtAmort2").Attributes.Add("onkeyup", $"SumaLiq(this,{e.Row.DBCampo("CveVenta")},{CveMonedaFiltro},{ moneda})")
|
||||
|
||||
@@ -1005,6 +1010,7 @@ Partial Class Ventas_ClientesAbonar
|
||||
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 ImporteLiq9 As Decimal = gvr.FCTextBox("TxtLiqCol9").Text.ToDecimal
|
||||
|
||||
Dim CveClasificacionCol1 As Integer = 21514 'comisiones sobre venta
|
||||
Dim CveClasificacionCol2 As Integer = 21916 ' manejo
|
||||
@@ -1014,6 +1020,7 @@ Partial Class Ventas_ClientesAbonar
|
||||
Dim CveClasificacionCol6 As Integer = 21920 ' diveros
|
||||
Dim CveClasificacionCol7 As Integer = 21919 'gastos aduanales usa
|
||||
Dim CveClasificacionCol8 As Integer = 21211 'material Empaque
|
||||
Dim CveClasificacionCol9 As Integer = 21207 'Semilla
|
||||
|
||||
Dim CveSubProyectoLiquidacion As Integer = gvr.DataKey("CveSubProyecto").ToEntero
|
||||
Dim CveConceptoLiquidacion As Integer = 51
|
||||
@@ -1068,6 +1075,13 @@ Partial Class Ventas_ClientesAbonar
|
||||
End If
|
||||
End If
|
||||
|
||||
If ImporteLiq9 <> 0 Then
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, ImporteLiq9, gvr.DataKey("SerieFolio"), CveConceptoLiquidacion, ConceptoPartida, Now, -1, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyectoLiquidacion, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteLiq9 * tipoCambioPago, TipoCambio:=TipoCambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=0, CveClasificacion:=CveClasificacionCol9, ImporteME:=If(CveMoneda > 1, ImporteLiq9, 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
|
||||
Dim FolioPago As String = " "
|
||||
@@ -2900,11 +2914,12 @@ Partial Class Ventas_ClientesAbonar
|
||||
GvCxC.Columns(23).Visible = True
|
||||
GvCxC.Columns(24).Visible = True
|
||||
GvCxC.Columns(25).Visible = True
|
||||
GvCxC.Columns(26).Visible = True 'anticipos
|
||||
GvCxC.Columns(27).Visible = True 'anticipos2
|
||||
GvCxC.Columns(26).Visible = True
|
||||
GvCxC.Columns(27).Visible = True 'anticipos
|
||||
GvCxC.Columns(28).Visible = True 'anticipos2
|
||||
|
||||
GvCxC.Columns(28).Visible = False
|
||||
GvCxC.Columns(29).Visible = False
|
||||
GvCxC.Columns(30).Visible = False
|
||||
|
||||
|
||||
Else
|
||||
@@ -2924,11 +2939,12 @@ Partial Class Ventas_ClientesAbonar
|
||||
GvCxC.Columns(23).Visible = False
|
||||
GvCxC.Columns(24).Visible = False
|
||||
GvCxC.Columns(25).Visible = False
|
||||
GvCxC.Columns(26).Visible = False 'anticipos
|
||||
GvCxC.Columns(27).Visible = False 'anticipos2
|
||||
GvCxC.Columns(26).Visible = False
|
||||
GvCxC.Columns(27).Visible = False 'anticipos
|
||||
GvCxC.Columns(28).Visible = False 'anticipos2
|
||||
|
||||
GvCxC.Columns(28).Visible = True
|
||||
GvCxC.Columns(29).Visible = True
|
||||
GvCxC.Columns(30).Visible = True
|
||||
|
||||
End If
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
}
|
||||
|
||||
ObjVentas.Dispose();
|
||||
GvDatos.DataSource = DtVentas.FiltraParametros("(CveEstatusFactura = 20 AND CveEstatusRefacturacion IN (0,4))");
|
||||
GvDatos.DataSource = DtVentas.FiltraParametros("(CveEstatusFactura IN (20,23) AND CveEstatusRefacturacion IN (0,4))");
|
||||
|
||||
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3) OR (CveEstatusFactura = 20 AND CveEstatusRefacturacion IN (1,2,3)) OR CveEstatusFactura = 23");
|
||||
var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3) OR (CveEstatusFactura IN (20,23) AND CveEstatusRefacturacion IN (1,2,3))");
|
||||
if (DtRefacturar != null && DtRefacturar.Rows.Count > 0)
|
||||
{
|
||||
DivRefacturar.Visible = true;
|
||||
@@ -595,15 +595,10 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
|
||||
//
|
||||
|
||||
//if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 1 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23)
|
||||
//{
|
||||
// e.Row.FCLinkButton("LnkValidarRefac").Visible = false;
|
||||
//}
|
||||
|
||||
if (e.Row.DBCampo("CveEstatusFactura").ToEntero() == 23)
|
||||
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 1 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23)
|
||||
{
|
||||
e.Row.FCLinkButton("LnkValidarRefac").Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.Row.DBCampo("PuedeRefacturar") == "0" && e.Row.DBCampo("CveEstatusFactura") == "23" && e.Row.DBCampo("CveVentaSustitucion").ToEntero() > 0)
|
||||
{
|
||||
|
||||
@@ -957,7 +957,7 @@ Partial Class Ventas_RepVentas
|
||||
ObjVentas.Dispose()
|
||||
|
||||
|
||||
DTDataos.ExportToExcel("RepCartasPorte.xls")
|
||||
DTDataos.ExportToExcel("RepCartasPorte")
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -1388,6 +1388,15 @@ Partial Class Ventas
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property VentaActual As Venta
|
||||
Get
|
||||
Return DirectCast(ViewState("VentaActual"), Venta)
|
||||
End Get
|
||||
Set(value As Venta)
|
||||
ViewState("VentaActual") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property ListaAnticiposAplicados As List(Of MAnticipoRelacionado)
|
||||
Get
|
||||
Return If(IsNothing(ViewState("ListaAnticiposAplicados")), Nothing, CType(ViewState("ListaAnticiposAplicados"), List(Of MAnticipoRelacionado)))
|
||||
@@ -5055,6 +5064,30 @@ Partial Class Ventas
|
||||
TxtPedidoContrato.Enabled = False
|
||||
TxtKilometraje.Text = DbRowVenta("Kilometraje").ToString().PadLeft(6, "0"c)
|
||||
|
||||
|
||||
VentaActual = New Venta
|
||||
VentaActual.CveVenta = CveVenta
|
||||
VentaActual.CveCliente = DbRowVenta("CveCliente").ToString.ToEntero
|
||||
VentaActual.CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero
|
||||
VentaActual.SerieFolio = DbRowVenta("SerieFolio").ToString
|
||||
VentaActual.ClienteNombre = DbRowVenta("ClienteNombre").ToString
|
||||
VentaActual.TC = DbRowVenta("TipoCambio").ToString.ToDecimal
|
||||
VentaActual.Total = DbRowVenta("Total").ToString.ToDecimal
|
||||
VentaActual.IVA = DbRowVenta("IVA").ToString.ToDecimal
|
||||
VentaActual.IEPS = DbRowVenta("IEPS").ToString.ToDecimal
|
||||
VentaActual.RetIVA = DbRowVenta("RetIVA").ToString.ToDecimal
|
||||
VentaActual.RetISR = DbRowVenta("RetISR").ToString.ToDecimal
|
||||
|
||||
VentaActual.PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString.ToDecimal
|
||||
VentaActual.UsuarioActual = UsuarioActual
|
||||
VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero
|
||||
VentaActual.IdCtaContableCliente = IIf(VentaActual.CveMoneda = 1, ViewState("IdCtaContClientes"), ViewState("IdCtaContMonedaExtranjera")).ToString.ToEntero
|
||||
VentaActual.IdCtaContableClienteComplementaria = ViewState("IdCtaContComplementaria").ToString.ToEntero
|
||||
|
||||
VentaActual.IdCtaContableClienteAnticipo = ViewState("IdCtaContAnticipos").ToString.ToEntero
|
||||
VentaActual.IdCtaContableClienteAnticipoExtranjera = ViewState("IdCtaContAnticiposExtranjera").ToString.ToEntero
|
||||
VentaActual.IdCtaContableClienteAnticipoComplementaria = ViewState("IdCtaContAnticiposComplementaria").ToString.ToEntero
|
||||
|
||||
HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString()
|
||||
HdnSubTotalDescuestos.Value = (TxtSubTotal.Text.Replace(",", "").ToDouble - LblDescuentos.Text.Replace(",", "").ToDouble - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble - TxtRetISR.Text.Replace(",", "").ToDouble).FormatoNumero(2)
|
||||
'DdlAmortizacionConceptos.SelectedValue = DbRowVenta("AnticipoPosicion").ToString()
|
||||
@@ -15521,14 +15554,14 @@ Partial Class Ventas
|
||||
Dim ErrorConta As Boolean
|
||||
Dim CveIEAnticipo As Integer
|
||||
Dim CvePlantillaPoliza As Integer = 10
|
||||
Dim PorcentajeAmortizacion As Decimal
|
||||
Dim sumaAmorticaciones As Decimal = 0
|
||||
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
|
||||
Dim CveCuentaContabilizacion As Integer = 1
|
||||
'Dim PorcentajeAmortizacion As Decimal
|
||||
'Dim sumaAmorticaciones As Decimal = 0
|
||||
'Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
|
||||
'Dim CveCuentaContabilizacion As Integer = 1
|
||||
Dim CuentasContablesInvalidas As New StringBuilder
|
||||
Dim ContaIdPoliza As Integer = 0
|
||||
Dim ConceptoAmortizacion As Integer = 0
|
||||
Dim UsaComplementariaClientes As Boolean = True
|
||||
'Dim ConceptoAmortizacion As Integer = 0
|
||||
'Dim UsaComplementariaClientes As Boolean = True
|
||||
Dim SimplificaPrePoliza As Boolean = True
|
||||
|
||||
''[IPP] PARCHE TEMPORAL PARA ANTICIPOS DE JAM
|
||||
@@ -15557,11 +15590,6 @@ Partial Class Ventas
|
||||
|
||||
Dim Importe91 As Decimal = 0
|
||||
|
||||
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then
|
||||
Dim Dr As DataRow = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).FiltroPrimero("")
|
||||
IdCtaIVAXTrasladar = Dr("IdCtaIVAXTrasladar").ToString().ToEntero()
|
||||
IdCtaIVATrasladado = Dr("IdCtaIVATrasladado").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
For Each gvr As GridViewRow In GVAnticipos.Rows
|
||||
If gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked Then
|
||||
@@ -15582,7 +15610,6 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN PESOS
|
||||
tipoCambioPago = 1
|
||||
tipoCambioVenta = 1
|
||||
@@ -15605,440 +15632,166 @@ Partial Class Ventas
|
||||
PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal
|
||||
End If
|
||||
|
||||
If dtConceptos IsNot Nothing Then
|
||||
For Each Row As DataRow In dtConceptos.Rows
|
||||
Dim importeMovimiento As Decimal = 0
|
||||
Dim importeMN As Decimal = 0
|
||||
Dim TC As Decimal
|
||||
Dim IdCtaContable As Integer
|
||||
Dim TipoMovimiento As Boolean = True
|
||||
Dim Concepto As String = VentaActual.SerieFolio
|
||||
Dim Referencia As String = VentaActual.SerieFolio
|
||||
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
|
||||
|
||||
Dim ConceptoContable = Row("CveConcepto").ToString().ToEntero()
|
||||
Dim TipoMovimiento As Boolean = If(Row("TipoMovto").ToString() = "True", True, False)
|
||||
Dim importeMovimiento As Decimal = 0
|
||||
Dim importeMX As Decimal = 0
|
||||
Dim IdCtaContable As Integer = 0
|
||||
Dim FechaMovimiento As Date = Now
|
||||
Dim Concepto As String = ViewState("VentaFolio").ToString()
|
||||
Dim Referencia As String = ViewState("VentaFolio").ToString()
|
||||
Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False)
|
||||
Dim TipoCambioGeneral As Decimal = 1
|
||||
Dim PorcentajeImpuesto As Decimal = 0
|
||||
|
||||
Select Case ConceptoContable
|
||||
Case 2 'Cliente
|
||||
'If CveMonedaVenta > 1 Then ConceptoContable = 292
|
||||
If Not (gvr.DataKey("CveIE").ToString().ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66) Then
|
||||
If DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMX = importeMovimiento
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMX = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioVentaValuacion
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMX = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioVentaValuacion
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMX = importeMovimiento
|
||||
End If
|
||||
importeMovimiento = importeMovimiento.RoundSQL
|
||||
importeMX = importeMX.RoundSQL
|
||||
TipoCambioGeneral = tipoCambioVentaValuacion
|
||||
|
||||
If CveMonedaVenta = 1 Then
|
||||
IdCtaContable = IdCtaContClientes
|
||||
'CveCuenta = CveCuentaClientes
|
||||
Else
|
||||
IdCtaContable = IdCtaContComplementaria
|
||||
If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsaComplementariaClientes) Then
|
||||
'Conta ContPAQ
|
||||
If IdCtaContable <= 0 Then
|
||||
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString())
|
||||
idCuentaContabilizacion = 0
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, TipoCambio:=tipoCambioVentaValuacion, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
|
||||
importeMX = importeMovimiento
|
||||
IdCtaContable = IdCtaContMonedaExtranjera
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
|
||||
ConceptoContable = 251 ' cambia para dejar el concepto 2, solamente para pago en banco
|
||||
|
||||
End If
|
||||
Case 11 'Anticipo
|
||||
If gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then
|
||||
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
|
||||
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
|
||||
'Mantenemos la integridad de la suma para el pagocliente
|
||||
'SumaAnticipos += row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal
|
||||
'sumaAmorticaciones += row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal
|
||||
TipoCambioGeneral = tipoCambioPago
|
||||
IdCtaContable = IdCtaContAnticipos
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
|
||||
'Conta ContPAQ
|
||||
If IdCtaContable <= 0 Then
|
||||
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString())
|
||||
idCuentaContabilizacion = 0
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambioPago, ImporteME:=If(tipoCambioPago = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
End If
|
||||
|
||||
' PorcentajeAmortizacion = SumaAnticipos / TxtTotal.Text.ToDecimal
|
||||
'Los Anticipos solo ocupan los ivas por trasladar
|
||||
If PorcentajePago > 0 Then
|
||||
Dim Importe13 = gvr.DataKey("IVA").ToDecimal
|
||||
Dim Importe8 = gvr.DataKey("RetIVA").ToDecimal
|
||||
Dim Importe9 = gvr.DataKey("RetISR").ToDecimal
|
||||
If Not AgregarPrePolizasXTrasladar(ObjConta, CvePrePoliza, PorcentajePago, tipoCambioPago, CuentasContablesInvalidas, idCuentaContabilizacion, CveCuentaContabilizacion, Importe13, Importe8, Importe9) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
importeMovimiento = 0
|
||||
Case 91 'Amortizacion Nota de Credito
|
||||
Dim TC As Decimal = 1
|
||||
If gvr.DataKey("CveConceptoContable").ToEntero() = 12 Then
|
||||
If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMX = importeMovimiento
|
||||
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
|
||||
ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMX = importeMovimiento * gvr.DataKey("TipoCambio").ToString().ToDecimal
|
||||
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
|
||||
ElseIf CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMX = importeMovimiento * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
|
||||
TC = TipoCambioFluctuacion
|
||||
ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMX = importeMovimiento
|
||||
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
|
||||
End If
|
||||
importeMovimiento = importeMovimiento.RoundSQL
|
||||
importeMX = importeMX.RoundSQL
|
||||
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjConta.GetRetCuenta(ConceptoContable, CveCliente) Then
|
||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString().ToEntero()
|
||||
End If
|
||||
End If
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
'Conta ContPAQ
|
||||
If IdCtaContable <= 0 Then
|
||||
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString())
|
||||
idCuentaContabilizacion = 0
|
||||
End If
|
||||
|
||||
Dim ImporteComplementaria As Decimal = 0
|
||||
If UsaComplementariaClientes = True AndAlso gvr.DataKey("CveMoneda").ToString().ToDecimal > 1 Then
|
||||
IdCtaContable = IdCtaContComplementaria
|
||||
importeMX = importeMovimiento
|
||||
ImporteComplementaria = ((importeMovimiento * TC) - importeMovimiento).RoundSQL
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMovimiento, Concepto, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=ImporteComplementaria, ImporteME:=If(gvr.DataKey("TipoCambio").ToString().ToDecimal = 1, 0, importeMovimiento), TipoCambio:=TC, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
Exit For
|
||||
End If
|
||||
IdCtaContable = IdCtaContMonedaExtranjera
|
||||
End If
|
||||
|
||||
If CveMonedaVenta > 1 AndAlso IdCtaContMonedaExtranjera > 0 Then
|
||||
IdCtaContable = IdCtaContMonedaExtranjera
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMX, TipoCambio:=TC, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'AMORTIZA NC CONTRA ANTICIPO A CLIENTES
|
||||
If Not ErrorConta And DdlTipoComprobante.SelectedValue = "Ant" Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal) * gvr.DataKey("IVA").ToDecimal)
|
||||
If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importeMovimiento, Concepto, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=gvr.DataKey("CveVenta").ToString().ToEntero(), ImporteMX:=importeMovimiento) Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importeMovimiento, Concepto, 4, Concepto, FechaMovimiento, gvr.DataKey("IdCtaContableNC").ToEntero(), -1, CveClasificacion:=gvr.DataKey("CveClasificacionNC").ToEntero(), CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMovimiento * TC, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
ErrorConta = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Importe91 = importeMovimiento
|
||||
importeMovimiento = 0
|
||||
Case 92 'Amortizacion Ingreso X Comprobar
|
||||
If gvr.DataKey("CveIE").ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToEntero() = 66 Then
|
||||
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
IdCtaContable = IdCtaContClientes
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
' Agregamos el 2
|
||||
If tipoCambioPago = 1 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContClientes, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
Else 'Cuando son dolares
|
||||
If importeMovimiento <> 0 Then
|
||||
If IdCtaContComplementaria > 0 Or 0 > 0 Then
|
||||
'Agregamos la Complementaria
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContComplementaria, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
'Agregamos la Extranjera
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
Else
|
||||
'Agregamos la Extranjera
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
importeMovimiento = ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / TxtTotal.Text.ToDecimal) * TxtIVA.Text.ToDecimal)
|
||||
importeMX = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
|
||||
|
||||
If importeMX <> 0 Then
|
||||
|
||||
|
||||
'Agregamos el 13
|
||||
|
||||
IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, 13, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
|
||||
'Agregamos el 61
|
||||
|
||||
IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
End If
|
||||
|
||||
'IEPS
|
||||
importeMovimiento = ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / TxtTotal.Text.ToDecimal) * TxtIEPS.Text.ToDecimal)
|
||||
importeMX = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
|
||||
|
||||
If importeMX <> 0 Then
|
||||
|
||||
'Agregamos el 38
|
||||
|
||||
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, 38, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
|
||||
'Agregamos el 39
|
||||
|
||||
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'Agregamos el 92
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal 'gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo" & gvr.RowIndex).ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
|
||||
importeMX = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
|
||||
IdCtaContable = IdCtaContAnticipos
|
||||
|
||||
If ObjCliente.GetClientes(gvr.DataKey("CveCliente").ToEntero(), "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
If Not tipoCambioPago = 1 Then
|
||||
IdCtaContable = ObjCliente.IdCtaMonedaExtranjeraAnticipos
|
||||
Else
|
||||
IdCtaContable = ObjCliente.IdCtaContAnticipos
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(119) Then
|
||||
If gvr.DataKey("Fecha").ToDate.Year <= 2017 AndAlso TxtFechaAnticipoCliente.Text.ToDate.Year >= 2018 Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
If Not tipoCambioPago = 1 Then
|
||||
IdCtaContable = ObjCliente.IdCtaContMonedaExtranjera
|
||||
Else
|
||||
IdCtaContable = ObjCliente.IdCtaContClientes
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=-1, TipoCambio:=tipoCambioPago, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
importeMovimiento = 0
|
||||
Case 64 'Ganancia
|
||||
If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero() <> 1 Then
|
||||
IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria
|
||||
|
||||
If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 2 Then
|
||||
|
||||
If tipoCambioVentaValuacion > tipoCambioPago AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
|
||||
importeMovimiento = Importe91 * (tipoCambioVentaValuacion - tipoCambioPago) 'Añadimos la diferencia de ganancia en la venta
|
||||
importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2))
|
||||
importeMX = importeMovimiento
|
||||
End If
|
||||
|
||||
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioVentaValuacion, tipoCambioPago)
|
||||
TipoCambioGeneral = TCImpuestos
|
||||
Else
|
||||
Dim TipoCambioGanancia As Decimal = If(Not (gvr.DataKey("CveIE").ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66), tipoCambioVentaValuacion, tipoCambioVenta)
|
||||
|
||||
If tipoCambioPago > TipoCambioGanancia AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
|
||||
importeMovimiento = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioPago) - (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * TipoCambioGanancia) 'Añadimos la diferencia de ganancia en la venta
|
||||
importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2))
|
||||
importeMX = importeMovimiento
|
||||
End If
|
||||
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioGanancia, tipoCambioPago)
|
||||
TipoCambioGeneral = TCImpuestos
|
||||
End If
|
||||
|
||||
Else
|
||||
importeMovimiento = 0
|
||||
End If
|
||||
Case 65 'Perdida
|
||||
If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero() <> 1 Then
|
||||
IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria
|
||||
|
||||
If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 2 Then
|
||||
If tipoCambioVentaValuacion < tipoCambioPago AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
|
||||
importeMovimiento = Importe91 * Math.Abs(tipoCambioVentaValuacion - tipoCambioPago) 'Añadimos la diferencia de ganancia en la venta
|
||||
importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2))
|
||||
importeMX = importeMovimiento
|
||||
End If
|
||||
|
||||
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioVentaValuacion, tipoCambioPago)
|
||||
TipoCambioGeneral = TCImpuestos
|
||||
Else
|
||||
Dim TipoCambioPerdida As Decimal = If(Not (gvr.DataKey("CveIE").ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66), tipoCambioVentaValuacion, tipoCambioVenta)
|
||||
|
||||
If tipoCambioPago < TipoCambioPerdida AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then
|
||||
importeMovimiento = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * TipoCambioPerdida) - (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta
|
||||
importeMovimiento = Math.Abs(Math.Round(importeMovimiento, 2))
|
||||
importeMX = importeMovimiento
|
||||
End If
|
||||
|
||||
Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPerdida, tipoCambioPago)
|
||||
TipoCambioGeneral = TCImpuestos
|
||||
End If
|
||||
|
||||
Else
|
||||
importeMovimiento = 0
|
||||
End If
|
||||
Case 13 ' IVA x Trasladar
|
||||
If gvr.DataKey("RegresarImpuesto") = "1" Then
|
||||
''gvr.DataKey("DevolucionImportePagado"), de aqui se toma que % de pago tenia la DEV
|
||||
|
||||
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal
|
||||
PorcentajeImpuesto = TmpDT.MAX("PorcentajeIVA").ToDecimal '(importeMovimiento / TxtTotal.Text.ToDecimal()) 'falta TC
|
||||
|
||||
importeMovimiento = (TxtIVA.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL
|
||||
importeMX = importeMovimiento
|
||||
IdCtaContable = IdCtaIVAXTrasladar
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, VentaFolio, "")
|
||||
'If importeMovimiento <> 0 Then
|
||||
' IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
|
||||
'End If
|
||||
Else
|
||||
importeMovimiento = 0
|
||||
PorcentajeImpuesto = 0
|
||||
End If
|
||||
|
||||
Case 61 ' IVA Trasladado
|
||||
If gvr.DataKey("RegresarImpuesto") = "1" Then
|
||||
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal
|
||||
PorcentajeImpuesto = TmpDT.MAX("PorcentajeIVA").ToDecimal
|
||||
|
||||
importeMovimiento = (TxtIVA.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL
|
||||
importeMX = importeMovimiento
|
||||
IdCtaContable = IdCtaIVATrasladado
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, VentaFolio, "")
|
||||
Else
|
||||
importeMovimiento = 0
|
||||
PorcentajeImpuesto = 0
|
||||
End If
|
||||
|
||||
Case 38 ' IEPS x Trasladar
|
||||
If gvr.DataKey("RegresarImpuesto") = "1" Then
|
||||
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal
|
||||
PorcentajeImpuesto = 0 '(importeMovimiento / TxtTotal.Text.ToDecimal()) 'falta TC
|
||||
|
||||
importeMovimiento = (TxtIEPS.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL
|
||||
importeMX = importeMovimiento
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
|
||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladar").ToString().ToEntero()
|
||||
End If
|
||||
End If
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, VentaFolio, "")
|
||||
Else
|
||||
importeMovimiento = 0
|
||||
PorcentajeImpuesto = 0
|
||||
End If
|
||||
|
||||
Case 39 ' IEPS Trasladado
|
||||
If gvr.DataKey("RegresarImpuesto") = "1" Then
|
||||
SimplificaPrePoliza = False
|
||||
CveIEAnticipo = gvr.DataKey("CveIE").ToEntero()
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal
|
||||
PorcentajeImpuesto = 0
|
||||
|
||||
importeMovimiento = (TxtIEPS.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL
|
||||
importeMX = importeMovimiento
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
|
||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSTrasladado").ToString().ToEntero()
|
||||
End If
|
||||
End If
|
||||
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, VentaFolio, "")
|
||||
Else
|
||||
importeMovimiento = 0
|
||||
PorcentajeImpuesto = 0
|
||||
End If
|
||||
Case Else
|
||||
importeMovimiento = 0
|
||||
PorcentajeImpuesto = 0
|
||||
importeMX = 0
|
||||
End Select
|
||||
Select Case gvr.DataKey("CveConceptoContable").ToString()
|
||||
Case "3"
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
If IdCtaContable <= 0 Then
|
||||
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString())
|
||||
idCuentaContabilizacion = 0
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1,
|
||||
CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=importeMX, TipoCambio:=TipoCambioGeneral, CveIE:=CveIEAnticipo,
|
||||
PorcentajeImpuesto:=PorcentajeImpuesto, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
Exit For
|
||||
Dim Pago As New VentaPago
|
||||
Pago.ImportePagoVenta = importeMovimiento
|
||||
Pago.ImportePago = importeMovimiento
|
||||
Pago.CveIE = CveIEAnticipo
|
||||
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero()
|
||||
Pago.TipoPago = "A"
|
||||
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero()
|
||||
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
|
||||
Pago.Referencia = gvr.DataKey("Folio")
|
||||
|
||||
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
|
||||
|
||||
End If
|
||||
|
||||
Case "12"
|
||||
|
||||
If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMN = importeMovimiento
|
||||
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
|
||||
ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMN = importeMovimiento * gvr.DataKey("TipoCambio").ToString().ToDecimal
|
||||
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
|
||||
ElseIf CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMN = importeMovimiento * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
|
||||
TC = TipoCambioFluctuacion
|
||||
ElseIf CveMonedaVenta = 2 And gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
|
||||
importeMN = importeMovimiento
|
||||
TC = gvr.DataKey("TipoCambio").ToString().ToDecimal
|
||||
End If
|
||||
importeMovimiento = importeMovimiento.RoundSQL
|
||||
importeMN = importeMN.RoundSQL
|
||||
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso ObjConta.GetRetCuenta(12, CveCliente) Then
|
||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString().ToEntero()
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
|
||||
Dim Pago As New VentaPago
|
||||
Pago.Fecha = TxtFechaAnticipoCliente.Text.ToDate
|
||||
Pago.FechaDocumentoRelacionado = gvr.DataKey("Fecha").ToDate
|
||||
Pago.ImportePagoVenta = importeMovimiento
|
||||
Pago.ImportePago = importeMovimiento
|
||||
Pago.CveIE = CveIEAnticipo
|
||||
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero()
|
||||
Pago.TCPago = gvr.DataKey("TipoCambio").ToDecimal
|
||||
Pago.TipoPago = "NC"
|
||||
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero()
|
||||
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
|
||||
Pago.Referencia = gvr.DataKey("Folio")
|
||||
Pago.CveConceptoPago = 251
|
||||
|
||||
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
|
||||
SimplificaPrePoliza = False
|
||||
End If
|
||||
|
||||
Case "66"
|
||||
If gvr.DataKey("CveIE").ToEntero() > 0 Then
|
||||
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
IdCtaContable = IdCtaContClientes
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
|
||||
Dim Pago As New VentaPago
|
||||
Pago.ImportePago = importeMovimiento
|
||||
Pago.CveIE = CveIEAnticipo
|
||||
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero()
|
||||
Pago.TipoPago = "A"
|
||||
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero()
|
||||
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
|
||||
Pago.Referencia = gvr.DataKey("Folio")
|
||||
|
||||
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
|
||||
|
||||
' Agregamos el 2
|
||||
If tipoCambioPago = 1 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, Now, IdCtaContClientes, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
Else 'Cuando son dolares
|
||||
If importeMovimiento <> 0 Then
|
||||
If IdCtaContComplementaria > 0 Or 0 > 0 Then
|
||||
'Agregamos la Complementaria
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, 0, Concepto, 207, Concepto, Now, IdCtaContComplementaria, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
'Agregamos la Extranjera
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, Now, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
Else
|
||||
'Agregamos la Extranjera
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, Now, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
importeMovimiento = ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / TxtTotal.Text.ToDecimal) * TxtIVA.Text.ToDecimal)
|
||||
importeMN = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
|
||||
|
||||
|
||||
'Agregamos el 92
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal 'gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo" & gvr.RowIndex).ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
|
||||
importeMN = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
|
||||
IdCtaContable = IdCtaContAnticipos
|
||||
|
||||
If ObjCliente.GetClientes(gvr.DataKey("CveCliente").ToEntero(), "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
If Not tipoCambioPago = 1 Then
|
||||
IdCtaContable = ObjCliente.IdCtaMonedaExtranjeraAnticipos
|
||||
Else
|
||||
IdCtaContable = ObjCliente.IdCtaContAnticipos
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(119) Then
|
||||
If gvr.DataKey("Fecha").ToDate.Year <= 2017 AndAlso TxtFechaAnticipoCliente.Text.ToDate.Year >= 2018 Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
If Not tipoCambioPago = 1 Then
|
||||
IdCtaContable = ObjCliente.IdCtaContMonedaExtranjera
|
||||
Else
|
||||
IdCtaContable = ObjCliente.IdCtaContClientes
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, 555, Concepto, Now, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMN, CveCuenta:=-1, TipoCambio:=tipoCambioPago, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
End Select
|
||||
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
@@ -29563,8 +29316,9 @@ Partial Class Ventas
|
||||
Private Sub CargaEstado()
|
||||
DdlComExtEstado.Items.Clear()
|
||||
If DdlComExtPais.SelectedValue.ToEntero() > 0 Then
|
||||
DdlComExtEstado.DataSource = GlobalDTGralEstados("-1", CvePais:=DdlComExtPais.SelectedValue.ToEntero)(0)("ClaveSATPais").ToString()
|
||||
DdlComExtEstado.DataSource = GlobalDTGralEstados("-1", CvePais:=DdlComExtPais.SelectedValue.ToEntero) '(0)("ClaveSATPais").ToString()
|
||||
End If
|
||||
DdlComExtEstado.Visible = True
|
||||
DdlComExtEstado.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlComExtEstado.DataBind()
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user