-- aplicar anticipo

This commit is contained in:
2022-09-30 19:11:31 -07:00
parent d00c7e5d61
commit b07c40c9fb

View File

@@ -7818,10 +7818,8 @@ Partial Class Compras_Compras
End If
End If
Next
End If
'GUARDA BITACORA TIPO CAMBIO OC
If Not ErrorOC And TipoCambioOC > 0 Then
If Not ObjEventos.AddEventoBitacora(String.Format("La vinculación con la orden de compra fue con un tipo de cambio de ${0}", TipoCambioOC.ToString), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=CveCompra) Then
@@ -7829,21 +7827,6 @@ Partial Class Compras_Compras
End If
End If
'If tDTAcarreos.Rows.Count > 0 Then
' If TotAcarreos = TxtSubTotal.Text.ToDouble Then
' 'ACARREOS
' For Each tDTAcar As DataRow In tDTAcarreos.Rows
' If Not ObjAcar.UpdatePreEstimacion(CInt(tDTAcar("CvePreEstimacion")), CveCompra) Then
' ErrorAddAcarreos = True
' Exit For
' End If
' Next
' Else
' ErrorAddAcarreos = True
' End If
'End If
'AGREGAR OTROS GASTOS A ORDEN DE CORTE
If CveOrdenCorte > 0 And UsuarioActual.CveEmpresa = 126 Then
If ObjCGame.AddCorteGasto(CveOrdenCorte, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Now, 0, CveCompra) Then
@@ -8364,17 +8347,12 @@ Partial Class Compras_Compras
'If gvr.DataKey("Fecha").ToDate > Fecha Then Fecha = gvr.DataKey("Fecha").ToDate 'guardo la fecha mayor
Importe += gvr.FCTextBox("TxtAnticipo").Text.ToDouble
If Math.Round(Importe, 2) - Math.Round(CompraSaldo, 2) > 0.01 Then gvr.FCTextBox("TxtAnticipo").Text = "" : gvr.FCCheckBox("Chk").Checked = False
End If
Next
Else
Contador = 1
End If
'If TxtFecha.Text.ToDate > Fecha Then Fecha = TxtFecha.Text.ToDate
Fecha = TxtFechaEjecucion.Text.ToDate
@@ -8429,6 +8407,8 @@ Partial Class Compras_Compras
CompraActual.IdCtaContableProvComplementaria = CtaProveedorComplementaria
CompraActual.EsImportacion = chkImportacion.Checked
Dim CvePrePolizaNueva As Integer = ObjConta.AddPrePolizas("Compras/Anticipos", 52, Importe, Importe, DdlMoneda.SelectedValue.ToEntero, Fecha, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.FCCheckBox("Chk") IsNot Nothing AndAlso gvr.FCCheckBox("Chk").Checked Then
@@ -8476,20 +8456,20 @@ Partial Class Compras_Compras
PorcentajePago = gvr.FCTextBox("TxtAnticipo").Text.ToDecimal / TxtTotal.Text.ToDecimal
Dim ImporteAntMNComision As Decimal = (ImporteAnt + ImporComisionAnticipo) * TipoCambioAnt
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoCompra, (ImporteAnt + ImporComisionAnticipo), "", CveConceptoCompra, "", TxtFechaPago.Text.ToDate, IdCtaContable, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteAntMNComision, ImporteME:=If(TipoCambioAnt = 1, 0, (ImporteAnt + ImporComisionAnticipo)), CveSubProyecto:=CveSubProyectoAnticipo) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimientoCompra, (ImporteAnt + ImporComisionAnticipo), "", CveConceptoCompra, "", TxtFechaPago.Text.ToDate, IdCtaContable, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteAntMNComision, ImporteME:=If(TipoCambioAnt = 1, 0, (ImporteAnt + ImporComisionAnticipo)), CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
End If
If CveMonedaAnticipo > 1 Then
Dim ImporteAntMN As Decimal = TipoCambioAnt * ImporteAnt - ImporteAnt
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoCompra, ImporteAntMN, "", CveConceptoCompraComplementaria, "", TxtFechaPago.Text.ToDate, IdCtaContableComp, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteAntMN, ImporteME:=If(TipoCambioAnt = 1, 0, ImporteAnt), CveSubProyecto:=CveSubProyectoAnticipo) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimientoCompra, ImporteAntMN, "", CveConceptoCompraComplementaria, "", TxtFechaPago.Text.ToDate, IdCtaContableComp, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=ImporteAntMN, ImporteME:=If(TipoCambioAnt = 1, 0, ImporteAnt), CveSubProyecto:=CveSubProyectoAnticipo) Then
ErrorMovtosCxP = 1
End If
End If
Pago.CveIE = CveIE
Pago.CveCompraAmortizacion = CveCompraNC
AplicaPrePolizaPagoCompra(CompraActual, pago, CvePrePoliza, ObjConta)
AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePolizaNueva, ObjConta)
End If
End If