This commit is contained in:
2021-03-19 09:50:55 -07:00
18 changed files with 1455 additions and 683 deletions

View File

@@ -1405,6 +1405,7 @@ Partial Class Clientes
Dim RetSC As Boolean = CargaSucursalesCliente()
Dim RetCC As Boolean = CargaCotizaciones()
CargaHistorial()
CargaResumenHistorial()
Dim RetCxC As Boolean = CargaCxC()
CargaAnticipos()
CargaPersonalAsignado()
@@ -1799,14 +1800,9 @@ Partial Class Clientes
Private Sub CargaHistorial(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1)
Dim ObjClientes As New ClsClientes()
If ObjClientes.GetHistorialVentas(CveCliente, SelectTop, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
If ObjClientes.DtResultados.Rows.Count > 0 Then
'Carga Generales
LtlCantidad.Text = ObjClientes.DtResultados.Rows(0)("CountTotal").ToString().FormatoNumero()(0)
LtlTotalVendido.Text = ObjClientes.DtResultados.Rows(0)("Total").ToString().FormatoNumero()(2)
LtlMinima.Text = ObjClientes.DtResultados.Rows(0)("MIN_Total").ToString().FormatoNumero()(2)
LtlPromedio.Text = ObjClientes.DtResultados.Rows(0)("AVG_Total").ToString().FormatoNumero()(2)
LtlMaxima.Text = ObjClientes.DtResultados.Rows(0)("MAX_Total").ToString().FormatoNumero()(2)
'Carga Grid
If ObjClientes.DtResultados.Rows.Count > 0 Then
'Carga Grid
DTHistorialVentas = ObjClientes.DtResultados
GVHistorial.DataSource = ObjClientes.DtResultados
Else
@@ -7981,7 +7977,11 @@ Partial Class Clientes
Dim Row2 As DataRow = Nothing
Row2 = Dt2.NewRow()
LtlLimiteCreditoModal.Text = LimiteCredito.FormatoNumero()
Row2("limite") = LimiteCredito - Saldo
If LimiteCredito > 0 Then
Row2("limite") = LimiteCredito - Saldo
Else
Row2("limite") = 0
End If
Row2("saldo") = Saldo
Dt2.Rows.Add(Row2)
Dim query2 = From s In Dt2.AsEnumerable() Select New With {.year = "", .limite = s("limite").ToString(), .saldo = s("saldo").ToString()}
@@ -10309,5 +10309,44 @@ Partial Class Clientes
UpDatos.Update()
End Sub
Private Sub CargaResumenHistorial()
Dim ObjClientes As New ClsClientes()
If ObjClientes.GetHistorialVentas(CveCliente, -1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
If ObjClientes.DtResultados.Rows.Count > 0 Then
Dim Cantidad As Double
Dim Max As Double
Dim Min As Double = 1000000000000
Dim Total As Double
Dim Promedio As Double
For Each row As DataRow In ObjClientes.DtResultados.Rows
If row.Item("Folio").ToString <> "" Then
If row.Item("Total").ToString.ToDouble > Max Then
Max = row.Item("Total").ToString.ToDouble
End If
If row.Item("Total").ToString.ToDouble < Min And row.Item("Total").ToString.ToDouble > 0 Then
Min = row.Item("Total").ToString.ToDouble
End If
Total += row.Item("Total").ToString.ToDouble
Cantidad += 1
End If
Next
Promedio = Total / Cantidad
'Carga Generales
LtlCantidad.Text = Cantidad.ToString.FormatoNumero(0)
LtlTotalVendido.Text = Total.ToString.FormatoNumero()
LtlMinima.Text = Min.ToString.FormatoNumero()
LtlPromedio.Text = Promedio.ToString.FormatoNumero()
LtlMaxima.Text = Max.ToString.FormatoNumero()
End If
End If
ObjClientes.Dispose()
End Sub
End Class

View File

@@ -1663,12 +1663,12 @@ Partial Class ProductosyServicios
If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then
e.Row.FCDropDownList("DdlPSAdicional").DataSource = GlobalDTPS(UsuarioActual.CveEmpresa) '.FiltraParametros("CvePS = " + CvePS.ToString)
e.Row.FCDropDownList("DdlPSAdicional").DataBind()
e.Row.FCDropDownList("DdlPSAdicional").SelectedValue = e.Row.DBCampo("CvePSAdicional")
End If
e.Row.FCDropDownList("DdlPSAdicional").DataSource = GlobalDTPS(UsuarioActual.CveEmpresa) '.FiltraParametros("CvePS = " + CvePS.ToString)
e.Row.FCDropDownList("DdlPSAdicional").DataBind()
e.Row.FCDropDownList("DdlPSAdicional").SelectedValue = e.Row.DBCampo("CvePSAdicional")
End If
End If
End Sub
Protected Sub GvPSAdicionales_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvPSAdicionales.RowCancelingEdit
GvPSAdicionales.EditIndex = -1
@@ -2923,7 +2923,7 @@ Partial Class ProductosyServicios
Else
If ObjPS.GetPS(-1, -1, CveEmpresaFranquicia, Codigo:=TxtCodigo.Text.Trim.ToUpper) Then
Dim CvePS As Integer = ObjPS.DtResultados.FiltroPrimeroValor("CvePS").ToEntero()
Dim CvePS As Integer = ObjPS.DtResultados.FiltroPrimeroValor("CvePS", String.Format(" Codigo = '{0}'", TxtCodigo.Text.Trim.ToUpper)).ToEntero()
If Not ObjPS.UpdatePS(CveClasificacion, -1, CveUnidadMedida, TxtCodigo.Text.Trim, txtcodigo2.text.trim, TxtCodigoBarras.Text.Trim, PSS, TxtPrecio.Text.Trim.ToDouble, DdlIVA.SelectedValue.ToDouble,
(TxtRetIVA.Text.Trim.ToDouble / 100), ChkInventariable.Checked, -1, True, ChkAplicaParaVenta.Checked, ChkEstado.Checked, UsuarioActual.CveUsuario, CvePS, CveMetodoInv,
EsPaquete, DdlSATPS.SelectedValue.ToEntero, CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero, TipoServicio:=-1, CveClasificacion2:=CveClasificacion2, CveMarca:=CveMarcaFranquicia,

View File

@@ -463,7 +463,7 @@ Partial Class Ventas_Promociones
For Each Dr As DataRow In TempDT.FiltraParametros("Estatus = 0").Rows
If Not ObjVentas.AddPromocionesDetalle(CvePromocion, Dr("CvePS").ToString.ToEntero, Dr("CveTipoPromocion").ToString.ToEntero, Dr("Promocion").ToString.ToDouble, Dr("PUAnterior").ToString.ToDouble, Dr("PUPromocion").ToString.ToDouble,
CBool(Dr("AplicaRestriccion")), CBool(Dr("AplicaLunes")), CBool(Dr("AplicaMartes")), CBool(Dr("AplicaMiercoles")), CBool(Dr("AplicaJueves")), CBool(Dr("AplicaViernes")), CBool(Dr("AplicaSabado")), CBool(Dr("AplicaDomingo")),
Dr("HoraInicio").ToString.ToDateTime, Dr("HoraFin").ToString.ToDateTime, Dr("CantidadMinima").ToString.ToEntero, CveClasificacion:=If(Dr("CvePS").ToString = "-1", Dr("CveClasificacion").ToString.ToEntero, -1), IncluyeImpuestos:=ChkIncluyeImpuesto.Checked) Then
Dr("HoraInicio").ToString.ToDateTime, Dr("HoraFin").ToString.ToDateTime, Dr("CantidadMinima").ToString.ToEntero, CveClasificacion:=If(Dr("CvePS").ToString = "-1", Dr("CveClasificacion").ToString.ToEntero, -1), CveRinTamaño:=Dr("CveRinTamaño").ToString.ToEntero, IncluyeImpuestos:=ChkIncluyeImpuesto.Checked) Then
TieneError = True
Exit For
End If
@@ -473,7 +473,7 @@ Partial Class Ventas_Promociones
For Each Dr As DataRow In TempDT.FiltraParametros("Estatus = 1").Rows
If Not ObjVentas.UpdatePromocionesDetalle(Dr("CvePromocionDetalle").ToString.ToEntero, CvePromocion, Dr("CvePS").ToString.ToEntero, Dr("CveTipoPromocion").ToString.ToEntero, Dr("Promocion").ToString.ToDouble, Dr("PUAnterior").ToString.ToDouble, Dr("PUPromocion").ToString.ToDouble,
CBool(Dr("AplicaRestriccion")), CBool(Dr("AplicaLunes")), CBool(Dr("AplicaMartes")), CBool(Dr("AplicaMiercoles")), CBool(Dr("AplicaJueves")), CBool(Dr("AplicaViernes")), CBool(Dr("AplicaSabado")), CBool(Dr("AplicaDomingo")),
Dr("HoraInicio").ToString.ToDateTime, Dr("HoraFin").ToString.ToDateTime, Dr("CantidadMinima").ToString.ToEntero, CveClasificacion:=If(Dr("CvePS").ToString = "-1", Dr("CveClasificacion").ToString.ToEntero, -1), IncluyeImpuestos:=ChkIncluyeImpuesto.Checked) Then
Dr("HoraInicio").ToString.ToDateTime, Dr("HoraFin").ToString.ToDateTime, Dr("CantidadMinima").ToString.ToEntero, CveClasificacion:=If(Dr("CvePS").ToString = "-1", Dr("CveClasificacion").ToString.ToEntero, -1), CveRinTamaño:=Dr("CveRinTamaño").ToString.ToEntero, IncluyeImpuestos:=ChkIncluyeImpuesto.Checked) Then
TieneError = True
Exit For
End If

View File

@@ -5345,6 +5345,7 @@ Partial Class Ventas
UPCondicionesPago.Visible = True
UpCliente.Visible = False
UpEmpresaCRM.Visible = True
End If
DdlVendedor.SelectedValueExist(ObjCRM.DtResultados.Rows(0)("CveVendedorAsignado").ToString())
@@ -12991,7 +12992,7 @@ Partial Class Ventas
If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) Then
DtCostos = ObjInventario.DtResultados
TotalCosto = DtCostos.SUMD("Total").RoundAD
TotalCosto = DtCostos.SUMD("Total").RoundSQL
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
Dim IdCtaContable As Integer = 0
Dim CveCuenta As Integer = 0
@@ -13002,7 +13003,7 @@ Partial Class Ventas
Dim cont As Integer = 1
'Se agrega movimiento separado por la cuenta de ventas (ER)
For Each RowInv As DataRow In tmpCostos.Rows
ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundAD
ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundSQL
TotalCostoAcumulado += ValorInventario
'cuando es el último movimiento y hay diferencias en los importes
@@ -15146,7 +15147,7 @@ Partial Class Ventas
Dim ValorInventario As Decimal = 0
For Each RowInv As DataRow In tmpCostos.Rows
ValorInventario = DTMovimientosDetalles.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundAD()
ValorInventario = DTMovimientosDetalles.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL()
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
@@ -15170,7 +15171,7 @@ Partial Class Ventas
End If
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {ddlAlmacen.SelectedValue}").ToEntero()
ValorInventario = DTMovimientosDetalles.SUMD("Total", $"CveMovimiento = {Mov("CveMovimiento")}").RoundAD()
ValorInventario = DTMovimientosDetalles.SUMD("Total", $"CveMovimiento = {Mov("CveMovimiento")}").RoundSQL()
If ValorInventario <> 0 Then
'Entrada
@@ -16367,6 +16368,11 @@ Partial Class Ventas
Dim TipoAplicacion As Integer = 1 ' 1 - descuento, 2 en PU
Dim ObjDescuento As New Descuentos
If DdlSubProyectoDatos.SelectedValue = "11842" Then '' E141, el subproyecto: Franquicia, no proceden las promociones
Return ObjDescuento
End If
Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DrPS IsNot Nothing Then
@@ -16382,11 +16388,11 @@ Partial Class Ventas
Dim dr As DataRow = Nothing
If DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then
dr = DtPromociones.FiltroPrimero(String.Format("CvePS = {0} AND (CveSubProyecto = {1} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {2} OR CveRinTamaño IS NULL)", CvePS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS))
dr = DtPromociones.FiltroPrimero(String.Format("CvePS = {0} AND (CveSubProyecto = {1} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {2} OR CveRinTamaño IS NULL) AND (TipoPromocion <> 3 OR (TipoPromocion = 3 AND CantidadMinima <= {3} ))", CvePS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, TxtCantidad.Text), Orderby:="CantidadMinima desc ")
If dr Is Nothing Then
'verifica marca, si tiene asignada la promocion
dr = DtPromociones.FiltroPrimero(String.Format("CveClasificacion = {0} AND (CveMarca = {1} OR CveMarca IS NULL) AND (CveSubProyecto = {2} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {2} OR CveRinTamaño IS NULL)", CveClasifPS, CveMarcaPS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS))
dr = DtPromociones.FiltroPrimero(String.Format("CveClasificacion = {0} AND (CveMarca = {1} OR CveMarca IS NULL) AND (CveSubProyecto = {2} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {3} OR CveRinTamaño IS NULL) AND (TipoPromocion <> 3 OR (TipoPromocion = 3 AND CantidadMinima <= {4} )) ", CveClasifPS, CveMarcaPS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, TxtCantidad.Text), Orderby:="CantidadMinima desc")
End If
End If
@@ -18415,10 +18421,10 @@ Partial Class Ventas
Dim ValorInventario As Decimal
Dim TotalCostoAcumulado As Decimal = 0D
Dim Cont As Integer = 1
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundAD
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL
For Each RowInv As DataRow In DtCostosDistinct.Rows
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundAD
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
TotalCostoAcumulado += ValorInventario
@@ -18498,7 +18504,7 @@ Partial Class Ventas
Return Not OcurrioError
End If
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundAD
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL
If CvePrePoliza <= 0 Then
GenerarPrePolizaNueva = True
@@ -18511,7 +18517,7 @@ Partial Class Ventas
End If
For Each RowInv As DataRow In DtCostosDistinct.Rows
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundAD
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
TotalCostoAcumulado += ValorInventario
@@ -18652,10 +18658,10 @@ Partial Class Ventas
Dim ValorInventario As Decimal
Dim TotalCostoAcumulado As Decimal = 0D
Dim Cont As Integer = 1
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundAD
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL
For Each RowInv As DataRow In DtCostosDistinct.Rows
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundAD
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
TotalCostoAcumulado += ValorInventario
@@ -18769,10 +18775,10 @@ Partial Class Ventas
Dim ValorInventario As Decimal
Dim TotalCostoAcumulado As Decimal = 0D
Dim Cont As Integer = 1
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundAD
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL
For Each RowInv As DataRow In DtCostosDistinct.Rows
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundAD
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
TotalCostoAcumulado += ValorInventario