Exemplo n.º 1
0
bool Bill::remove(int id)
{
    bool remove = bd.exec("delete from bill where idbill = " + QString::number(id));

    if (remove){
        refreshModel();

        emitCountBills();

        getTotalValue();
    }

    return remove;
}
Exemplo n.º 2
0
numeric_t SplitComponent::setAmount(const numeric_t & amount)
{
  doSetAmount(amount);

  m_pricePerUnit = getAmount() / getInputsUnitsTotal();

  //notify that our cells were 'recomputed'
  ICell* pCell = NULL;
  foreach(pCell, m_cells)
    pCell->notify();

  const numeric_t & myAmount = getAmount();
  Q_ASSERT(compareNumeric(getTotalValue(this), myAmount)); //cells sum should match
  return myAmount;
}
Exemplo n.º 3
0
bool Bill::insert()
{
    QList<QString> values;
    values << QString::number(bd.generateID("bill", "idbill"));
    values << name << QString::number(value) << type << status;
    values << tools.convertDate(dateExpiration) << tools.convertDate(datePayment) << note;

    bool insert = bd.insert("bill", values);
    if (insert){
        emitCountBills();

        refreshModel();

        getTotalValue();
    }

    return insert;
}
Exemplo n.º 4
0
bool Bill::update(int id)
{
    QList<QString> fields;
    QList<QString> values;

    values << name << QString::number(value) << type << status;
    values << tools.convertDate(dateExpiration) << tools.convertDate(datePayment) << note;

    fields << "name" << "valuebill" << "typebill" << "status" << "dateexpiration" << "datepayment" << "note";

    bool update = bd.update("bill", fields, values, "idbill", QString::number(id));

    if (update){
        refreshModel();
        getTotalValue();
    }


    return update;
}
Exemplo n.º 5
0
variant_t Column::getSummary() const
{
  return getTotalValue(nullptr);
}