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;
            }

            DateTime FechaDesde = Convert.ToDateTime(txtFechaDesde.Text);
            DateTime FechaHasta = Convert.ToDateTime(txtFechaHasta.Text);
            int      SoloImpago = 0;

            if (chkSoloImpagos.Checked)
            {
                SoloImpago = 1;
            }
            cCobranzaGeneral cob  = new cCobranzaGeneral();
            DataTable        trdo = cob.GetCobranzasGeneralesxFecha(FechaDesde, FechaHasta, SoloImpago, txtConcepto.Text, txtCliente.Text);

            txtTotal.Text                = fun.TotalizarColumna(trdo, "Saldo").ToString();
            trdo                         = fun.TablaaMiles(trdo, "Importe");
            trdo                         = fun.TablaaMiles(trdo, "ImportePagado");
            trdo                         = fun.TablaaMiles(trdo, "Saldo");
            Grilla.DataSource            = trdo;
            Grilla.Columns[4].HeaderText = "Importe Pagado";
            Grilla.Columns[5].HeaderText = "Fecha Pago";
            Grilla.Columns[0].Visible    = false;
            Grilla.Columns[1].Width      = 240;
            Grilla.Columns[4].Width      = 140;
            Grilla.Columns[5].Width      = 120;
            Grilla.Columns[7].Width      = 120;
            if (txtTotal.Text != "" && txtTotal.Text != "0")
            {
                txtTotal.Text = fun.SepararDecimales(txtTotal.Text);
                txtTotal.Text = fun.FormatoEnteroMiles(txtTotal.Text);
            }
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            cFunciones fun = new cFunciones();

            if (txtEfectivo.Text == "")
            {
                Mensaje("Debe ingresar un monto");
                return;
            }

            if (txtDescripcion.Text == "")
            {
                Mensaje("Debe ingresar una Descripción");
                return;
            }

            if (fun.ValidarFecha(txtFecha.Text) == false)
            {
                Mensaje("La fecha ingresada es incorrecta");
                return;
            }

            DateTime         Fecha       = Convert.ToDateTime(txtFecha.Text);
            string           Descripcion = txtDescripcion.Text;
            double           Importe     = fun.ToDouble(txtEfectivo.Text);;
            string           Nombre      = txtNombre.Text;
            string           Telefono    = txtTelefono.Text;
            string           Patente     = txtPatente.Text;
            string           Direccion   = txtDireccion.Text;
            cCobranzaGeneral cob         = new cCobranzaGeneral();

            cob.InsertarCobranza(Fecha, Descripcion, Importe, Nombre, Telefono, Direccion, Patente);
            Mensaje("Datos grabados correctamente");
            txtDescripcion.Text = "";
            txtEfectivo.Text    = "";
            txtNombre.Text      = "";
            txtTelefono.Text    = "";
            txtDireccion.Text   = "";
        }
Beispiel #3
0
        private void ArmarDataTableDeudores()
        {
            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);
            Int32         CodVenta   = 0;
            Double        Cobranza   = 0;

            Clases.cFunciones fun         = new Clases.cFunciones();
            cCobranza         objCobranza = new cCobranza();
            string            Col         = "CodVenta;Patente;Descripcion;Apellido;ImporteVenta;Cuotas;Cheque;Cobranza;Prenda;Telefono;Tipo";

            //Tipo se usa para saber a donde tiene que abrir
            Clases.cCuota  cuota        = new Clases.cCuota();
            Clases.cCheque objCheque    = new Clases.cCheque();
            cPrenda        objPrenda    = new cPrenda();
            string         telefono     = "";
            int            TieneDeuda   = 0;
            Double         Cuotas       = 0;
            Double         Prenda       = 0;
            Double         Cheque       = 0;
            string         val          = "";
            int            TipoPantalla = 1;
            DataTable      tb           = new DataTable();

            tb = fun.CrearTabla(Col);
            DataTable trdo = objVenta.GetVentasxFecha(FechaDesde, FechaHasta, txtPatente.Text.Trim(), Apellido);

            for (int i = 0; i < trdo.Rows.Count; i++)
            {
                CodVenta   = Convert.ToInt32(trdo.Rows[i]["CodVenta"].ToString());
                TieneDeuda = objVenta.TieneDeuda(CodVenta);
                if (TieneDeuda == 1)
                {
                    Cuotas   = cuota.GetSaldoDeudaCuotas(CodVenta);
                    Cheque   = objCheque.GetSaldoCheque(CodVenta);
                    Cobranza = objCobranza.GetSaldoCobranza(CodVenta);
                    Prenda   = objPrenda.ImporteAdeudado(CodVenta);
                    telefono = BuscarTelefonoCliente(CodVenta);
                    val      = CodVenta.ToString();
                    val      = val + ";" + trdo.Rows[i]["Patente"].ToString();
                    val      = val + ";" + trdo.Rows[i]["Descripcion"].ToString();
                    val      = val + ";" + trdo.Rows[i]["Apellido"].ToString();
                    val      = val + ";" + trdo.Rows[i]["ImporteVenta"].ToString();
                    val      = val + ";" + Cuotas.ToString();
                    val      = val + ";" + Cheque.ToString();
                    val      = val + ";" + Cobranza.ToString();
                    val      = val + ";" + Prenda.ToString();
                    val      = val + ";" + telefono.ToString();
                    val      = val + ";" + TipoPantalla.ToString();
                    tb       = fun.AgregarFilas(tb, val);
                }
            }
            TipoPantalla = 2;
            //agrego las cuotas anteriores
            cCuotasAnteriores cuotasAnt  = new cCuotasAnteriores();
            DataTable         tcuotasAnt = cuotasAnt.GetCuotasAnterioresAdeudadesxFecha(txtPatente.Text, txtApellido.Text, FechaDesde, FechaHasta);

            for (int i = 0; i < tcuotasAnt.Rows.Count; i++)
            {
                val = tcuotasAnt.Rows[i]["CodGrupo"].ToString();
                val = val + ";" + tcuotasAnt.Rows[i]["Patente"].ToString();
                val = val + ";" + tcuotasAnt.Rows[i]["Descripcion"].ToString();
                val = val + ";" + tcuotasAnt.Rows[i]["Apellido"].ToString();
                val = val + ";" + tcuotasAnt.Rows[i]["Importe"].ToString();
                val = val + ";";
                val = val + ";";
                val = val + ";";
                val = val + ";";
                val = val + ";" + tcuotasAnt.Rows[i]["Telefono"].ToString();
                val = val + ";" + TipoPantalla.ToString();
                tb  = fun.AgregarFilas(tb, val);
            }
            TipoPantalla = 3;
            //Cobranza general
            cCobranzaGeneral cobGen   = new cCobranzaGeneral();
            DataTable        tbCobGen = cobGen.GetDedudaCobranzaGeneralxFecha(Apellido, txtPatente.Text, FechaDesde, FechaHasta);

            for (int i = 0; i < tbCobGen.Rows.Count; i++)
            {
                val = tbCobGen.Rows[i]["CodCobranza"].ToString();
                val = val + ";" + tbCobGen.Rows[i]["Patente"].ToString();
                val = val + ";" + tbCobGen.Rows[i]["Descripcion"].ToString();
                val = val + ";" + tbCobGen.Rows[i]["Cliente"].ToString();
                val = val + ";" + tbCobGen.Rows[i]["Importe"].ToString();
                val = val + ";" + tbCobGen.Rows[i]["Importe"].ToString();
                val = val + ";";
                val = val + ";" + tbCobGen.Rows[i]["Importe"].ToString();
                val = val + ";";
                val = val + ";" + tbCobGen.Rows[i]["Telefono"].ToString();
                val = val + ";" + TipoPantalla.ToString();
                tb  = fun.AgregarFilas(tb, val);
            }
            //

            Double TotalVenta    = fun.TotalizarColumna(tb, "ImporteVenta");
            Double TotalCuotas   = fun.TotalizarColumna(tb, "Cuotas");
            Double TotalPrenda   = fun.TotalizarColumna(tb, "Prenda");
            Double TotalCobranza = fun.TotalizarColumna(tb, "Cobranza");
            Double TotalCheque   = fun.TotalizarColumna(tb, "Cheque");

            val = "";
            val = val + ";";
            val = val + ";";
            val = val + ";";
            val = val + ";" + TotalVenta.ToString();
            val = val + ";" + TotalCuotas.ToString();
            val = val + ";" + TotalCheque.ToString();
            val = val + ";" + TotalCobranza.ToString();
            val = val + ";" + TotalPrenda.ToString();
            val = val + ";" + telefono.ToString();
            tb  = fun.AgregarFilas(tb, val);

            tb = fun.TablaaMiles(tb, "ImporteVenta");
            tb = fun.TablaaMiles(tb, "Cuotas");
            tb = fun.TablaaMiles(tb, "Cheque");
            tb = fun.TablaaMiles(tb, "Cobranza");
            tb = fun.TablaaMiles(tb, "Prenda");
            Grilla.DataSource            = tb;
            Grilla.Columns[0].Visible    = false;
            Grilla.Columns[10].Visible   = false;
            Grilla.Columns[4].HeaderText = "Total";
            Grilla.Columns[5].HeaderText = "Documentos";
            for (int i = 0; i < Grilla.Rows.Count - 1; i++)
            {
                if (i == (Grilla.Rows.Count - 2))
                {
                    Grilla.Rows[i].DefaultCellStyle.BackColor = Color.LightGreen;
                }
            }
        }
Beispiel #4
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            int ConDeuda = 0;

            if (ChkVencida.Checked == true)
            {
                ConDeuda = 1;
            }
            Clases.cFunciones fun    = new Clases.cFunciones();
            DataTable         tResul = fun.CrearTabla("Codigo;Tipo;Cuota;Patente;Descripcion;Apellido;Telefono;Celular;Importe;Saldo;Vencimiento");

            if (txtPatente.Text == "" && txtApellido.Text == "")
            {
                Mensaje("Debe ingresar un criterio de búsqueda");
                return;
            }
            DateTime  Fecha = Convert.ToDateTime(txtFecha.Text);
            string    Valor = "";
            cCuota    cuota = new cCuota();
            DataTable trdo  = cuota.GetCuotasAdeudadas(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda);

            for (int i = 0; i < trdo.Rows.Count; i++)
            {
                Valor  = trdo.Rows[i]["CodVenta"].ToString();
                Valor  = Valor + ";" + "Cuotas";
                Valor  = Valor + ";" + trdo.Rows[i]["Cuota"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Apellido"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Celular"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["Saldo"].ToString();
                Valor  = Valor + ";" + trdo.Rows[i]["FechaVencimiento"].ToString();
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            cCuotasAnteriores cuotasAnt  = new cCuotasAnteriores();
            DataTable         tcuotasAnt = cuotasAnt.GetCuotasAnterioresAdeudades(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda);

            for (int i = 0; i < tcuotasAnt.Rows.Count; i++)
            {
                Valor  = tcuotasAnt.Rows[i]["CodGrupo"].ToString();
                Valor  = Valor + ";" + "Doc. Anteriores";
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Cuota"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Apellido"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["Saldo"].ToString();
                Valor  = Valor + ";" + tcuotasAnt.Rows[i]["FechaVencimiento"].ToString();
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            cCobranza cob  = new cCobranza();
            DataTable tcob = cob.GetCobranzasAdeudadas(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda);

            for (int i = 0; i < tcob.Rows.Count; i++)
            {
                Valor  = tcob.Rows[i]["CodCobranza"].ToString();
                Valor  = Valor + ";" + "Cobranza";
                Valor  = Valor + ";1";
                Valor  = Valor + ";" + tcob.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Apellido"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Celular"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["Saldo"].ToString();
                Valor  = Valor + ";" + tcob.Rows[i]["FechaCompromiso"].ToString();
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            cCheque   cheque  = new cCheque();
            DataTable tcheque = cheque.GetChequesAdeudados(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda);

            for (int i = 0; i < tcheque.Rows.Count; i++)
            {
                Valor  = tcheque.Rows[i]["CodVenta"].ToString();
                Valor  = Valor + ";" + "Cheque";
                Valor  = Valor + ";1";
                Valor  = Valor + ";" + tcheque.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Apellido"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Celular"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tcheque.Rows[i]["FechaVencimiento"].ToString();
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            cPrenda   prenda  = new cPrenda();
            DataTable tPrenda = prenda.GetPrendasAdeudadas(txtPatente.Text, txtApellido.Text, Fecha, ConDeuda);

            for (int i = 0; i < tPrenda.Rows.Count; i++)
            {
                Valor  = tPrenda.Rows[i]["CodPrenda"].ToString();
                Valor  = Valor + ";" + "Prenda";
                Valor  = Valor + ";1";
                Valor  = Valor + ";" + tPrenda.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Apellido"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Celular"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tPrenda.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";";
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            cCobranzaGeneral cobGen = new cCobranzaGeneral();
            // if (txtApellido.Text != "")
            // {
            DataTable tCobGen = cobGen.GetDedudaCobranzaGeneral(txtApellido.Text, txtPatente.Text);

            for (int i = 0; i < tCobGen.Rows.Count; i++)
            {
                Valor  = tCobGen.Rows[i]["CodCobranza"].ToString();
                Valor  = Valor + ";" + "Cobranza General";
                Valor  = Valor + ";1";
                Valor  = Valor + ";" + tCobGen.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + tCobGen.Rows[i]["Descripcion"].ToString();
                Valor  = Valor + ";" + tCobGen.Rows[i]["Cliente"].ToString();
                Valor  = Valor + ";" + tCobGen.Rows[i]["Telefono"].ToString();
                Valor  = Valor + ";";
                Valor  = Valor + ";" + tCobGen.Rows[i]["Importe"].ToString();
                Valor  = Valor + ";" + tCobGen.Rows[i]["Saldo"].ToString();
                Valor  = Valor + ";";
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            //}
            //DateTime Fecha = Convert.ToDateTime(txtFecha.Text);
            DateTime FechaDesde = Fecha.AddDays(-200);
            DateTime FechaHasta = Fecha.AddDays(10);

            Clases.cAlarma alarma  = new Clases.cAlarma();
            DataTable      talarma = alarma.GetAlertasxRangoFecha(FechaDesde, FechaHasta, "", txtPatente.Text, txtApellido.Text);

            for (int i = 0; i < talarma.Rows.Count; i++)
            {
                Valor  = talarma.Rows[i]["CodAlarma"].ToString();
                Valor  = Valor + ";" + "Alerta";
                Valor  = Valor + ";1";
                Valor  = Valor + ";" + talarma.Rows[i]["Patente"].ToString();
                Valor  = Valor + ";" + talarma.Rows[i]["Nombre"].ToString();
                Valor  = Valor + ";" + talarma.Rows[i]["Cliente"].ToString();
                Valor  = Valor + ";" + "";
                Valor  = Valor + ";";
                Valor  = Valor + ";" + "0";
                Valor  = Valor + ";" + "0";
                Valor  = Valor + ";";
                tResul = fun.AgregarFilas(tResul, Valor);
            }
            Double TotalImporte = 0;
            Double TotalSaldo   = 0;

            TotalImporte              = fun.TotalizarColumna(tResul, "Importe");
            TotalSaldo                = fun.TotalizarColumna(tResul, "Saldo");
            Valor                     = ";" + "Total";
            Valor                     = Valor + ";;;;;;";
            Valor                     = Valor + ";" + TotalImporte.ToString();
            Valor                     = Valor + ";" + TotalSaldo.ToString();
            Valor                     = Valor + ";";
            tResul                    = fun.AgregarFilas(tResul, Valor);
            tResul                    = fun.TablaaMiles(tResul, "Importe");
            tResul                    = fun.TablaaMiles(tResul, "Saldo");
            Grilla.DataSource         = tResul;
            Grilla.Columns[0].Visible = false;
            Pintar();
            for (int i = 0; i < Grilla.Rows.Count - 1; i++)
            {
                if (i == (Grilla.Rows.Count - 2))
                {
                    Grilla.Rows[i].DefaultCellStyle.BackColor = Color.LightGreen;
                }
            }
        }