Exemplo n.º 1
0
        //--------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>Llena el Grid con los pagos realizados</summary>
        private void FillGridCompras()
        {
            var sFilter = txtFilter.Text.ToLower().Trim();

            tbCompras.Clear();
            foreach (ComprasRow row in Datos.tableCompras)
            {
                if (Datos.FilterProd(row.id))
                {
                    continue;
                }

                var sItem = row.item;

                if (chkShowComent.Checked && !row.IscomentarioNull() && row.comentario.Trim().Length > 0)
                {
                    sItem = sItem + " | " + row.comentario;
                }

                if (sFilter.Length > 0 && !sItem.ToLower().Contains(sFilter))
                {
                    continue;
                }

                tbCompras.Rows.Add(row.id, sItem, row.count, row.value, row.valItem, row.valCUC, row.valCucItem);
            }

            SumaCostos();
        }
Exemplo n.º 2
0
        //--------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>Llena el Grid con los pagos realizados</summary>
        private void FillGridPagos()
        {
            var VendId   = cbFilter.SelectedIndex;
            var VendName = cbFilter.Text;
            var sFilter  = txtFilter.Text.ToLower().Trim();

            tbPagos.Clear();
            foreach (PagosRow row in Datos.tablePagos)
            {
                var IdVent = row.idVent;
                if (Datos.FilterVenta(IdVent) || Datos.FilterPago(row.id))
                {
                    continue;
                }

                var sItem = "Nombre del Item sin determinar";
                var sVend = "Desconcido";
                var sPrec = "";

                var rowVent = Datos.tableVentas.FindByid(IdVent);
                if (rowVent != null)
                {
                    var idProd = rowVent.idProd;
                    if (Datos.FilterProd(idProd))
                    {
                        continue;
                    }

                    var rowProd = Datos.tableCompras.FindByid(idProd);
                    if (rowProd != null)
                    {
                        sItem = rowProd.item;
                    }

                    sVend = rowVent.vendedor;
                    sPrec = rowVent.precio.ToString("0.##") + ' ' + Money.Code((Mnd)rowVent.moneda);
                }

                if (chkShowComent.Checked && !row.IscomentarioNull() && row.comentario.Trim().Length > 0)
                {
                    sItem += " | " + row.comentario + ' ';
                }

                if (sFilter.Length > 0 && !sItem.ToLower().Contains(sFilter))
                {
                    continue;
                }

                if (VendId == 0 || sVend == VendName)
                {
                    tbPagos.Rows.Add(row.id, IdVent, sItem, sVend, row.count, sPrec, row.cuc, row.cup, row.comentario, row.fecha);
                }
            }

            RefreshEstadisticas();
        }
Exemplo n.º 3
0
        //--------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>Llena el Grid con las compras disponibles</summary>
        private void FillGridCompras()
        {
            var ratioRecp = 1m;

            if (Datos.CompasCUC != 0)
            {
                ratioRecp = Datos.MontoInvers / Datos.CompasCUC; // Relación entre en monto de la inversión y el de las compras
            }
            var sFilter = txtFilter.Text.ToLower().Trim();

            tbCompras.Clear();
            foreach (ComprasRow row in table)
            {
                if (Datos.FilterProd(row.id))
                {
                    continue;
                }
                RowCalculate(row);

                var sItem = row.item;

                if (chkShowComent.Checked && !row.IscomentarioNull() && row.comentario.Trim().Length > 0)
                {
                    sItem = sItem + " | " + row.comentario;
                }

                if (sFilter.Length > 0 && !sItem.ToLower().Contains(sFilter))
                {
                    continue;
                }

                var sPrecio = row.precio.ToString("0.##");
                if (nowPrec != 0)
                {
                    sPrecio += ' ' + Money.Code(nowMond);
                }

                decimal PrecCUC = Money.Convert(row.precio, nowMond, Mnd.Cuc);
                decimal rawRate = 100;
                if (row.valCucItem != 0)
                {
                    rawRate = PrecCUC / row.valCucItem;
                }

                tbCompras.Rows.Add(row.id, sItem, row.count, row.valCUC, row.valCucItem, sPrecio, nowMonto, rawRate, nowGanc);
//        tbCompras.Rows.Add( row.id, sItem, row.count, row.valCUC, row.valCucItem, sPrecio, nowMonto, nowRate, nowGanc );
            }

            Sumatorias();
        }
Exemplo n.º 4
0
        //--------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>Llena el Grid con la ventas que faltan por pagar</summary>
        private void FillGridVentas()
        {
            var VendTxt = cbVendedor.Text;
            var VendIdx = cbVendedor.SelectedIndex;
            var ShowAll = chkShowAll.Checked;
            var sFilter = txtFilterPago.Text.ToLower().Trim();

            tbSelVent.Clear();
            decimal porPagarCuc = 0, porPagarCup = 0;;

            foreach (VentasRow row in Datos.tableVentas)
            {
                if (VendIdx > 0 && VendTxt != row.vendedor)
                {
                    continue;
                }
                if (Datos.FilterVenta(row.id) || Datos.FilterProd(row.idProd))
                {
                    continue;
                }

                var precio = row.precio;
                var Pagado = GetPagado(row);
                var Monto  = row.count * precio;

                if (!ShowAll && Pagado >= Monto)
                {
                    continue;
                }

                var sItem   = "No se encontro el Item";
                var rowProd = Datos.tableCompras.FindByid(row.idProd);
                if (rowProd != null)
                {
                    sItem = rowProd.item;
                }

                if (!row.IscomentarioNull() && row.comentario.Trim().Length > 0)
                {
                    sItem += " | " + row.comentario;
                }

                if (sFilter.Length > 0 && !sItem.ToLower().Contains(sFilter))
                {
                    continue;
                }

                var ItemPago = 0m;
                if (precio != 0)
                {
                    ItemPago = Pagado / precio;
                }

                var Moned   = (Mnd)row.moneda;
                var sPrecio = precio.ToString("0.##") + ' ' + Money.Code(Moned);

                var sPagado = "";
                if (Pagado > 0)
                {
                    sPagado = Pagado.ToString("0.##") + ' ' + Money.Code(Moned) + " = " + ItemPago.ToString("0.##");
                }

                var resto = row.count - ItemPago;

                var porPagar = resto * precio;
                if (Moned == Mnd.Cuc)
                {
                    porPagarCuc += porPagar;
                }
                else if (Moned == Mnd.Cup)
                {
                    porPagarCup += porPagar;
                }
                else
                {
                    porPagarCuc += Money.Convert(porPagar, Moned, Mnd.Cuc);
                }

                Monto = resto * precio;
                var sCant = resto.ToString("0.#");
                if (resto != row.count)
                {
                    sCant += " / " + row.count;
                }

                tbSelVent.Rows.Add(row.id, sItem, row.vendedor, sCant, sPrecio, Monto, sPagado);
            }

            var sCuc = porPagarCuc.ToString("0.##");
            var sCup = porPagarCup.ToString("0.##");

            porPagarCuc += Money.Convert(porPagarCup, Mnd.Cup, Mnd.Cuc);
            var sTotal = porPagarCuc.ToString("0.##");

            lbPorPagar.Text = "POR PAGAR: " + sCuc + " cuc    " + sCup + " mn    TOTAL:" + sTotal + " cuc";
        }
Exemplo n.º 5
0
        //--------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>Actualiza la lista de venta de acuerdo a los criterios de busqueda</summary>
        private void UpdateVentas()
        {
            decimal PagadoTotal = 0;

            tbVentas.Clear();

            var ShowVendedor = cbFilter.Text;
            var sFilter      = txtFilter.Text.ToLower().Trim();

            var consumo = Datos.Vendedores[0];

            foreach (DBViaje.VentasRow row in Datos.tableVentas)
            {
                if (Datos.FilterVenta(row.id) || Datos.FilterProd(row.idProd))
                {
                    continue;
                }

                var vendedor = row.vendedor;
                if (ShowVendedor != "Todas" && ShowVendedor != vendedor)
                {
                    continue;
                }

                var Monto = row.count * row.precio;
                if (row.count < 0 && Monto > 0)
                {
                    Monto = -Monto;
                }

                var sMoneda = Money.Code((Mnd)row.moneda);

                var sItem   = "Nombre desconocido";
                var ItemRow = Datos.tableCompras.FindByid(row.idProd);
                if (ItemRow != null)
                {
                    sItem = ItemRow.item;
                }

                if (chkShowComent.Checked && !row.IscomentarioNull() && row.comentario.Trim().Length > 0)
                {
                    sItem += " | " + row.comentario + ' ';
                }

                var Pago = GetPagado(row);
                if (chkShowPagos.Checked)
                {
                    if (Pago > 0)
                    {
                        sItem += " | " + Pago + ' ' + sMoneda + ' ';
                    }
                }

                var pagado = (Pago >= Monto || vendedor == consumo || Monto == 0);

                if (sFilter.Length > 0 && !sItem.ToLower().Contains(sFilter))
                {
                    continue;
                }

                if (cbPagoState.SelectedIndex == 1 && !pagado)
                {
                    continue;
                }

                if (cbPagoState.SelectedIndex == 2 && pagado)
                {
                    continue;
                }

                tbVentas.Rows.Add(row.id, sItem, vendedor, row.count, row.precio, Monto, sMoneda, row.fecha);
                PagadoTotal += PagoCUC;
            }

            Grid.Refresh();

            RefreshEstadisticas();
            lbPagado.Text = PagadoTotal.ToString("0.00");
        }
Exemplo n.º 6
0
        //--------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>Llena la lista de selección de productos</summary>
        private void FillGridProds()
        {
            FillProd = true;
            tbSelProd.Clear();

            CalculateCounts();

            decimal porVenderCuc = 0, porVenderMn = 0;

            foreach (ComprasRow row in Datos.tableCompras)
            {
                var idProd = row.id;
                if (Datos.FilterProd(idProd))
                {
                    continue;
                }

                var    Item     = row.item;
                var    Cant     = row.count;
                var    Precio   = row.precio;
                Mnd    Moned    = (Mnd)row.moneda;
                string MondCode = Money.Code(Moned);

                var Resto = Cant;
                if (Counts.ContainsKey(idProd))
                {
                    Resto -= Counts[idProd];
                }

                if (Resto > 0)
                {
                    var monto = Resto * Precio;
                    if (Moned == Mnd.Cuc)
                    {
                        porVenderCuc += monto;
                    }
                    else if (Moned == Mnd.Cup)
                    {
                        porVenderMn += monto;
                    }
                    else
                    {
                        porVenderCuc += Money.Convert(monto, Moned, Mnd.Cuc);
                    }
                }

                var sCant = Resto.ToString() + '/' + Cant;
                if (Resto > 0 || chkShowNoExist.Checked)
                {
                    tbSelProd.Rows.Add(idProd, Item, sCant, Precio, MondCode, Moned);
                }
            }

            var sCuc = porVenderCuc.ToString("0.##");
            var sCup = porVenderMn.ToString("0.##");

            porVenderCuc += Money.Convert(porVenderMn, Mnd.Cup, Mnd.Cuc);
            var sTotal = porVenderCuc.ToString("0.##");

            lbPorVender.Text = "POR VENDER: " + sCuc + " cuc     " + sCup + " mn     TOTAL:" + sTotal + " cuc";
            FillProd         = false;
        }