vinculacion con nc

This commit is contained in:
2021-01-13 15:27:02 -07:00
parent 580537a066
commit fe54b4ece5
2 changed files with 6271 additions and 6495 deletions

View File

@@ -1366,7 +1366,7 @@
<asp:BoundField ItemStyle-Width="400px" HeaderText="Producto o Servicio" DataField="PS" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField ItemStyle-Width="400px" HeaderText="Producto o Servicio" DataField="PS" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField ItemStyle-Width="80px" HeaderText="P.U." ItemStyle-HorizontalAlign="Right"> <asp:TemplateField ItemStyle-Width="80px" HeaderText="P.U." ItemStyle-HorizontalAlign="Right">
<ItemTemplate> <ItemTemplate>
<asp:Label Text='<%# Eval("PU", "{0:N2}")%>' runat="server"></asp:Label> <asp:Label Text='<%# Eval("PU", "{0:#,##0.00####}")%>' runat="server"></asp:Label>
</ItemTemplate> </ItemTemplate>
<FooterTemplate> <FooterTemplate>
<label>Total</label> <label>Total</label>
@@ -5342,7 +5342,7 @@
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:DropDownList runat="server" ID="DdlContratosObra" AutoPostBack="true" OnSelectedIndexChanged="DdlContratosCompras_SelectedIndexChanged" DataTextField="ContratoCompleto" DataValueField="CveContrato" CssClass="form-control input-sm select2me" Width="100%"> <asp:DropDownList runat="server" ID="DdlContratosObra" AutoPostBack="true" OnSelectedIndexChanged="DdlContratosObra_SelectedIndexChanged" DataTextField="ContratoCompleto" DataValueField="CveContrato" CssClass="form-control input-sm select2me" Width="100%">
<asp:ListItem Value="-1">Seleccione uno</asp:ListItem> <asp:ListItem Value="-1">Seleccione uno</asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
<label for="<%= DdlContratosObra.ClientID.ToString()%>">Contrato:</label> <label for="<%= DdlContratosObra.ClientID.ToString()%>">Contrato:</label>

View File

@@ -1165,57 +1165,6 @@ Partial Class Compras_Compras
End Set End Set
End Property End Property
Private Property CveContratoObra As Integer
Get
If ViewState("CveContratoObra") Is Nothing Then
Return -1
Else
Return ViewState("CveContratoObra").ToString.ToEntero
End If
End Get
Set(value As Integer)
ViewState("CveContratoObra") = value
End Set
End Property
Private Property MaxIVAProcentaje As Decimal
Get
If ViewState("MaxIVAProcentaje") Is Nothing Then
Return 0
Else
Return ViewState("MaxIVAProcentaje").ToString.ToDecimal
End If
End Get
Set(value As Decimal)
ViewState("MaxIVAProcentaje") = value
End Set
End Property
Private Property MAXRetIVAPorcentaje As Decimal
Get
If ViewState("MAXRetIVAPorcentaje") Is Nothing Then
Return 0
Else
Return ViewState("MAXRetIVAPorcentaje").ToString.ToDecimal
End If
End Get
Set(value As Decimal)
ViewState("MAXRetIVAPorcentaje") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then If Not IsPostBack Then
'ImgBtnBuscarOC.Attributes.Add("data-toggle", "tooltip") 'ImgBtnBuscarOC.Attributes.Add("data-toggle", "tooltip")
@@ -1237,7 +1186,6 @@ Partial Class Compras_Compras
CveConceptoContableAlmacen = 0 CveConceptoContableAlmacen = 0
EsNoDeducible = False EsNoDeducible = False
CveTipoConcepto = 1 CveTipoConcepto = 1
'CargaContratos()
'******** Prorrateo ******************************************** '******** Prorrateo ********************************************
If UsuarioActual.Empresa.Funcionalidad(117) <> "" Then If UsuarioActual.Empresa.Funcionalidad(117) <> "" Then
btnProrateo.Visible = True btnProrateo.Visible = True
@@ -1374,7 +1322,6 @@ Partial Class Compras_Compras
End If End If
ObjPersonal.Dispose() ObjPersonal.Dispose()
DdlPersonal.DataBind() DdlPersonal.DataBind()
DdlPersonalReembolso.DataBind() DdlPersonalReembolso.DataBind()
@@ -1502,8 +1449,6 @@ Partial Class Compras_Compras
DivEsNoDeducible.Visible = True DivEsNoDeducible.Visible = True
DivActualizarVincular.Visible = True DivActualizarVincular.Visible = True
'LiAccionesContratos.Visible = False
Else Else
ViewState("CveProveedor") = -1 ViewState("CveProveedor") = -1
@@ -1820,17 +1765,6 @@ Partial Class Compras_Compras
Xml.Append(Replace(Replace(Replace(nodeconceptos.OuterXml, "<cfdi:", "<"), "</cfdi:", "</"), "xmlns:cfdi=""http://www.sat.gob.mx/cfd/3""", "")) Xml.Append(Replace(Replace(Replace(nodeconceptos.OuterXml, "<cfdi:", "<"), "</cfdi:", "</"), "xmlns:cfdi=""http://www.sat.gob.mx/cfd/3""", ""))
If ObjeFacturas.GetFacturasComparacionXML(Version, Xml.ToString, UsuarioActual.CveEmpresa) Then If ObjeFacturas.GetFacturasComparacionXML(Version, Xml.ToString, UsuarioActual.CveEmpresa) Then
TmpDT = ObjeFacturas.DtResultados TmpDT = ObjeFacturas.DtResultados
If ObjeFacturas.DtResultados.Rows.Count > 0 Then
MaxIVAProcentaje = ObjeFacturas.DtResultados.MAX("IVAPorcentaje").ToDecimal
MAXRetIVAPorcentaje = ObjeFacturas.DtResultados.MAX("RetIVAPorcentaje").ToDecimal
Else
MaxIVAProcentaje = 0
End If
'TmpDT.Columns.Add("IVAPorcentaje") 'TmpDT.Columns.Add("IVAPorcentaje")
'TmpDT.Columns.Add("RetIVAPorcentaje") 'TmpDT.Columns.Add("RetIVAPorcentaje")
'TmpDT.Columns.Add("RetISRPorcentaje") 'TmpDT.Columns.Add("RetISRPorcentaje")
@@ -1878,10 +1812,10 @@ Partial Class Compras_Compras
DdlTipoCompra.Items.Clear() DdlTipoCompra.Items.Clear()
DdlTipoCompra.Items.Add(New ListItem("Seleccione", "-1")) DdlTipoCompra.Items.Add(New ListItem("Seleccione", "-1"))
DdlTipoCompra.Items.Add(New ListItem("NC Con Productos", "6")) DdlTipoCompra.Items.Add(New ListItem("NC Con Productos", "6"))
DdlTipoCompra.Items.Add(New ListItem("Apoyo Logístico", "9")) DdlTipoCompra.Items.Add(New ListItem("Apoyo Logístico", "9"))
DdlTipoCompra.Items.Add(New ListItem("NC Por Devolución", "11")) DdlTipoCompra.Items.Add(New ListItem("NC Por Devolución", "11"))
LiAccionesContratos.Visible = True
End Select End Select
'DIV ALIAS 'DIV ALIAS
@@ -2763,6 +2697,8 @@ Partial Class Compras_Compras
TmpDT.Columns.Add("CveContrato", GetType(Integer)) TmpDT.Columns.Add("CveContrato", GetType(Integer))
TmpDT.Columns.Add("DifPSSat", GetType(Integer)) TmpDT.Columns.Add("DifPSSat", GetType(Integer))
If Not TmpDT.Columns.Contains("CveContratoDetalle") Then If Not TmpDT.Columns.Contains("CveContratoDetalle") Then
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
End If End If
@@ -2773,10 +2709,6 @@ Partial Class Compras_Compras
End If End If
GvPS.DataSource = TmpDT GvPS.DataSource = TmpDT
GvPS.DataBind() GvPS.DataBind()
@@ -4043,7 +3975,6 @@ Partial Class Compras_Compras
Protected Sub BtnGuardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnGuardar.Click Protected Sub BtnGuardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnGuardar.Click
'------------------INICIA VALIDACIONES------------------ '------------------INICIA VALIDACIONES------------------
Dim EstatusCredito As Integer = 0 Dim EstatusCredito As Integer = 0
Dim CveSubProyecto As Integer = 0 Dim CveSubProyecto As Integer = 0
@@ -4677,18 +4608,19 @@ Partial Class Compras_Compras
CveEstatusFactura = 6 CveEstatusFactura = 6
End If End If
'hay amortización directa como descuento. RMF Temporal 'hay amortización directa como descuento. RMF Temporal
If UsuarioActual.CveEmpresa = 119 Then
'If LblAmortizacion.Text.ToDouble > 0 AndAlso TxtDescuento.Text.ToDouble = 0 Then
' TxtDescuento.Text = LblAmortizacion.Text
' LblAmortizacion.Text = "0.00"
'End If
'If LblAmortizacion.Text.ToDouble > 0 AndAlso TxtDescuento.Text.ToDouble = 0 Then 'o si el descuento es igual a la amortizacion
' TxtDescuento.Text = LblAmortizacion.Text 'If LblAmortizacion.Text.ToDouble = TxtDescuento.Text.ToDouble Then
' LblAmortizacion.Text = "0.00" ' TxtDescuento.Text = LblAmortizacion.Text
'End If ' LblAmortizacion.Text = "0.00"
'End If
'o si el descuento es igual a la amortizacion
'If LblAmortizacion.Text.ToDouble = TxtDescuento.Text.ToDouble Then
' TxtDescuento.Text = LblAmortizacion.Text
' LblAmortizacion.Text = "0.00"
'End If
End If
'si el registro es manual, toma el mismo dato 'si el registro es manual, toma el mismo dato
If CveFactura <= 0 Then TotalOriginal = TxtTotal.Text.ToDecimal If CveFactura <= 0 Then TotalOriginal = TxtTotal.Text.ToDecimal
@@ -4709,7 +4641,7 @@ Partial Class Compras_Compras
TxtRedondeo.Text.ToDouble, TxtTotal.Text.ToDouble, TxtFecha.Text.Trim.ToDate, DdlMoneda.SelectedValue.ToEntero, TipoCambio, TxtFechaPago.Text.Trim.ToDate, ChkAplicaNotaCredito.Checked, TxtObsFact.Text.Trim, CveEstatusFactura, TxtRedondeo.Text.ToDouble, TxtTotal.Text.ToDouble, TxtFecha.Text.Trim.ToDate, DdlMoneda.SelectedValue.ToEntero, TipoCambio, TxtFechaPago.Text.Trim.ToDate, ChkAplicaNotaCredito.Checked, TxtObsFact.Text.Trim, CveEstatusFactura,
CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, IdPoliza, CveCajaChica:=CveCajaChica, CvePersonal:=CvePersonal, NumeroReembolso:=NumeroReembolso, CveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, IdPoliza, CveCajaChica:=CveCajaChica, CvePersonal:=CvePersonal, NumeroReembolso:=NumeroReembolso, CveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero,
AplicoPromocion:=ChkOCPromocion.Checked, PorcentajeIVA:=PorcentajeIVA, CveMetodoPago:=CveMetodoPago, CveRetIVAConcepto:=If(DdlRetIVAConcepto.Items.Count > 0, DdlRetIVAConcepto.SelectedValue.ToEntero, -1), CveConceptoContableAlmacen:=CveConceptoContableAlmacen, AplicoPromocion:=ChkOCPromocion.Checked, PorcentajeIVA:=PorcentajeIVA, CveMetodoPago:=CveMetodoPago, CveRetIVAConcepto:=If(DdlRetIVAConcepto.Items.Count > 0, DdlRetIVAConcepto.SelectedValue.ToEntero, -1), CveConceptoContableAlmacen:=CveConceptoContableAlmacen,
CveRetISRConcepto:=If(DdlRetISRConcepto.Items.Count > 0, DdlRetISRConcepto.SelectedValue.ToEntero, -1), NoDeducible:=EsNoDeducible, CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, TotalOriginal:=TotalOriginal, CveTipoConcepto:=CveTipoConcepto, CveContrato:=CveContratoObra) Then CveRetISRConcepto:=If(DdlRetISRConcepto.Items.Count > 0, DdlRetISRConcepto.SelectedValue.ToEntero, -1), NoDeducible:=EsNoDeducible, CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, TotalOriginal:=TotalOriginal, CveTipoConcepto:=CveTipoConcepto) Then
ViewState("CveCompra") = ObjCompras.CveCompra ViewState("CveCompra") = ObjCompras.CveCompra
If ObjCompras.DtResultados.Rows.Count > 0 Then ViewState("CompraFolio") = ObjCompras.DtResultados.Rows(0)("vFolio").ToString If ObjCompras.DtResultados.Rows.Count > 0 Then ViewState("CompraFolio") = ObjCompras.DtResultados.Rows(0)("vFolio").ToString
@@ -5102,7 +5034,7 @@ Partial Class Compras_Compras
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1" Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
If UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso (DdlPersonalReembolso.SelectedValue.ToEntero > 0 Or DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero > 0 Or DdlTipoComprobante.SelectedValue = "Ant") Then If UsuarioActual.CveEmpresa = 119 AndAlso (DdlPersonalReembolso.SelectedValue.ToEntero > 0 Or DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero > 0 Or DdlTipoComprobante.SelectedValue = "Ant") Then
AutoConta = False AutoConta = False
End If End If
@@ -6551,7 +6483,7 @@ Partial Class Compras_Compras
End If End If
Case 6 'Compra Case 6 'Compra
Dim AgregaMercanciaInventario As Boolean = UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 119, 140, 141,152,159,160,161,162,163) AndAlso UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Dim AgregaMercanciaInventario As Boolean = UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 119, 140, 141,152,159,160,161,162,163) andalso UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1"
Dim RegistraConcepto225 As Boolean = UsuarioActual.Empresa.UsaInventarios AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Dim RegistraConcepto225 As Boolean = UsuarioActual.Empresa.UsaInventarios AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1"
@@ -6841,20 +6773,20 @@ Partial Class Compras_Compras
End If End If
End If End If
Case 6 Case 6
PorcentajeImpuesto = TmpDT.MAX("IVAPorcentaje").ToDecimal
Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}"
For Each RowDetalle As DataRow In TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2", "", {"CveClasificacion", "CveSubProyecto", "IVAPorcentaje"}).Rows For Each RowDetalle As DataRow In TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2", "", {"CveClasificacion", "CveSubProyecto"}).Rows
If ObjConta.GetRetCuenta(6, RowDetalle("CveClasificacion").ToString().ToEntero()) Then If ObjConta.GetRetCuenta(6, RowDetalle("CveClasificacion").ToString().ToEntero()) Then
If ObjConta.DtResultados.Rows.Count > 0 Then If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaGastoSIG").ToString.ToEntero
End If End If
End If End If
If importeMN <> 0 Then If importeMN <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMN, Referencia, 6, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMN, Referencia, 6, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual,
CveClasificacion:=RowDetalle("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=RowDetalle("CveSubProyecto").ToString().ToEntero(), Contabilizable:=SeContabiliza, PorcentajeImpuesto:=RowDetalle("IVAPorcentaje").ToString.ToDecimal) Then CveClasificacion:=RowDetalle("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=RowDetalle("CveSubProyecto").ToString().ToEntero(), Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True ErrorPrepoliza = True
End If End If
End If End If
@@ -6880,7 +6812,7 @@ Partial Class Compras_Compras
importeMovimiento = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) = 0 And ISNULL(AplicaCostoIndirecto,0) <> 1 And ISNULL(CveTipoPS,0) = 2").ToString.ToDecimal importeMovimiento = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) = 0 And ISNULL(AplicaCostoIndirecto,0) <> 1 And ISNULL(CveTipoPS,0) = 2").ToString.ToDecimal
importeMN = importeMovimiento * tipoCambioActual * Multiplicador importeMN = importeMovimiento * tipoCambioActual * Multiplicador
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'cuando es emp acumuladora If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'cuando es emp acumuladora
Dim Valor = (From dr1 In GlobalDTAcumTamaños().FiltraParametros("CveEmpresa = 140").AsEnumerable() Dim Valor = (From dr1 In GlobalDTAcumTamaños().FiltraParametros("CveEmpresa = 140").AsEnumerable()
Join dr2 In TmpDT.AsEnumerable On dr1.Field(Of Integer)("CvePSCargo") Equals dr2.Field(Of Integer)("CvePS") Join dr2 In TmpDT.AsEnumerable On dr1.Field(Of Integer)("CvePSCargo") Equals dr2.Field(Of Integer)("CvePS")
@@ -6969,7 +6901,7 @@ Partial Class Compras_Compras
If Not RegistroCuentaPuente AndAlso Not ChkNCInvNC.Checked Then If Not RegistroCuentaPuente AndAlso Not ChkNCInvNC.Checked Then
'GASTO 'GASTO
If UsuarioActual.CveEmpresa.Contiene(119, 158) Then If UsuarioActual.CveEmpresa = 119 Then
DT = TmpDT DT = TmpDT
Else Else
DT = TmpDT.FiltraParametros("ISNULL(AplicaCostoIndirecto,0) <> 1") DT = TmpDT.FiltraParametros("ISNULL(AplicaCostoIndirecto,0) <> 1")
@@ -7067,7 +6999,7 @@ Partial Class Compras_Compras
End If End If
Dim usacomplementariaProveedor As Boolean = False Dim usacomplementariaProveedor As Boolean = False
usacomplementariaProveedor = If(tipoCambioActual > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119), True, False) usacomplementariaProveedor = If(tipoCambioActual > 1 AndAlso UsuarioActual.CveEmpresa.Contiene(1, 119, 158), True, False)
If usacomplementariaProveedor AndAlso DdlTipoComprobante.SelectedValue = "Ant" Then If usacomplementariaProveedor AndAlso DdlTipoComprobante.SelectedValue = "Ant" Then
'importeMovimiento 'importeMovimiento
@@ -7106,7 +7038,7 @@ Partial Class Compras_Compras
End If End If
Case 5 'Proveedores Case 5 'Proveedores
If CveTipoConcepto = 2 Then ConceptoContable = 305 'cuando es acreedor If CveTipoConcepto = 2 Then ConceptoContable = 305 'cuando es acreedor
Dim UsaComplementaria As Boolean = UsuarioActual.CveEmpresa.Contiene(119, 158) Dim UsaComplementaria As Boolean = UsuarioActual.CveEmpresa.Contiene(119, 158)
If tipoCambioActual <> 1 Then If tipoCambioActual <> 1 Then
Select Case ConceptoContable Select Case ConceptoContable
Case 5 Case 5
@@ -7132,7 +7064,7 @@ Partial Class Compras_Compras
Else Else
IdCtaContable = CtaProveedorComplementaria IdCtaContable = CtaProveedorComplementaria
CveCuenta = CveCuentaProveedorComplementaria CveCuenta = CveCuentaProveedorComplementaria
If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0 OrElse UsaComplementaria) Then 'Cuando tiene complementaria lo dividimos en dos Then If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0 Or UsaComplementaria) Then 'Cuando tiene complementaria lo dividimos en dos Then
importeMN = importeMovimiento importeMN = importeMovimiento
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, CveConceptoContableComplementaria, Concepto, FechaMovimiento, IdCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=importeMovimiento * tipoCambioActual - importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, CveConceptoContableComplementaria, Concepto, FechaMovimiento, IdCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=importeMovimiento * tipoCambioActual - importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True ErrorPrepoliza = True
@@ -7143,11 +7075,12 @@ Partial Class Compras_Compras
End If End If
End If End If
If CveCompraRefacturacion > 0 Then If CveCompraRefacturacion > 0 Then
importeMovimiento = 0 importeMovimiento = 0
importeMN = 0 importeMN = 0
End If End If
Case 59 'Documentos Case 59 'Documentos
importeMovimiento = importeCreditos importeMovimiento = importeCreditos
importeMN = importeMovimiento * tipoCambioActual * Multiplicador importeMN = importeMovimiento * tipoCambioActual * Multiplicador
@@ -13147,7 +13080,7 @@ Partial Class Compras_Compras
End If End If
'CONTADO 'CONTADO
Select Case RBLContado.SelectedValue Select Case RBLContado.SelectedValue
Case "1" ' Bancos Case "1" ' Bancos
PnlContadoBancos.Visible = True PnlContadoBancos.Visible = True
TxtDocumentoImporte.Text = (TxtTotal.Text.ToDecimal - LblAmortizacion.Text.ToDecimal).FormatoNumero TxtDocumentoImporte.Text = (TxtTotal.Text.ToDecimal - LblAmortizacion.Text.ToDecimal).FormatoNumero
@@ -13196,7 +13129,7 @@ Partial Class Compras_Compras
End Sub End Sub
Protected Sub BtnContado_Click(sender As Object, e As EventArgs) Protected Sub BtnContado_Click(sender As Object, e As EventArgs)
TxtRembolsoNumero.Text = TxtNumeroReembolso.Text TxtRembolsoNumero.Text = TxtNumeroReembolso.Text
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivContadoModal")) RegistraScript(String.Format("$('#{0}').modal('hide');", "DivContadoModal"))
End Sub End Sub
@@ -14379,18 +14312,18 @@ Partial Class Compras_Compras
'End Sub 'End Sub
Protected Sub BtnVinculaDevolucion_Click(sender As Object, e As EventArgs) Protected Sub BtnVinculaDevolucion_Click(sender As Object, e As EventArgs)
Try Try
Dim subtotaldevolucion As Decimal = 0 Dim subtotaldevolucion As Double = 0
Dim realizadevolucion As Boolean = False Dim realizadevolucion As Boolean = False
'Calculo los subtotales para comparar con la NC 'Calculo los subtotales para comparar con la NC
Dim cantidad As Decimal = 0 Dim cantidad As Double = 0.0
For Each Dr As GridViewRow In GVDevolucion.Rows For Each Dr As GridViewRow In GVDevolucion.Rows
cantidad = Dr.FCTextBox("TxtCantidad").Text.ToDecimal cantidad = Dr.FCTextBox("TxtCantidad").Text.ToDouble
If cantidad > 0 Then If cantidad > 0 Then
realizadevolucion = True realizadevolucion = True
subtotaldevolucion += Dr.DataKey("PU").ToString.ToDecimal * cantidad subtotaldevolucion += Dr.DataKey("PU").ToString.ToDouble * cantidad
End If End If
Next Next
@@ -14424,11 +14357,19 @@ Partial Class Compras_Compras
Dim IEPSCompra As Decimal = TxtIEPS.Text.ToDecimal() Dim IEPSCompra As Decimal = TxtIEPS.Text.ToDecimal()
Dim RetIVACompra As Decimal = TxtRetIVA.Text.ToDecimal() Dim RetIVACompra As Decimal = TxtRetIVA.Text.ToDecimal()
Dim RetISRCompra As Decimal = TxtRetISR.Text.ToDecimal() Dim RetISRCompra As Decimal = TxtRetISR.Text.ToDecimal()
Dim Acumulado As Decimal = 0 Dim Acumulado As Decimal = 0
'Dim TotalCalculable As Decimal = TotalCompra - IEPSCompra + RetIVACompra + RetISRCompra 'Dim TotalCalculable As Decimal = TotalCompra - IEPSCompra + RetIVACompra + RetISRCompra
Dim IVAPorcentajeCompra As Decimal = Math.Round((IVACompra / SubTotalCompra), 2) Dim IVAPorcentajeCompra As Decimal = Math.Round((IVACompra / SubTotalCompra), 2)
Dim Contador As Integer = 0
Dim Consec As Integer = 0
For Each gvr As GridViewRow In GVDevolucion.Rows
If gvr.FCTextBox("TxtCantidad").Text.ToDecimal > 0 Then
Contador += 1
End If
Next
'Iteramos el GridView de la OC 'Iteramos el GridView de la OC
For Each gvr As GridViewRow In GVDevolucion.Rows For Each gvr As GridViewRow In GVDevolucion.Rows
@@ -14455,12 +14396,16 @@ Partial Class Compras_Compras
Dim Descuento As Decimal = 0 Dim Descuento As Decimal = 0
Acumulado += (PU * Cantidad) Acumulado += (PU * Cantidad)
Consec += 1
If SubTotalCompra < Acumulado Then If Consec = Contador Then 'SubTotalCompra < Acumulado Then
'ajusta el valor 'ajusta el valor
Dim dif As Decimal = SubTotalCompra - Acumulado Dim dif As Decimal = SubTotalCompra - Acumulado
PU = ((PU * Cantidad) + dif) / Cantidad If dif <> 0 Then
Total = Cantidad * PU PU = ((PU * Cantidad) + dif) / Cantidad
Total = Cantidad * PU
End If
End If End If
AddPS(Cantidad, CveUM, UM, CveClasificacion, Clasificacion, CvePS, PS, CveTipoPS, CveSubProyectoContrato, SubProyecto, Proyecto, CveProyecto, Obs, PU, Total, IVA, 0, 0, 0, 0, Descuento, -1, False) AddPS(Cantidad, CveUM, UM, CveClasificacion, Clasificacion, CvePS, PS, CveTipoPS, CveSubProyectoContrato, SubProyecto, Proyecto, CveProyecto, Obs, PU, Total, IVA, 0, 0, 0, 0, Descuento, -1, False)
@@ -15330,7 +15275,7 @@ Partial Class Compras_Compras
'SI PUEDE RECIBIR POR OC Y COMPRA 'SI PUEDE RECIBIR POR OC Y COMPRA
' si usa almacen, si tiene activado que reciba por OC, y que si la compra tipo Proveedor. que lo muestre ' si usa almacen, si tiene activado que reciba por OC, y que si la compra tipo Proveedor. que lo muestre
If UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 AndAlso CveTipoConcepto = 1 Then If UsuarioActual.CveEmpresa = 119 AndAlso UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 AndAlso CveTipoConcepto = 1 Then
DivOCVinculaInv.Visible = True DivOCVinculaInv.Visible = True
End If End If
@@ -15372,7 +15317,7 @@ Partial Class Compras_Compras
'PROMOCIONES 'PROMOCIONES
LtOCPromocion.Text = StrPromos.ToString LtOCPromocion.Text = StrPromos.ToString
If LtOCPromocion.Text.Length > 0 And UsuarioActual.CveEmpresa.Contiene(119, 158) Then If LtOCPromocion.Text.Length > 0 And UsuarioActual.CveEmpresa = 119 Then
DivOCPromocion.Visible = True DivOCPromocion.Visible = True
End If End If
@@ -15646,6 +15591,12 @@ Partial Class Compras_Compras
'If DdlOCVinculaInv.SelectedValue.ToEntero = 237 And Not CveFlete > 0 Then Alert("Necesita vincular un flete si selecciona Factura de Flete", TipoMensaje.MsgAdvertencia) : Exit Sub 'If DdlOCVinculaInv.SelectedValue.ToEntero = 237 And Not CveFlete > 0 Then Alert("Necesita vincular un flete si selecciona Factura de Flete", TipoMensaje.MsgAdvertencia) : Exit Sub
'If DdlOCVinculaInv.SelectedValue.ToEntero = 240 And Not CveImportacion > 0 Then Alert("Necesita vincular una Importación si selecciona Factura de Importación", TipoMensaje.MsgAdvertencia) : Exit Sub 'If DdlOCVinculaInv.SelectedValue.ToEntero = 240 And Not CveImportacion > 0 Then Alert("Necesita vincular una Importación si selecciona Factura de Importación", TipoMensaje.MsgAdvertencia) : Exit Sub
'If UsuarioActual.CveEmpresa = 119 And DdlTipoComprobante.SelectedValue = "Fac" Then
' If Not VerificarProductosCompraConOC() Then
' Exit Sub
' End If
'End If
Dim SubTotalGV = 0.0D Dim SubTotalGV = 0.0D
Dim Amortizacion As Decimal = TmpDT.SUMD("Total") Dim Amortizacion As Decimal = TmpDT.SUMD("Total")
If ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 Then If ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 Then
@@ -15708,7 +15659,7 @@ Partial Class Compras_Compras
'SI PUEDE RECIBIR POR OC Y COMPRA 'SI PUEDE RECIBIR POR OC Y COMPRA
If UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 AndAlso CveTipoConcepto = 1 Then If UsuarioActual.CveEmpresa = 119 AndAlso UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 AndAlso CveTipoConcepto = 1 Then
If DdlOCVinculaInv.SelectedValue.ToEntero <= 0 Then If DdlOCVinculaInv.SelectedValue.ToEntero <= 0 Then
Alert("El campo <b>Tipo de recepción almacén</b> es necesario. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Alert("El campo <b>Tipo de recepción almacén</b> es necesario. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
@@ -16699,19 +16650,12 @@ Partial Class Compras_Compras
Protected Sub DdlTipoComprobante_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlTipoComprobante_SelectedIndexChanged(sender As Object, e As EventArgs)
LiAccionesContratos.Visible = False
If DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then If DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then
If DdlTipoComprobante.SelectedValue = "NC" Then If DdlTipoComprobante.SelectedValue = "NC" Then
DivReembolso.Visible = False DivReembolso.Visible = False
RBLPago.Items(2).Enabled = False RBLPago.Items(2).Enabled = False
If Not CveCompra > 0 Then
LiAccionesContratos.Visible = True
End If
Else Else
DivReembolso.Visible = True DivReembolso.Visible = True
RBLPago.Items(2).Enabled = True RBLPago.Items(2).Enabled = True
@@ -16735,8 +16679,6 @@ Partial Class Compras_Compras
End If End If
UpAccionesContratos.Update()
UPCondicionesPago.Update() UPCondicionesPago.Update()
End Sub End Sub
@@ -17380,7 +17322,7 @@ Partial Class Compras_Compras
LblAmortizacion.Text = "0.00" LblAmortizacion.Text = "0.00"
End If End If
If UsuarioActual.CveEmpresa.Contiene(119, 158) AndAlso TieneAmortizacion Then If UsuarioActual.CveEmpresa = 119 AndAlso TieneAmortizacion Then
Amortizacion = LblAmortizacion.Text.Trim.ToDecimal Amortizacion = LblAmortizacion.Text.Trim.ToDecimal
TxtSubTotal.Text = (TxtSubTotal.Text.ToDouble + Amortizacion).ToString TxtSubTotal.Text = (TxtSubTotal.Text.ToDouble + Amortizacion).ToString
End If End If
@@ -18971,7 +18913,7 @@ Partial Class Compras_Compras
CargaAnticipos(CveProveedor, If(ChkNCInv.Checked, "NC", "-1")) CargaAnticipos(CveProveedor, If(ChkNCInv.Checked, "NC", "-1"))
UpAnticipos.Update() UpAnticipos.Update()
End Sub End Sub
Private Sub CargaNCINV() Private Sub CargaNCINV()
Dim SaldoAnticipo = 0.0 Dim SaldoAnticipo = 0.0
Dim CveCompras As String = "" Dim CveCompras As String = ""
@@ -19108,7 +19050,7 @@ Partial Class Compras_Compras
GuardaAnticipos(Nothing, Nothing) GuardaAnticipos(Nothing, Nothing)
End Sub End Sub
Protected Sub BtnNCInvAlmacen_Click(sender As Object, e As EventArgs) Protected Sub BtnNCInvAlmacen_Click(sender As Object, e As EventArgs)
'Dim ObjCompras As New ClsCompras 'Dim ObjCompras As New ClsCompras
'Dim ObjConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL) 'Dim ObjConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL)
@@ -19756,8 +19698,8 @@ Partial Class Compras_Compras
Dim Multiplicador = If(DdlTipoComprobante.SelectedValue = "NC", -1, 1) Dim Multiplicador = If(DdlTipoComprobante.SelectedValue = "NC", -1, 1)
If DdlMoneda.SelectedValue.ToString.ToEntero = 2 Then If DdlMoneda.SelectedValue.ToString.ToEntero = 2 Then
'tipoCambioActual = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString.ToDecimal tipoCambioActual = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString.ToDecimal
tipoCambioActual = TxtTC.Text.ToDecimal tipoCambioActual = If(DivTC.Visible, TipoCambio.ToDecimal, tipoCambioActual)
Else Else
tipoCambioActual = 1 tipoCambioActual = 1
End If End If
@@ -20601,184 +20543,6 @@ Partial Class Compras_Compras
Return True Return True
End Function End Function
'Private Sub CargaContratos()
' DdlContrato.DataSource = GlobalDTContratos.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveContratoTipo IN(30,31) ")
' DdlContrato.DataBind()
' DdlContrato.Items.Insert(0, New System.Web.UI.WebControls.ListItem("Todos", "-1"))
'End Sub
'Protected Sub BtnModalContratos_Click(sender As Object, e As EventArgs)
' RegistraScript("$('#DvModalContratos').modal('hide');")
' CveContratoObra = DdlContrato.SelectedValue.ToEntero
'End Sub
Protected Sub LnkContratos_Click(sender As Object, e As EventArgs)
'RegistraScript("$('#DvModalContratos').modal('show');")
DdlContratosObra.Items.Clear()
DdlContratosObra.DataSource = GlobalDTContratos.FiltraParametros(String.Format($"CveContratoTipo in (30,31) AND CveEmpresa = {UsuarioActual.CveEmpresa}"))
DdlContratosObra.DataBind()
'DdlContratosObra.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlTipoGastoObra.Items.Clear()
DdlTipoGastoObra.DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa)
DdlTipoGastoObra.DataBind()
DdlTipoGastoObra.Items.Insert(0, New ListItem("Seleccione", "-1"))
RegistraScript($"$('#DivmodalConmtrato').modal('show'); $( '#BtnAplicarContrato' ).prop( 'disabled', true ); ValidaBotonContrato({TxtSubTotal2.Text.ToDecimal});")
UpModalContrato.Update()
End Sub
Protected Sub DdlContratosCompras_SelectedIndexChanged(sender As Object, e As EventArgs)
If DdlContratosObra.SelectedValue.ToEntero > 0 Then
Dim ObjContratos As New ClsContratos()
If ObjContratos.GetContratosObraCompras(DdlContratosObra.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
If ObjContratos.DtResultados.Rows.Count > 0 Then
GvContratosControl.DataSource = ObjContratos.DtResultados
'BtnAplicarContrato.Visible = True
Else
GvContratosControl.DataSource = Nothing
'BtnAplicarContrato.Visible = False
End If
End If
ObjContratos.Dispose()
GvContratosControl.DataBind()
UpModalContrato.Update()
End If
RegistraScript("$( '#BtnAplicarContrato' ).prop( 'disabled', true );")
End Sub
Protected Sub BtnAplicarContrato_Click(sender As Object, e As EventArgs)
TmpDT.Rows.Clear()
Dim CveTipoGastoObra As Integer = DdlTipoGasto.SelectedValue.ToEntero
For Each GvRow As GridViewRow In GvContratosControl.Rows
Dim CveContratoDetalle As Integer = GvRow.DataKey("CveContratoDetalle").ToEntero
Dim Cantidad As Double = GvRow.FCTextBox("TxtCantidad").Text.ToDouble
Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero
Dim PS As String = GvRow.DataKey("PS")
Dim PU As Double = GvRow.FCTextBox("TxtPU").Text.ToDouble
Dim TotalPS As Double = GvRow.FCTextBox("TxtImporte").Text.ToDouble
Dim CveUnidadMedida As Integer = GvRow.DataKey("CveUnidadMedida").ToEntero
Dim UMAbreviatura As String = GvRow.DataKey("Abreviatura").ToString
Dim SubProyecto As String = GvRow.DataKey("SubProyecto")
Dim CveSubProyecto As Integer = GvRow.DataKey("CveSubProyecto").ToEntero
Dim Codigo As String = "" 'GvRow.DataKey("Codigo")
Dim Proyecto As String = GvRow.DataKey("Proyecto")
Dim CveProyecto As Integer = GvRow.DataKey("CveProyecto").ToEntero
Dim RetISR As Double = GvRow.DataKey("RetISR").ToString.ToDouble
Dim RetIVA As Double = MAXRetIVAPorcentaje 'GvRow.DataKey("RetIVA").ToString.ToDouble
Dim IvaPS As Double = MaxIVAProcentaje
Dim CveClasificacion As Integer = GvRow.DataKey("CveClasificacion").ToString.ToEntero
Dim Clasificacion As String = GvRow.DataKey("Clasificacion")
Dim IEPSPS As Double = GvRow.DataKey("IEPSPorcentaje").ToString.ToDouble
Dim IEPSPSIVA As Double = If(GvRow.DataKey("IEPSGrabaIVA").ToString = "True", IEPSPS, 0)
Dim CveTipoPS As Integer = GvRow.DataKey("CveTipoPS").ToEntero
Dim CveSATPS As Integer = GvRow.DataKey("CveSATPS").ToEntero
Dim IdCuentaPorEjercer As Integer = -1
Dim IdCuentaComprometido As Integer = -1
Dim TotalRow As Decimal = (PU * Cantidad).RoundSQL(2).ToDecimal
If Cantidad > 0 Then
AddPS(Cantidad, CveUnidadMedida, UMAbreviatura, CveClasificacion, Clasificacion, CvePS, PS, CveTipoPS, CveSubProyecto.ToString, SubProyecto, Proyecto, CveProyecto.ToString, "", PU, TotalRow, IvaPS, RetIVA, RetISR, IEPSPS, IEPSPSIVA, 0, -1, False,
CantidadF:=0, EntregaDirecta:=0, CveSATPS:=CveSATPS, CveTipoGasto:=DdlTipoGastoObra.SelectedValue.ToEntero, TipoGasto:=DdlTipoGastoObra.SelectedItem.Text, CveContratoDetalle:=CveContratoDetalle, CveCultivoCuadroDetalle:=-1)
'AddPS(Cantidad, CvePS, PS, PS, PU, 0, TotalPS,
'CveUnidadMedida, IvaPS, IEPSPS, IEPSPSIVA, CveClasificacion, UMAbreviatura, Clasificacion, CveProyecto, Proyecto,
'CveSubProyecto, SubProyecto, Codigo, -1, 0, -1, -1, IdCuentaPorEjercer,
'IdCuentaComprometido, -1, -1, -1, -1,
'-1, RetIVA, RetISR, CveContratoDetalle:=CveContratoDetalle, CveTipoGastoObra:=CveTipoGastoObra, CveCultivoCuadroDetalle:=-1, Cuadro:="")
'' ContratoObraAplciado = True
End If
Next
'CargaSuperior()
'CargaDatosDetalles()
GvPS.DataSource = TmpDT
GvPS.DataBind()
UpPS.Update()
RegistraScript("$('#DivmodalConmtrato').modal('hide')")
' UPPDetalle.Update()
End Sub
Private Sub GvContratosControl_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvContratosControl.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim CveContratoDetalle As Integer = e.Row.DataKey("CveContratoDetalle").ToEntero
e.Row.FCTextBox("TxtCantidad").CssClass = $"CssCantidad{CveContratoDetalle}"
e.Row.FCTextBox("TxtCantidad").Attributes.Add("onkeyup", $"ValidateCant('{CveContratoDetalle}',{TxtSubTotal2.Text.ToDecimal})")
e.Row.FCTextBox("TxtPU").CssClass = $"CssPU{CveContratoDetalle}"
e.Row.FCTextBox("TxtPU").Attributes.Add("onkeyup", $"ValidateCant('{CveContratoDetalle}',{TxtSubTotal2.Text.ToDecimal})")
e.Row.FCTextBox("TxtImporte").CssClass = $"ImporteCSS CssImporte{CveContratoDetalle}"
End If
End Sub
Protected Sub TabModoNC_ActiveTabChanged(sender As Object, e As EventArgs) Protected Sub TabModoNC_ActiveTabChanged(sender As Object, e As EventArgs)
Select Case TabModoNC.ActiveTabIndex Select Case TabModoNC.ActiveTabIndex
Case 0 Case 0
@@ -20793,6 +20557,18 @@ Partial Class Compras_Compras
UpFooterFacturaNC.Update() UpFooterFacturaNC.Update()
End Sub End Sub
Protected Sub LnkContratos_Click(sender As Object, e As EventArgs)
End Sub
Protected Sub DdlContratosObra_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub
Protected Sub BtnAplicarContrato_Click(sender As Object, e As EventArgs)
End Sub
End Class End Class
Public Class MMensajeDevolucion Public Class MMensajeDevolucion