Example #1
0
        public double GetImporteSenia(Int32 CodPreVenta)
        {
            double Importe = 0;

            Clases.cPreVenta pre  = new Clases.cPreVenta();
            DataTable        trdo = pre.GetPreVentaxCodigo(CodPreVenta);

            if (trdo.Rows.Count > 0)
            {
                if (trdo.Rows[0]["PrecioSenia"].ToString() != "")
                {
                    Importe = Convert.ToDouble(trdo.Rows[0]["PrecioSenia"].ToString());
                }
            }
            return(Importe);
        }
Example #2
0
        public Int32  GetCodStock(Int32 CodPreVenta)
        {
            Int32 CodStock = 0;

            Clases.cPreVenta pre  = new Clases.cPreVenta();
            DataTable        trdo = pre.GetPreVentaxCodigo(CodPreVenta);

            if (trdo.Rows.Count > 0)
            {
                if (trdo.Rows[0]["CodStock"].ToString() != "")
                {
                    CodStock = Convert.ToInt32(trdo.Rows[0]["CodStock"].ToString());
                }
            }
            return(CodStock);
        }
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (fun.ValidarFecha(txtFechaDesde.Text) == false)
            {
                MessageBox.Show("Fecha desde incorrecta", Clases.cMensaje.Mensaje());
                return;
            }

            if (fun.ValidarFecha(txtFechaHasta.Text) == false)
            {
                MessageBox.Show("Fecha hasta incorrecta", Clases.cMensaje.Mensaje());
                return;
            }

            if (Convert.ToDateTime(txtFechaDesde.Text) > Convert.ToDateTime(txtFechaHasta.Text))
            {
                MessageBox.Show("La fecha desde debe ser inferior a la fecha hasta", Clases.cMensaje.Mensaje());
                return;
            }
            string Apellido = null;

            if (txtApellido.Text != "")
            {
                Apellido = txtApellido.Text;
            }
            Clases.cVenta objVenta   = new Clases.cVenta();
            DateTime      FechaDesde = Convert.ToDateTime(txtFechaDesde.Text);
            DateTime      FechaHasta = Convert.ToDateTime(txtFechaHasta.Text);
            DataTable     trdo       = objVenta.GetVentasxFecha(FechaDesde, FechaHasta, txtPatente.Text.Trim(), Apellido);

            Clases.cPreVenta objPreVenta = new Clases.cPreVenta();

            DataTable trdo2 = objPreVenta.GetPreVentasxFecha(FechaDesde, FechaHasta, txtPatente.Text.Trim(), Apellido);
            //le agre[g
            string Dato      = "";
            Int32  PosPintar = 0;

            PosPintar = trdo.Rows.Count;
            for (int i = 0; i < trdo2.Rows.Count; i++)
            {
                DataRow fila;
                fila = trdo.NewRow();
                for (int j = 0; j < trdo2.Columns.Count; j++)
                {
                    Dato    = trdo2.Rows[i][j].ToString();
                    fila[j] = Dato;
                }
                trdo.Rows.Add(fila);
            }



            Int32 Cant = trdo.Rows.Count;

            txtCantidadVentas.Text = Cant.ToString();
            trdo              = fun.TablaaMiles(trdo, "ImporteVenta");
            trdo              = fun.TablaaMiles(trdo, "ImporteEfectivo");
            trdo              = fun.TablaaMiles(trdo, "ImporteAutoPartePago");
            trdo              = fun.TablaaMiles(trdo, "ImporteCredito");
            trdo              = fun.TablaaMiles(trdo, "ImportePrenda");
            trdo              = fun.TablaaMiles(trdo, "Cheque");
            trdo              = fun.TablaaMiles(trdo, "ImporteCobranza");
            trdo              = fun.TablaaMiles(trdo, "Ganancia");
            txtTotal.Text     = fun.TotalizarColumna(trdo, "Ganancia").ToString();
            txtTotal.Text     = fun.FormatoEnteroMiles(txtTotal.Text);
            Grilla.DataSource = trdo;
            //
            Clases.cVenta ven = new Clases.cVenta();
            //pinto las ventas sin saldo
            for (int k = 0; k < Grilla.Rows.Count - 1; k++)
            {
                Int32 CodVenta = Convert.ToInt32(Grilla.Rows[k].Cells[0].Value.ToString());
                if (k < PosPintar)
                {
                    double ImporteDocumento = 0;
                    double Prenda           = 0;
                    double Cheque           = 0;
                    double Cobranza         = 0;
                    if (Grilla.Rows[k].Cells[10].Value.ToString() != "")
                    {
                        ImporteDocumento = GetSaldoCuotaxCodVenta(CodVenta);
                    }

                    if (Grilla.Rows[k].Cells[11].Value.ToString() != "")
                    {
                        Prenda = GetSaldoPrendaxCodVenta(CodVenta);
                    }

                    if (Grilla.Rows[k].Cells[12].Value.ToString() != "")
                    {
                        Cheque = GetSaldoChequexCodVenta(CodVenta);
                    }

                    if (Grilla.Rows[k].Cells[13].Value.ToString() != "")
                    {
                        Cobranza = GetSaldoCobranza(CodVenta);
                    }
                    double Suma = (ImporteDocumento + Prenda + Cheque + Cobranza);
                    if (Suma == 0)
                    {
                        //pinto
                        Grilla.Rows[k].DefaultCellStyle.BackColor = Color.LightGreen;
                    }
                    int TieneDeuda = ven.TieneDeuda(CodVenta);
                    if (TieneDeuda == 1)
                    {
                        Grilla.Rows[k].DefaultCellStyle.BackColor = Color.LightCyan;
                    }
                }
            }
            //
            Grilla.Columns[0].Visible     = false;
            Grilla.Columns[2].HeaderText  = "Descripción";
            Grilla.Columns[7].HeaderText  = "Total";
            Grilla.Columns[8].HeaderText  = "Efectivo";
            Grilla.Columns[9].HeaderText  = "Vehículo";
            Grilla.Columns[10].HeaderText = "Documentos";
            Grilla.Columns[11].HeaderText = "Prenda";
            Grilla.Columns[13].HeaderText = "Cobranza";
            Grilla.Columns[15].Visible    = false;

            Grilla.Columns[1].Width      = 105;
            Grilla.Columns[5].Visible    = false;
            Grilla.Columns[3].HeaderText = "Parte Pago";
            Grilla.Columns[7].Width      = 80;
            Grilla.Columns[8].Width      = 80;
            Grilla.Columns[9].Width      = 80;
            Grilla.Columns[10].Width     = 80;
            Grilla.Columns[11].Width     = 80;
            Grilla.Columns[12].Width     = 80;
            Grilla.Columns[13].Width     = 80;
            for (int k = 0; k < Grilla.Rows.Count - 1; k++)
            {
                if (k >= PosPintar)
                {
                    Grilla.Rows[k].DefaultCellStyle.BackColor = Color.LightGray;
                }
            }
        }
Example #4
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (fun.ValidarFecha(txtFechaDesde.Text) == false)
            {
                MessageBox.Show("Fecha desde incorrecta", Clases.cMensaje.Mensaje());
                return;
            }

            if (fun.ValidarFecha(txtFechaHasta.Text) == false)
            {
                MessageBox.Show("Fecha hasta incorrecta", Clases.cMensaje.Mensaje());
                return;
            }

            if (Convert.ToDateTime(txtFechaDesde.Text) > Convert.ToDateTime(txtFechaHasta.Text))
            {
                MessageBox.Show("La fecha desde debe ser inferior a la fecha hasta", Clases.cMensaje.Mensaje());
                return;
            }
            Clases.cVenta objVenta   = new Clases.cVenta();
            DateTime      FechaDesde = Convert.ToDateTime(txtFechaDesde.Text);
            DateTime      FechaHasta = Convert.ToDateTime(txtFechaHasta.Text);

            Clases.cPreVenta objPreVenta = new Clases.cPreVenta();
            DataTable        trdo        = objPreVenta.GetPreVentasxFechaEjecucion(FechaDesde, FechaHasta, txtPatente.Text.Trim());
            //le agre[g

            Int32 Cant = trdo.Rows.Count;

            trdo = fun.TablaaMiles(trdo, "ImporteVenta");
            trdo = fun.TablaaMiles(trdo, "ImporteEfectivo");
            trdo = fun.TablaaMiles(trdo, "ImporteAutoPartePago");
            trdo = fun.TablaaMiles(trdo, "ImporteCredito");
            trdo = fun.TablaaMiles(trdo, "ImportePrenda");
            trdo = fun.TablaaMiles(trdo, "Cheque");
            trdo = fun.TablaaMiles(trdo, "ImporteCobranza");
            trdo = fun.TablaaMiles(trdo, "Ganancia");


            Grilla.DataSource = trdo;

            Grilla.Columns[0].Visible     = false;
            Grilla.Columns[2].HeaderText  = "Descripción";
            Grilla.Columns[7].HeaderText  = "Total";
            Grilla.Columns[8].HeaderText  = "Efectivo";
            Grilla.Columns[9].HeaderText  = "Vehículo";
            Grilla.Columns[10].HeaderText = "Documentos";
            Grilla.Columns[11].HeaderText = "Prenda";
            Grilla.Columns[13].HeaderText = "Cobranza";

            Grilla.Columns[1].Width       = 105;
            Grilla.Columns[2].Width       = 160;
            Grilla.Columns[4].Width       = 160;
            Grilla.Columns[5].Visible     = false;
            Grilla.Columns[3].HeaderText  = "Parte Pago";
            Grilla.Columns[7].Width       = 80;
            Grilla.Columns[8].Width       = 80;
            Grilla.Columns[9].Width       = 80;
            Grilla.Columns[10].Width      = 80;
            Grilla.Columns[11].Width      = 80;
            Grilla.Columns[12].Width      = 80;
            Grilla.Columns[13].Width      = 80;
            Grilla.Columns[15].HeaderText = "Ejecución";
            Grilla.Columns[3].Visible     = false;
            Grilla.Columns[9].Visible     = false;
            Grilla.Columns[10].Visible    = false;
            Grilla.Columns[11].Visible    = false;
            Grilla.Columns[12].Visible    = false;
            Grilla.Columns[13].Visible    = false;
        }
Example #5
0
        private void GetGanancia()
        {
            Clases.cFunciones         fun                  = new Clases.cFunciones();
            Clases.cVenta             objVenta             = new Clases.cVenta();
            Clases.cPunitorioCobranza objPunitorioCobranza = new Clases.cPunitorioCobranza();
            Clases.cPunitorioCuota    objPunitorioCuota    = new Clases.cPunitorioCuota();
            DateTime  FechaDesde = Convert.ToDateTime(txtFechaDesde.Text);
            DateTime  FechaHasta = Convert.ToDateTime(txtFechaHasta.Text);
            DataTable trdo       = objVenta.GetVentasxFecha(FechaDesde, FechaHasta, "", null);

            Clases.cPreVenta objPreVenta = new Clases.cPreVenta();
            DataTable        trdo2       = objPreVenta.GetPreVentasxFecha(FechaDesde, FechaHasta, "", null);
            //le agre[g
            string Dato      = "";
            Int32  PosPintar = 0;

            PosPintar = trdo.Rows.Count;
            for (int i = 0; i < trdo2.Rows.Count; i++)
            {
                DataRow fila;
                fila = trdo.NewRow();
                for (int j = 0; j < trdo2.Columns.Count; j++)
                {
                    Dato    = trdo2.Rows[i][j].ToString();
                    fila[j] = Dato;
                }
                trdo.Rows.Add(fila);
            }
            Clases.cPunitorioCuotasAnteriores objPunDocAnt = new Clases.cPunitorioCuotasAnteriores();
            Int32 Cant = trdo.Rows.Count;

            txtCantidad.Text = Cant.ToString();
            trdo             = fun.TablaaMiles(trdo, "ImporteVenta");
            trdo             = fun.TablaaMiles(trdo, "ImporteEfectivo");
            trdo             = fun.TablaaMiles(trdo, "ImporteAutoPartePago");
            trdo             = fun.TablaaMiles(trdo, "ImporteCredito");
            trdo             = fun.TablaaMiles(trdo, "ImportePrenda");
            trdo             = fun.TablaaMiles(trdo, "Cheque");
            trdo             = fun.TablaaMiles(trdo, "ImporteCobranza");
            trdo             = fun.TablaaMiles(trdo, "Ganancia");
            double Utilidad = fun.TotalizarColumna(trdo, "Ganancia");
            Double ImportePunitorioCobranza        = objPunitorioCobranza.GetImportexFecha(FechaDesde, FechaHasta);
            Double ImportePunitorioCuota           = objPunitorioCuota.GetImportexFecha(FechaDesde, FechaHasta);
            Double ImportePunitorioCuotasAnterioes = objPunDocAnt.GetImportexFecha(FechaDesde, FechaHasta);
            Double TotalPunitorio = ImportePunitorioCobranza + ImportePunitorioCuota + ImportePunitorioCuotasAnterioes;

            txtUtilidad.Text = fun.TotalizarColumna(trdo, "Ganancia").ToString();
            txtUtilidad.Text = fun.FormatoEnteroMiles(txtUtilidad.Text);

            Clases.cGastosNegocio gastos = new Clases.cGastosNegocio();
            double TotalGastos           = gastos.GetGastosNegocioxFecha(FechaDesde, FechaHasta);

            txtGastos.Text = fun.SepararDecimales(TotalGastos.ToString());
            txtGastos.Text = fun.FormatoEnteroMiles(txtGastos.Text);

            Clases.cPagoIntereses objpago = new Clases.cPagoIntereses();
            double TotalPago = objpago.GetResumenPagosInteresesxFecha(FechaDesde, FechaHasta);

            txtInteresesPagados.Text = fun.SepararDecimales(TotalPago.ToString());
            txtInteresesPagados.Text = fun.FormatoEnteroMiles(txtInteresesPagados.Text);
            double InteresesGanados = 0;

            Clases.cCuotasAnteriores cuotasAnt = new Clases.cCuotasAnteriores();
            Clases.cCuota            cuota     = new Clases.cCuota();
            InteresesGanados         = cuota.GetGanaciaCobroCuotas(FechaDesde, FechaHasta);
            InteresesGanados         = InteresesGanados + cuotasAnt.GetGanaciaCobroCuotas(FechaDesde, FechaHasta);
            txtInteresesGanados.Text = InteresesGanados.ToString();
            txtInteresesGanados.Text = fun.FormatoEnteroMiles(txtInteresesGanados.Text);
            double Ganancia = Utilidad + TotalPunitorio - TotalPago - TotalGastos + InteresesGanados;

            txtResultado.Text = fun.SepararDecimales(Ganancia.ToString());
            txtResultado.Text = fun.FormatoEnteroMiles(txtResultado.Text);
            txtPunitorio.Text = TotalPunitorio.ToString();
            txtPunitorio.Text = fun.FormatoEnteroMiles(txtPunitorio.Text);
        }