--cambio en prepólizas

This commit is contained in:
2023-08-11 19:21:14 -07:00
parent 8c16b3ff66
commit 2a9d969fec

View File

@@ -45,7 +45,6 @@ Partial Class Compras_ReembolsosComprobaciones
End Set End Set
End Property End Property
Private Property CvePrePolizaComprobacion As Integer Private Property CvePrePolizaComprobacion As Integer
Get Get
Return ViewState("CvePrePolizaComprobacion").ToString.ToEntero Return ViewState("CvePrePolizaComprobacion").ToString.ToEntero
@@ -54,23 +53,7 @@ Partial Class Compras_ReembolsosComprobaciones
ViewState("CvePrePolizaComprobacion") = value ViewState("CvePrePolizaComprobacion") = value
End Set End Set
End Property End Property
Private Property IdCuentaBancaria As Integer
Get
Return ViewState("IdCuentaBancaria").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("IdCuentaBancaria") = value
End Set
End Property
Private Property CveCuentaBancaria As Integer
Get
Return ViewState("CveCuentaBancaria").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveCuentaBancaria") = value
End Set
End Property
Private Property NumeroReembolso As String Private Property NumeroReembolso As String
Get Get
NumeroReembolso = ViewState("NumeroReembolso").ToString NumeroReembolso = ViewState("NumeroReembolso").ToString
@@ -105,12 +88,10 @@ Partial Class Compras_ReembolsosComprobaciones
End Set End Set
End Property End Property
#End Region #End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
TxtImporte.Attributes.Add("disabled", "disabled") TxtImporte.Attributes.Add("disabled", "disabled")
TxtAboneA.Enabled = False TxtAboneA.Enabled = False
CveCuentaBancaria = -1
ViewState("CveMoneda") = 1 ViewState("CveMoneda") = 1
CveMonedaPago = 1 CveMonedaPago = 1
TipoCambioPago = 1 TipoCambioPago = 1
@@ -335,7 +316,6 @@ Partial Class Compras_ReembolsosComprobaciones
If dr IsNot Nothing Then If dr IsNot Nothing Then
CveMonedaPago = dr("CveMoneda").ToString.ToEntero CveMonedaPago = dr("CveMoneda").ToString.ToEntero
IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
End If End If
If HdnTipoTransaccion.Value = "Egs" Then If HdnTipoTransaccion.Value = "Egs" Then
@@ -468,24 +448,16 @@ Partial Class Compras_ReembolsosComprobaciones
Dim ObjIE As New ClsBancos() Dim ObjIE As New ClsBancos()
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
Dim MsgError As String = "" Dim MsgError As String = ""
Dim CveIEExcedente As Integer = -1 Dim CveIEExcedente As Integer = -1
Dim CvePrePolizaExcedente As Integer = 0 Dim CvePrePolizaExcedente As Integer = 0
Dim CveIERegistrado As Integer = 0 Dim CveIERegistrado As Integer = 0
Dim CveIECajaChica As Integer = 0 Dim CveIECajaChica As Integer = 0
Dim CvePrePolizaIERegistrado As Integer = 0 Dim CvePrePolizaIERegistrado As Integer = 0
Dim IdPoliza As Integer = 0 Dim IdPoliza As Integer = 0
Dim CveIEPago As Integer = 0 Dim CveIEPago As Integer = 0
Dim CvePrePolizaPago As Integer = 0 Dim CvePrePolizaPago As Integer = 0
Dim CvePrePolizaPagoOriginal As Integer = 0 Dim CvePrePolizaPagoOriginal As Integer = 0
Dim IdCtaPersonal As Integer = -1
Dim CvePersonal As Integer = If(DdlPersonal.Visible AndAlso DdlPersonal.SelectedValue.ToEntero > 0, DdlPersonal.SelectedValue.ToEntero, 0) Dim CvePersonal As Integer = If(DdlPersonal.Visible AndAlso DdlPersonal.SelectedValue.ToEntero > 0, DdlPersonal.SelectedValue.ToEntero, 0)
If CvePersonal > 0 Then
IdCtaPersonal = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContPersonal", String.Format("CvePersonal = {0}", CvePersonal)).ToEntero
End If
Dim tipoCambio As Decimal = 1 Dim tipoCambio As Decimal = 1
Dim drp As DataRow = DtCheques.FiltroPrimero($"CveIE = {DDlCheques.SelectedValue.ToEntero}") Dim drp As DataRow = DtCheques.FiltroPrimero($"CveIE = {DDlCheques.SelectedValue.ToEntero}")
@@ -503,17 +475,13 @@ Partial Class Compras_ReembolsosComprobaciones
Dim concepto As String = "Compras: " Dim concepto As String = "Compras: "
For Each Gvr As GridViewRow In GvCxP.Rows For Each Gvr As GridViewRow In GvCxP.Rows
Dim chkPago As CheckBox = Gvr.FCCheckBox("Chk") Dim chkPago As CheckBox = Gvr.FCCheckBox("Chk")
If chkPago.Checked Then If chkPago.Checked Then
concepto = concepto & $" {Gvr.DataKey("SerieFolio").ToString }" concepto = concepto & $" {Gvr.DataKey("SerieFolio").ToString }"
End If End If
Next Next
Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos
Dim filemove As String = "" Dim filemove As String = ""
Dim Comprobante As String = "" Dim Comprobante As String = ""
Dim ComprobanteIE = "" Dim ComprobanteIE = ""
@@ -533,12 +501,12 @@ Partial Class Compras_ReembolsosComprobaciones
Dim FolioIENew = ObjIE.GetNextFolio(If(CveCajaChica > 0, CveCajaChica, CvePersonal), 8).ToString Dim FolioIENew = ObjIE.GetNextFolio(If(CveCajaChica > 0, CveCajaChica, CvePersonal), 8).ToString
CveIECajaChica = ObjIE.AddBancos_IE(CveCajaChica, 8, If(ChkReembolsarSinBancos.Checked, TxtFechaPrePoliza.Text.ToDate, TxtFechaDocumento.Text.Trim.ToDate), FolioIENew, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), TxtImporteVinculado.Text.ToDecimal, CveMoneda, 0, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False)) CveIECajaChica = ObjIE.AddBancos_IE(CveCajaChica, 8, If(ChkReembolsarSinBancos.Checked, TxtFechaPrePoliza.Text.ToDate, TxtFechaDocumento.Text.Trim.ToDate), FolioIENew, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), TxtImporteVinculado.Text.ToDecimal, CveMoneda, 0, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False))
'AGREGO PREPOLIZA IE BANCOS 'AGREGO PREPOLIZA IE BANCOS
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporteVinculado.Text.ToDecimal, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIECajaChica, ImporteME:=If(tipoCambio = 1, 0, TxtImporteVinculado.Text.ToDecimal), ImporteMX:=TxtImporteVinculado.Text.ToDecimal * tipoCambio) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporteVinculado.Text.ToDecimal, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, 0, -1, CveIE:=CveIECajaChica, ImporteME:=If(tipoCambio = 1, 0, TxtImporteVinculado.Text.ToDecimal), ImporteMX:=TxtImporteVinculado.Text.ToDecimal * tipoCambio) Then
MsgError = "Error al registrar detalle de concepto bancario" MsgError = "Error al registrar detalle de concepto bancario"
End If End If
Else Else
'AGREGO PREPOLIZA FyE 'AGREGO PREPOLIZA FyE
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporteVinculado.Text.ToDecimal, TxtObservaciones.Text, 29, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCtaPersonal, -1, CvePersonal:=CvePersonal, CveIE:=CveIERegistrado, ImporteME:=If(tipoCambio = 1, 0, TxtImporteVinculado.Text.ToDecimal), ImporteMX:=TxtImporteVinculado.Text.ToDecimal * tipoCambio) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporteVinculado.Text.ToDecimal, TxtObservaciones.Text, 29, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, 0, -1, CvePersonal:=CvePersonal, CveIE:=CveIERegistrado, ImporteME:=If(tipoCambio = 1, 0, TxtImporteVinculado.Text.ToDecimal), ImporteMX:=TxtImporteVinculado.Text.ToDecimal * tipoCambio) Then
MsgError = "Error al registrar detalle de concepto bancario" MsgError = "Error al registrar detalle de concepto bancario"
End If End If
End If End If
@@ -560,13 +528,12 @@ Partial Class Compras_ReembolsosComprobaciones
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("CveCuenta = " & DdlCuenta.SelectedValue) Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("CveCuenta = " & DdlCuenta.SelectedValue)
If dr IsNot Nothing Then If dr IsNot Nothing Then
CveMonedaPago = dr("CveMoneda").ToString.ToEntero CveMonedaPago = dr("CveMoneda").ToString.ToEntero
IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
End If End If
If ChkChequeExcedente.Checked Then If ChkChequeExcedente.Checked Then
CvePrePolizaExcedente = ObjMov.AddPrePolizas("Compras/Comprobaciones3", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaDocumento.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrePolizaExcedente = ObjMov.AddPrePolizas("Compras/Comprobaciones3", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaDocumento.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
CveIEExcedente = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaExcedente, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False)) CveIEExcedente = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaExcedente, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False))
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, If(CveCajaChica > 0, 30, 29), TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEExcedente, CvePersonal:=CvePersonal, CveCompra:=-1, CveProveedor:=-1, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, If(CveCajaChica > 0, 30, 29), TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, 0, -1, CveIE:=CveIEExcedente, CvePersonal:=CvePersonal, CveCompra:=-1, CveProveedor:=-1, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then
MsgError = "Error al registrar detalle de concepto bancario" MsgError = "Error al registrar detalle de concepto bancario"
End If End If
@@ -590,7 +557,7 @@ Partial Class Compras_ReembolsosComprobaciones
End If End If
'AGREGO PREPOLIZA IE BANCOS 'AGREGO PREPOLIZA IE BANCOS
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=-1, CveProveedor:=-1, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, 0, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=-1, CveProveedor:=-1, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then
MsgError = "Error al registrar detalle de concepto bancario" MsgError = "Error al registrar detalle de concepto bancario"
End If End If
@@ -600,7 +567,7 @@ Partial Class Compras_ReembolsosComprobaciones
CveIECajaChica = ObjIE.AddBancos_IE(CveCajaChica, 8, TxtFechaDocumento.Text.Trim.ToDate, FolioIENew, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), TxtImporte.Text.ToDecimal, CveMoneda, 0, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False)) CveIECajaChica = ObjIE.AddBancos_IE(CveCajaChica, 8, TxtFechaDocumento.Text.Trim.ToDate, FolioIENew, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), TxtImporte.Text.ToDecimal, CveMoneda, 0, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False))
'AGREGO PREPOLIZA IE BANCOS 'AGREGO PREPOLIZA IE BANCOS
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, False, TxtImporte.Text.ToDecimal, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIECajaChica, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio, Contabilizable:=Not UsaSimplificacionCajaChica) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, False, TxtImporte.Text.ToDecimal, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, 0, -1, CveIE:=CveIECajaChica, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio, Contabilizable:=Not UsaSimplificacionCajaChica) Then
MsgError = "Error al registrar detalle de concepto bancario" MsgError = "Error al registrar detalle de concepto bancario"
End If End If
Else Else
@@ -609,7 +576,7 @@ Partial Class Compras_ReembolsosComprobaciones
Importe28 = TxtTotal.Text.ToDecimal Importe28 = TxtTotal.Text.ToDecimal
End If End If
'AGREGO PREPOLIZA FyE 'AGREGO PREPOLIZA FyE
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, False, Importe28, TxtObservaciones.Text, 28, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCtaPersonal, -1, CvePersonal:=CvePersonal, CveIE:=CveIERegistrado, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=Importe28 * tipoCambio, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, False, Importe28, TxtObservaciones.Text, 28, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, 0, -1, CvePersonal:=CvePersonal, CveIE:=CveIERegistrado, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=Importe28 * tipoCambio, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then
MsgError = "Error al registrar detalle de concepto bancario" MsgError = "Error al registrar detalle de concepto bancario"
End If End If
End If End If
@@ -624,12 +591,12 @@ Partial Class Compras_ReembolsosComprobaciones
CveIECajaChica = ObjIE.AddBancos_IE(CveCajaChica, 2, If(ChkReembolsarSinBancos.Checked, TxtFechaPrePoliza.Text.ToDate, TxtFechaDocumento.Text.Trim.ToDate), FolioIENew, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), TxtImporte.Text.ToDecimal, CveMoneda, 0, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False)) CveIECajaChica = ObjIE.AddBancos_IE(CveCajaChica, 2, If(ChkReembolsarSinBancos.Checked, TxtFechaPrePoliza.Text.ToDate, TxtFechaDocumento.Text.Trim.ToDate), FolioIENew, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), TxtImporte.Text.ToDecimal, CveMoneda, 0, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False))
'8 '8
'AGREGO PREPOLIZA IE BANCOS 'AGREGO PREPOLIZA IE BANCOS
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporte.Text.ToDecimal, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIECajaChica, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporte.Text.ToDecimal, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, 0, -1, CveIE:=CveIECajaChica, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then
MsgError = "Error al registrar detalle de concepto bancario" MsgError = "Error al registrar detalle de concepto bancario"
End If End If
Else Else
'AGREGO PREPOLIZA FyE 'AGREGO PREPOLIZA FyE
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporteVinculado.Text.ToDecimal, TxtObservaciones.Text, 29, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCtaPersonal, -1, CvePersonal:=CvePersonal, CveIE:=CveIERegistrado, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporteVinculado.Text.ToDecimal, TxtObservaciones.Text, 29, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, 0, -1, CvePersonal:=CvePersonal, CveIE:=CveIERegistrado, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then
MsgError = "Error al registrar detalle de concepto bancario" MsgError = "Error al registrar detalle de concepto bancario"
End If End If
End If End If
@@ -643,8 +610,6 @@ Partial Class Compras_ReembolsosComprobaciones
Dim PorcentajePago As Decimal = 1 Dim PorcentajePago As Decimal = 1
Dim FechaMovimiento As Date = TxtFechaDocumento.Text.ToDate Dim FechaMovimiento As Date = TxtFechaDocumento.Text.ToDate
Dim IdCtaProveedor As Integer = 0
Dim IdCtaOtrosProductos As Integer = 0
Dim CvePrePolizaUnificar As Integer = 0 Dim CvePrePolizaUnificar As Integer = 0
Dim SeUnifico = False Dim SeUnifico = False
'inserto las compras que voy a pagar 'inserto las compras que voy a pagar
@@ -656,12 +621,6 @@ Partial Class Compras_ReembolsosComprobaciones
Dim Referencia As String = gvr.DataKey("SerieFolio").ToString Dim Referencia As String = gvr.DataKey("SerieFolio").ToString
Dim ImportePagar, ImporteOriginal As Decimal Dim ImportePagar, ImporteOriginal As Decimal
If gvr.DataKey("CveTipoConcepto").ToEntero = 2 Then
IdCtaProveedor = gvr.DataKey("IdCtaContAcreedor").ToEntero
Else
IdCtaProveedor = gvr.DataKey("IdCtaContProveedores").ToEntero
End If
Dim CompraActual As New Compra Dim CompraActual As New Compra
CompraActual.CveCompra = gvr.DataKey("CveCompra").ToEntero CompraActual.CveCompra = gvr.DataKey("CveCompra").ToEntero
CompraActual.CveTipoConceptoProveedor = gvr.DataKey("CveTipoConcepto").ToEntero CompraActual.CveTipoConceptoProveedor = gvr.DataKey("CveTipoConcepto").ToEntero
@@ -728,7 +687,7 @@ Partial Class Compras_ReembolsosComprobaciones
If Not ChkReembolsarSinBancos.Checked AndAlso (Not HdnCheque.Value.ToEntero > 0 Or Not UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso Not ChkMesSiguiente.Checked) Then If Not ChkReembolsarSinBancos.Checked AndAlso (Not HdnCheque.Value.ToEntero > 0 Or Not UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso Not ChkMesSiguiente.Checked) Then
'Si es caja chica metemos el concepto 30, si es funcionario metemos 29 'Si es caja chica metemos el concepto 30, si es funcionario metemos 29
ImporteMovto += Pago.OtroGastoIngreso ' si ajuste, sedebe de aplicar en su contraparte ImporteMovto += Pago.OtroGastoIngreso ' si ajuste, sedebe de aplicar en su contraparte
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, ImporteMovto, Referencia, If(CveCajaChica > 0, 30, 29), ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEPago, CveIEDevolucion:=If(CveCajaChica > 0, If(DDlCheques.SelectedValue.ToEntero = -1, CveIECajaChica, DDlCheques.SelectedValue.ToEntero), -1), CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, ImporteMovto, ImporteMovto * tipoCambio, If(CveCajaChica > 0, 30, 29), Referencia, ConceptoMovimiento, CveIE:=CveIEPago, CveIEDevolucion:=If(CveCajaChica > 0, If(DDlCheques.SelectedValue.ToEntero = -1, CveIECajaChica, DDlCheques.SelectedValue.ToEntero), -1), CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then
MsgError = "Detalle" MsgError = "Detalle"
End If End If
End If End If
@@ -739,13 +698,13 @@ Partial Class Compras_ReembolsosComprobaciones
If MsgError = "" AndAlso UsuarioActual.Empresa.Funcionalidad(506) = "1" And CbPermitirExcedente.Checked = True And SaldoExcedente > 0 Then If MsgError = "" AndAlso UsuarioActual.Empresa.Funcionalidad(506) = "1" And CbPermitirExcedente.Checked = True And SaldoExcedente > 0 Then
If DDlPermitirExcedente.SelectedValue = "1" Then If DDlPermitirExcedente.SelectedValue = "1" Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 132, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaOtrosProductos, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, SaldoExcedente * tipoCambio, 132, Referencia, ConceptoMovimiento, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle Reembolso Personal" MsgError = "Detalle Reembolso Personal"
End If End If
ElseIf DDlPermitirExcedente.SelectedValue = "2" Then ElseIf DDlPermitirExcedente.SelectedValue = "2" Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, Referencia, 29, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaPersonal, -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), ImporteMX:=SaldoExcedente * tipoCambio, CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, SaldoExcedente, SaldoExcedente * tipoCambio, 29, Referencia, ConceptoMovimiento, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, SaldoExcedente), CvePersonal:=CvePersonal, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal) Then
MsgError = "Detalle Reembolso Personal Excedente" MsgError = "Detalle Reembolso Personal Excedente"
End If End If
End If End If
@@ -788,7 +747,7 @@ Partial Class Compras_ReembolsosComprobaciones
Pago.CveMonedaPago = CveMoneda Pago.CveMonedaPago = CveMoneda
Pago.CvePersonal = CvePersonal Pago.CvePersonal = CvePersonal
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, ImporteMovto, Referencia, 30, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CveCuenta:=CveCuentaBancaria) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, ImporteMovto, ImporteMovto * tipoCambio, 30, Referencia, ConceptoMovimiento, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto)) Then
MsgError = "no se pudo insertar el detalle de la poliza" MsgError = "no se pudo insertar el detalle de la poliza"
End If End If
@@ -798,7 +757,7 @@ Partial Class Compras_ReembolsosComprobaciones
'Otros Ingresos 'Otros Ingresos
If ChkAjusteOI.Checked Then If ChkAjusteOI.Checked Then
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, 0, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.FCTextBox("TxtComision").Text.ToDecimal, gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio, 78, Referencia, ConceptoMovimiento, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal)) Then
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos" MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
End If End If
End If End If
@@ -838,15 +797,19 @@ Partial Class Compras_ReembolsosComprobaciones
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError) Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
End If End If
End If End If
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
If UsuarioActual.CveEmpresa = 119 Then
AutoConta = False
End If
If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePolizaPago, 1) Then If MsgError = "" AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePolizaPago, 1, AutoConta:=AutoConta) Then
If ObjMov.ValorPolizaDescuadre > 0 Then If ObjMov.ValorPolizaDescuadre > 0 Then
GuardaLogAD($"Compras/ReembolsosComprobaciones | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePolizaPago}", "LogPrePolizas") GuardaLogAD($"Compras/ReembolsosComprobaciones | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePolizaPago}", "LogPrePolizas")
MsgError = ObjMov.MensajePolizaDescuadre MsgError = ObjMov.MensajePolizaDescuadre
End If End If
End If End If
If MsgError = "" AndAlso CvePrePolizaExcedente > 0 AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePolizaExcedente, 1) Then If MsgError = "" AndAlso CvePrePolizaExcedente > 0 AndAlso ObjMov.ValidacionPrePolizaCuadre(CvePrePolizaExcedente, 1, AutoConta:=AutoConta) Then
If ObjMov.ValorPolizaDescuadre > 0 Then If ObjMov.ValorPolizaDescuadre > 0 Then
GuardaLogAD($"Compras/ReembolsosComprobaciones | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePolizaExcedente}", "LogPrePolizas") GuardaLogAD($"Compras/ReembolsosComprobaciones | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePolizaExcedente}", "LogPrePolizas")
MsgError = ObjMov.MensajePolizaDescuadre MsgError = ObjMov.MensajePolizaDescuadre
@@ -855,50 +818,17 @@ Partial Class Compras_ReembolsosComprobaciones
If MsgError.Trim = "" Then If MsgError.Trim = "" Then
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
If UsuarioActual.CveEmpresa = 119 Then
AutoConta = False
End If
'Conta ContPAQ AUTOMATICA 'Conta ContPAQ AUTOMATICA
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError.Trim = "" Then If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError.Trim = "" Then
If CvePrePolizaIERegistrado > 0 Then If CvePrePolizaIERegistrado > 0 Then
If UsuarioActual.Empresa.TipoContabilidad = 2 Then If Not ObjMov.ContabilizarPrePoliza(CvePrePolizaIERegistrado, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
If IdCtaPersonal > 0 Or DdlCajaChica.Visible Then MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
If IdCtaProveedor > 0 Then
If Not ObjMov.ContabilizarPrePoliza(CvePrePolizaIERegistrado, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
End If
Else
MsgError = "No tiene cuenta contable de proveedor"
End If
Else
MsgError = "No tiene cuenta contable de personal"
End If
Else
If Not ObjMov.ContabilizarPrePoliza(CvePrePolizaIERegistrado, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
End If
End If End If
End If End If
If ChkChequeExcedente.Checked Then If ChkChequeExcedente.Checked Then
If UsuarioActual.Empresa.TipoContabilidad = 2 Then If Not ObjMov.ContabilizarPrePoliza(CvePrePolizaIERegistrado, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
If IdCuentaBancaria > 0 Then MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
If IdCtaProveedor > 0 Then
If Not ObjMov.ContabilizarPrePoliza(CvePrePolizaIERegistrado, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
End If
Else
MsgError = "No tiene cuenta contable de proveedor"
End If
Else
MsgError = "No tiene cuenta contable de personal"
End If
Else
If Not ObjMov.ContabilizarPrePoliza(CvePrePolizaIERegistrado, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
MsgError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico"
End If
End If End If
End If End If
End If End If
@@ -1190,7 +1120,6 @@ Partial Class Compras_ReembolsosComprobaciones
'If dr IsNot Nothing Then 'If dr IsNot Nothing Then
' CveMoneda = dr("CveMoneda").ToString.ToEntero ' CveMoneda = dr("CveMoneda").ToString.ToEntero
' IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
'End If 'End If
'If HdnTipoTransaccion.Value = "Egs" Then 'If HdnTipoTransaccion.Value = "Egs" Then