Exemplo n.º 1
0
  void History::add_posting(const Posting &post)
  {
     if(post.date() <= today && post.accounted())
     {
        unsigned int i;
        for(i = 0; i < _history.size(); i++)
        {
           if(_history[i].date() >= post.date())break;
        }
        _history.insert(_history.begin() + i,post);
        _current_state += post.amount();
     }else
     {
        if(post.accounted())
        {
          std::cerr << "In what universe can a not-yet-passed posting be accounted for?\n"
                    << "I will proceed, but you might want to look at this one:\n"
                    << post << std::endl;
        }
        unsigned int i;
        for(i = 0; i < _in_waiting.size(); i++)
        {
           if(_in_waiting[i].date() >= post.date())break;
        }
        _in_waiting.insert(_in_waiting.begin() + i,post);
     }
//whatever happens, it adds here
     _expected_state += post.amount();
  }
Exemplo n.º 2
0
void MainWindow::submit(){
    Posting *post = new Posting();
    post->name() = ui->lineEdit_name->text();
    post->sum() = ui->doubleSpinBox_summe->value();
    post->categorie() = ui->comboBox_categorie->itemData(ui->comboBox_categorie->currentIndex()).toInt();
    post->earning() = ui->comboBox_art->currentIndex();
    post->discription() = ui->textEdit_discription->toPlainText();
    post->date() = ui->dateTimeEdit->dateTime();

    m_database->sendBuchungsQuerry(post);
    ui->lineEdit_name->clear();
    ui->textEdit_discription->clear();
    ui->doubleSpinBox_summe->clear();
}