diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index a31f5707c..80259f113 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -4289,7 +4289,7 @@ diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 44392143f..e6660992f 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -9511,51 +9511,55 @@ Partial Class Clientes End Function Private Sub CreaObjetosVenta(Tipo As Integer) - - Dim SubTotal As Decimal = 0D - Dim IVA As Decimal = 0D + Dim CveSubProyecto As Integer = -1 + TmpDT.Rows.Clear() + TmpDT.AcceptChanges() + For Each GvRow As GridViewRow In GvAcum.Rows - If Tipo = 1 Then - If GvRow.DataKey("CveConcepto").ToEntero() = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then - SubTotal = SubTotal + GvRow.DataKey("ImporteCargo").ToDecimal() - End If - ElseIf Tipo = 2 Then - If GvRow.DataKey("CveConcepto").ToEntero() = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then - SubTotal = SubTotal + GvRow.DataKey("ImporteBonificacion").ToDecimal() - End If - End If - - CveSubProyecto = GvRow.DataKey("CveSubProyecto").ToEntero() + If GvRow.FCCheckBox("ChkBonificacion").Checked OrElse GvRow.FCCheckBox("ChkCargo").Checked Then + CveSubProyecto = GvRow.DataKey("CveSubProyecto").ToEntero() + + Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToDecimal + Dim PU As Decimal = 0 + Dim CvePSCargo As Integer = GvRow.DataKey("CvePSCargo").ToEntero() + Dim CveUnidadMedida As Integer = 0 + Dim CveClasificacion As Integer = 0 + Dim UnidadMedida As String = "" + Dim Clasificacion As String = "" + Dim PS As String = "" + Dim PorcentajeIVA As Decimal = 0.16D + + If Tipo = 1 Then + If GvRow.DataKey("CveConcepto").ToEntero() = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then + PU = GvRow.DataKey("Cargo").ToDecimal() + End If + ElseIf Tipo = 2 Then + If GvRow.DataKey("CveConcepto").ToEntero() = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then + PU = GvRow.DataKey("Bonificacion").ToDecimal() + End If + End If + + If CvePSCargo > 0 AndAlso PU > 0 Then + Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePSCargo).Rows(0) + If Dr IsNot Nothing Then + CveUnidadMedida = Dr("CveUnidadMedida").ToString().ToEntero() + CveClasificacion = Dr("CveClasificacion").ToString().ToEntero() + PS = Dr("PSCodigo").ToString() + UnidadMedida = Dr("UnidadMedida").ToString() + Clasificacion = Dr("Clasificacion").ToString() + End If + + AgregarProductoServicio(Cantidad, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePSCargo, PS, "Clientes/Usados", PU, 0, -1, "", DdlSubProyecto.SelectedValue.ToEntero(), + DdlSubProyecto.SelectedItem.Text, PorcentajeIVA:=PorcentajeIVA) + End If + End If + Next - Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero() 'CvePS Distruibuidor Bonificación Nota - Dim CveUnidadMedida As Integer = 0 - Dim CveClasificacion As Integer = 0 - Dim UnidadMedida As String = "" - Dim Clasificacion As String = "" - Dim PS As String = "" - Dim PorcentajeIVA As Decimal = 0D - If CvePS > 0 Then - If SubTotal > 0 Then - Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0) - If Dr IsNot Nothing Then - CveUnidadMedida = Dr("CveUnidadMedida").ToString().ToEntero() - CveClasificacion = Dr("CveClasificacion").ToString().ToEntero() - PS = Dr("PSCodigo").ToString() - UnidadMedida = Dr("UnidadMedida").ToString() - Clasificacion = Dr("Clasificacion").ToString() - End If - PorcentajeIVA = 0.16D - IVA = SubTotal * PorcentajeIVA - End If - End If - - TmpDT.Rows.Clear() - TmpDT.AcceptChanges() - AgregarProductoServicio(1, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "Clientes/Usados", SubTotal, 0, -1, "", DdlSubProyecto.SelectedValue.ToEntero(), - DdlSubProyecto.SelectedItem.Text, PorcentajeIVA:=PorcentajeIVA) + Dim SubTotalFactura As Decimal = TmpDT.SUMD("Total") + Dim IVAFactura As Decimal = TmpDT.SUMD("ImporteIVA") Dim Folio As Integer = -1 Dim Serie As String = "" @@ -9683,14 +9687,14 @@ Partial Class Clientes ObjFactura.Det_FechaOrdenCompra = "" ObjFactura.MonedaAbreviatura = "" - ObjFactura.SubTotal = SubTotal + ObjFactura.SubTotal = SubTotalFactura ObjFactura.Descuento = 0 ObjFactura.Amortizacion = 0 - ObjFactura.IVA = IVA + ObjFactura.IVA = IVAFactura ObjFactura.RetIVA = 0 ObjFactura.RetISR = 0 ObjFactura.IEPS = 0 - ObjFactura.Total = SubTotal + IVA + ObjFactura.Total = SubTotalFactura + IVAFactura ObjFactura.DtDetalle = TmpDT ObjFactura.DtPagos = DtPagos ObjFactura.DtPromociones = DtPromociones